Git Product home page Git Product logo

Comments (9)

axgkl avatar axgkl commented on August 16, 2024 2

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('&', '&amp;')
                        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.

from ulauncher-window-switcher.

furgerf avatar furgerf commented on August 16, 2024 1

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·♫'}).

from ulauncher-window-switcher.

dflock avatar dflock commented on August 16, 2024

You need wmctrl installed - do you have it?

$ wmctrl --version
1.07

from ulauncher-window-switcher.

abers avatar abers commented on August 16, 2024

Yep - version 1.07

from ulauncher-window-switcher.

axgkl avatar axgkl commented on August 16, 2024

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
(...)

from ulauncher-window-switcher.

dflock avatar dflock commented on August 16, 2024

Could you post the output of wmctrl -d on your system - or some of it, at least?

from ulauncher-window-switcher.

dflock avatar dflock commented on August 16, 2024

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 ;)

from ulauncher-window-switcher.

furgerf avatar furgerf commented on August 16, 2024

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!

from ulauncher-window-switcher.

dflock avatar dflock commented on August 16, 2024

This is fixed by @furgerf and myself in #7 - thanks everyone for your help & patience.

from ulauncher-window-switcher.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.