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

Current group lost on dgroup removal #4870

Closed
2 tasks done
phragment opened this issue Jun 7, 2024 · 1 comment · Fixed by #4895
Closed
2 tasks done

Current group lost on dgroup removal #4870

phragment opened this issue Jun 7, 2024 · 1 comment · Fixed by #4895

Comments

@phragment
Copy link
Contributor

Issue description

There seems to be a race condition during the auto removal of dynamically created groups.
I make intensive use of dynamic groups and notices strange behavior when dynamically created groups get removed (after closing the last window in them).
The groupbox widget doesn't highlight the current group anymore, and switching between groups using shortcuts results in the exceptions appended below.
Whats probably worse, I can (accidentally) start windows on the now "non existant group", when I then switch to another group (eg using the groupbox widget) I can never reach this "hidden" group again.

I can reproduce this by running the following script. I'm not 100% sure if this will take the same code path internally.
I tried to debug this myself, but got stuck tracking the delayed removal of the dgroup (delete_client) in libqtile/dgroups.py

#!/usr/bin/env python3

import time

from libqtile.command.client import InteractiveCommandClient


if __name__ == "__main__":
    client = InteractiveCommandClient()

    # create two groups
    #   and make them active (populating group "switch stack")
    for i in range(2):
        gname = "test " + str(i)
        client.addgroup(gname)
        client.group[gname].toscreen()
        time.sleep(1)

    # cleanup
    time.sleep(1)
    for i in range(2):
        gname = "test " + str(i)
        client.delgroup(gname)

Version

0.26.1.dev0+ge4b4bb8b.d20240523

Backend

Wayland (experimental)

Config

No response

Logs

libqtile: KB command error prev_group: Traceback (most recent call last):
    File "/usr/lib/python3.12/site-packages/libqtile/command/interface.py", line 317, in call
     return SUCCESS, cmd(obj, *args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.12/site-packages/libqtile/config.py", line 665, in prev_group
     n = self.group.get_previous_group(skip_empty, skip_managed)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.12/site-packages/libqtile/group.py", line 432, in get_previous_group
     return self._get_group(-1, skip_empty, skip_managed)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.12/site-packages/libqtile/group.py", line 428, in _get_group
     index = (groups.index(self) + direction) % len(groups)
          ^^^^^^^^^^^^^^^^^^
    ValueError: <group.Group ('test 0')> is not in list

Required

  • I have searched past issues to see if this bug has already been reported, and it hasn't been.
  • I understand that people give their precious time for free, and thus I've done my very best to make this problem as easy as possible to investigate.
@jwijenbergh
Copy link
Contributor

Misclick

@jwijenbergh jwijenbergh reopened this Jun 9, 2024
phragment added a commit to phragment/qtile that referenced this issue Jun 22, 2024
- unify logic for selecting new active group on group removal
- allow specifying if added group should be persistent

Fixes qtile#4870
phragment added a commit to phragment/qtile that referenced this issue Jun 22, 2024
- unify logic for selecting new active group on group removal
- allow specifying if added group should be persistent

Fixes qtile#4870
phragment added a commit to phragment/qtile that referenced this issue Jun 22, 2024
unify logic for selecting new active group on group removal

Fixes qtile#4870
tych0 pushed a commit that referenced this issue Jun 23, 2024
unify logic for selecting new active group on group removal

Fixes #4870
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants