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

ewmh.get_desktop_names() gets out of sync with actual desktop manager #17

Open
tauchris opened this issue Jan 25, 2023 · 2 comments
Open

Comments

@tauchris
Copy link

While tinkering with a script to rename and select virtual desktops from a Python script, using xpybutil, I ran into a scenario in which my desktop manager had 8 virtual desktops, but ewhm.get_desktop_names() seemed to be returning some old/cached value from a good while back (probably more than an hour old). Other ewmh APIS seem to be working correctly (giving current/accurate results). Not sure if this is a bug in the ewhm module of xpybutil, or something deeper (something buggy in the Mate desktop manager?) -- but the Workspace Switcher Preferences dialog for the panel applet appears to be correct/accurate, and works correctly, which seems to suggest that the bug is not in the desktop manager... (?) Here's my sample script (as testgetnames.txt -- ironic that it's not possible to attach a python script as "*.py" here...) and a screen shot of the results, showing the bug.

testgetnames.txt
Capture

Note, I'm using Python 3.11.0 on x86_64 GNU/Linux, and Mate Desktop Environment 1.16.2.

@BurntSushi
Copy link
Owner

I stopped using this package probably more than 10 years ago. Sorry, but I don't know how to help you.

I think you should use tools like xprop to confirm whether your environment is conforming to EWMH or not.

@tauchris
Copy link
Author

tauchris commented Jan 26, 2023

Thanks for the answer!

Dug into spec a bit -- seems there is no reliable relationship between what _NET_DESKTOP_NAMES can return and what the actual visible desktops are. From the spec (https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm45154644308928):

_NET_DESKTOP_NAMES

_NET_DESKTOP_NAMES, UTF8_STRING[]

The names of all virtual desktops. This is a list of NULL-terminated strings in UTF-8 encoding [UTF8]. This
property MAY be changed by a Pager or the Window Manager at any time.

Note: The number of names could be different from _NET_NUMBER_OF_DESKTOPS. If it is less than
_NET_NUMBER_OF_DESKTOPS, then the desktops with high numbers are unnamed. If it is larger than
_NET_NUMBER_OF_DESKTOPS, then the excess names outside of the _NET_NUMBER_OF_DESKTOPS are
considered to be reserved in case the number of desktops is increased.

Rationale: The name is not a necessary attribute of a virtual desktop. Thus the availability or unavailability
of names has no impact on virtual desktop functionality. Since names are set by users and users are likely
to preset names for a fixed number of desktops, it doesn't make sense to shrink or grow this list when the
number of available desktops changes.

So, that begs the question of whether there is value in using this API to programmatically access/manipulate virtual desktops... Pretty disappointing, but certainly, can't blame this library for EWMH's shortcomings, if I'm understanding that correctly.

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