app/internal/window: set WM_CLASS to binary name

WM_CLASS is used by Linux desktops to provide hints for window
grouping, icons to show and startup notifications.

https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html

This patch set the WM_CLASS to the binary name.

Signed-off-by: Jason <sourcehut@sweatyballs.es>
This commit is contained in:
Jason
2020-06-16 13:07:33 +02:00
committed by Elias Naur
parent 1eedd19231
commit a3f7eaae08
+7
View File
@@ -26,6 +26,8 @@ import (
"errors"
"fmt"
"image"
"os"
"path/filepath"
"strconv"
"sync"
"time"
@@ -508,6 +510,11 @@ func newX11Window(gioWin Callbacks, opts *Options) error {
hints.flags = C.InputHint
C.XSetWMHints(dpy, win, &hints)
name := C.CString(filepath.Base(os.Args[0]))
defer C.free(unsafe.Pointer(name))
wmhints := C.XClassHint{name, name}
C.XSetClassHint(dpy, win, &wmhints)
w.atoms.utf8string = w.atom("UTF8_STRING", false)
w.atoms.evDelWindow = w.atom("WM_DELETE_WINDOW", false)
w.atoms.clipboard = w.atom("CLIPBOARD", false)