Closed abers closed 2 years ago
You need wmctrl
installed - do you have it?
$ wmctrl --version
1.07
Yep - version 1.07
same problem hier, wmctrl version 1.07. WM is dwm. Distri Fedora 32.
/home/gk$ wmctrl -l
0x01800006 1 gkfedora gk@gkfedora [1] /home/gk
0x01a00005 4 gkfedora Loading... · Issue #2 · dflock/ulauncher-window-switcher - Google Chrome
(...)
Ok, I logged some output of your main.py (in $HOME/.local/share/ulauncher/extensions/com.github.dflock.ulauncher-window-switcher
):
Problem is that on my dwm this is not delivering what you expect:
# Get list of all workspaces and process into a dictionary that looks like this:
# {<workspace_id>: <workspace_name>}
result = subprocess.run(
['wmctrl -d | awk \'{$1=$2=$3=$4=$5=$6=$7=$8=$9=""; print $0}\''],
capture_output=True,
shell=True,
text=True,
).stdout
On my system wmctrl -d
delivers 511 lines, matching their tag combinations (they don't have classic workspaces) - and none matches the w_dict
. So I just omit the workspace info and all is fine:
# Get list of all workspaces and process into a dictionary that looks like this:
# {<workspace_id>: <workspace_name>}
# result = subprocess.run(
# ['wmctrl -d | awk \'{$1=$2=$3=$4=$5=$6=$7=$8=$9=""; print $0}\''],
# capture_output=True,
# shell=True,
# text=True,
# ).stdout
# ws_list = [y for y in (x.strip() for x in result.splitlines()) if y]
# ws_dict = {i: x for i, x in enumerate(ws_list)}
for w_idx, window in w_dict.items():
if search == '' or search in window['name'].lower():
items.append(
ExtensionResultItem(
icon='images/window.svg',
# Workaround for https://github.com/Ulauncher/Ulauncher/issues/587
name=window['name'].replace('&', '&')
if search
else window['name'],
description=f'Workspace: {window["ws"]}, Window Id: {w_idx}',
on_enter=RunScriptAction(f'wmctrl -ia {w_idx}'),
)
)
Not sure how you could autodetect and remember that though, you would need global state or a tempfile, where you flag if ws_list is empty or so... I guess a config setting resolve_workspace_names
default true
would be the most robust answer.
Could you post the output of wmctrl -d
on your system - or some of it, at least?
Same issue for me with awesomewm and fancy workspace names. My workspaces are, according to wmctrl -d
:
0 - DG: N/A VP: N/A WA: N/A ~
1 * DG: N/A VP: N/A WA: N/A ~
2 - DG: N/A VP: N/A WA: N/A ➋ ·web·🌏
3 - DG: N/A VP: N/A WA: N/A ➐ ·foo
4 - DG: N/A VP: N/A WA: N/A ➎ ·media·♫
This gets parsed as ws_dict = {0: '·web·🌏', 1: '·foo', 2: '·media·♫'}
- seems like awk
is cutting off too much. For me it works properly when I remove the $9=
(giving me ws_dict = {0: '~', 1: '~', 2: '➋ ·web·🌏', 3: '➐ ·foo', 4: '➎ ·media·♫'}
).
This is very helpful, thank you! I'm just about to go on vacation, but will be back in a week and will have a go at fixing this then - if no one else fixes it first ;)
Sure, I can submit a PR. Sounds like wmctrl
isn't entirely sticking to its documentation:
List all desktops managed by the window manager. One line is output for each desktop, with the line broken up into spacce separated columns. The first column contains an integer desktop number. The second column contains a '*' character for the current desktop, otherwise it contains a '-' character. The next two columns contain the fixed string DG: and then the desktop geometry as '
x ' (e.g. '1280x1024'). The following two columns contain the fixed string VP: and then the viewport position in the format ' , ' (e.g. '0,0'). The next three columns after this contains the fixed string WA: and then two columns with the workarea geometry as 'X,Y and WxH' (e.g. '0,0 1280x998'). The rest of the line contains the name of the desktop (possibly containing multiple spaces).
In my case, because no workarea is available, there's one less column. I'm not that fluent with awk
and would probably move this (more complex) parsing to the python code.
Thanks for providing this extension and enjoy your holiday - hopefully somewhere a bit colder!
This is fixed by @furgerf and myself in #7 - thanks everyone for your help & patience.
I am using Ulauncher v5.10.0 on Kubuntu 20,04 with i3-gaps as the window manager.
When trying to switch windows and after typing 'win ' ulauncher displays a single item 'Loading...' - but nothing ever loads. No entries are made in the logs so I am unsure what is causing the issue.