Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WM_CLASS is not set on Linux. #78

Closed
ghost opened this issue Nov 21, 2019 · 10 comments
Closed

WM_CLASS is not set on Linux. #78

ghost opened this issue Nov 21, 2019 · 10 comments

Comments

@ghost
Copy link

ghost commented Nov 21, 2019

The Linux release does not set WM_CLASS and related information. Without it, an icon can't be set and the application shows up as "Unknown" when alt-tabbing in Gnome.

@akiyosi
Copy link
Owner

akiyosi commented Nov 22, 2019

Hi😀

I added WM_CLASS at cd48c9f.
xprop command returned the following information.
Do you have any other options to add?
I don't know enough options because I don't use the Linux GUI as main.

akiyosi@ubuntu:~$ xprop
_NET_WM_STATE(ATOM) = 
_NET_WM_DESKTOP(CARDINAL) = 0
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 30, 0
WM_STATE(WM_STATE):
		window state: Normal
		icon window: 0x0
_GTK_EDGE_CONSTRAINTS(CARDINAL) = 170
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW
_NET_WM_ICON_NAME(UTF8_STRING) = 
_NET_WM_WINDOW_OPACITY(CARDINAL) = 4294967295
XdndAware(ATOM) = BITMAP
WM_NAME(STRING) = "[No Name] - NVIM"
_NET_WM_NAME(UTF8_STRING) = "[No Name] - NVIM"
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1
WM_CLIENT_LEADER(WINDOW): window id # 0x260002a
WM_HINTS(WM_HINTS):
		Client accepts input or input focus: True
		window id # of group leader: 0x260002a
WM_CLIENT_MACHINE(STRING) = "ubuntu"
_NET_WM_PID(CARDINAL) = 127045
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 39845929
WM_CLASS(STRING) = "goneovim", "goneovim"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_NORMAL_HINTS(WM_SIZE_HINTS):
		user specified location: 0, 0
		user specified size: 800 by 600
		program specified minimum size: 800 by 600
		window gravity: NorthWest

@ghost
Copy link
Author

ghost commented Nov 22, 2019

Thanks!

I'll set up a development environment and give it a try.

@ghost
Copy link
Author

ghost commented Nov 22, 2019

I finally got a build environment up (my laptop is slow) but my binary does not have a WM_CLASS.

@akiyosi
Copy link
Owner

akiyosi commented Nov 23, 2019

Umm, It's strange.
what is the result of xprop?

@ghost
Copy link
Author

ghost commented Nov 23, 2019

Hi Akiyoshi!

I ran the build almost like the wiki. I had to disable GO111MODULES to download the source.

$ go version
go version go1.13 linux/amd64
$ set -x GO111MODULE off
$ go get -d github.com/akiyosi/goneovim/editor/

Then I ran the rest of the steps as per the wiki.

$ cd $GOPATH/src/github.com/akiyosi/goneovim/cmd/goneovim
$ qtmoc
$ qtdeploy build desktop

As you can see, there is no WM_CLASS.

$ deploy/linux/goneovim &
$ xprop
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x3e0002b
_NET_WM_STATE(ATOM) = _NET_WM_STATE_FOCUSED
_NET_WM_DESKTOP(CARDINAL) = 1
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 37, 0
_UNITE_ORIGINAL_STATE(CARDINAL) = 2, 1, 0, 0, 0
WM_STATE(WM_STATE):
                window state: Normal
                icon window: 0x0
_GTK_EDGE_CONSTRAINTS(CARDINAL) = 170
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_W
M_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW
_NET_WM_ICON_NAME(UTF8_STRING) = 
_NET_WM_WINDOW_OPACITY(CARDINAL) = 4294967295
XdndAware(ATOM) = BITMAP
WM_NAME(STRING) = 
_NET_WM_NAME(UTF8_STRING) = 
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1
WM_CLIENT_LEADER(WINDOW): window id # 0x3e0000e
WM_HINTS(WM_HINTS):
                Client accepts input or input focus: True
                Initial state is Normal State.
                window id # of group leader: 0x3e0000e
WM_CLIENT_MACHINE(STRING) = "marvin"
_NET_WM_PID(CARDINAL) = 11942
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 65011725
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                user specified location: 0, 0
                user specified size: 800 by 600
                program specified minimum size: 800 by 600
                window gravity: NorthWest

I looked at the change you made in the code. I saw that you simply set an environment variable RESOURCE_NAME. I tried to export the variable before running and it still didn't work.

@akiyosi
Copy link
Owner

akiyosi commented Nov 23, 2019

Thank you for investigating.

I don't know why this difference occurs.
I also googled the standard way to set WM_CLASS in Qt but didn't understand well...

In my environment, Linux binaries were built using therecipe/qt:linux container, and I confirmed that WM_CLASS was set correctly.
I will release the latest binary as v0.4.1, so could you check the setting of WM_CLASS there?

@smolck
Copy link
Contributor

smolck commented Nov 23, 2019

@akiyosi @DarkerMatter This diff fixes the problem for me:

diff --git a/editor/editor.go b/editor/editor.go
index 1c7afe1..15053d7 100644
--- a/editor/editor.go
+++ b/editor/editor.go
@@ -156,7 +156,7 @@ func InitEditor() {
        }
        e := editor

-       e.app = widgets.NewQApplication(0, nil)
+       e.app = widgets.NewQApplication(len(os.Args), os.Args)
        e.app.ConnectAboutToQuit(func() {
                e.cleanup()
        })

See matplotlib/matplotlib#8394 (comment). widgets.NewApplication(len(os.Args), os.Args) is used here in therecipe/qt, so I figured I'd try it out and it worked.

@ghost
Copy link
Author

ghost commented Nov 23, 2019

Hi @smolck ,

that did the trick! Thank you :-)

@akiyosi
Copy link
Owner

akiyosi commented Nov 23, 2019

@smolck
thx!😀
I will commit the fix.

@ghost
Copy link
Author

ghost commented Nov 24, 2019

I have verified the committed version works for me.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants