qtile: Add swap windows function to swap windows between two groups
This commit is contained in:
parent
7ec983116f
commit
6e221b4ed7
@ -58,7 +58,7 @@ def kbd_brightness_up(qtile):
|
||||
current_kbd_light[0] = min(len(kbd_lights) - 1, idx+1)
|
||||
value = kbd_lights[current_kbd_light[0]]
|
||||
qtile.spawn(f"asusctl -k {value}")
|
||||
|
||||
|
||||
def kbd_brightness_down(qtile):
|
||||
idx = current_kbd_light[0]
|
||||
current_kbd_light[0] = max(0, idx-1)
|
||||
@ -74,6 +74,7 @@ def toggle_language(qtile):
|
||||
qtile.spawn("setxkbmap -layout us -variant altgr-intl")
|
||||
current_language[0] = "en"
|
||||
|
||||
|
||||
keys = [
|
||||
# A list of available commands that can be bound to keys can be found
|
||||
# at https://docs.qtile.org/en/latest/manual/config/lazy.html
|
||||
@ -257,6 +258,17 @@ def go_to_group(name: str) -> Callable:
|
||||
qtile.groups_map[name].toscreen()
|
||||
return _inner
|
||||
|
||||
def swap_windows(name: str) -> Callable:
|
||||
def _inner(qtile) -> None:
|
||||
other_windows = [*qtile.groups_map[name].windows]
|
||||
current_windows = [*qtile.current_group.windows]
|
||||
for win in current_windows:
|
||||
win.togroup(name)
|
||||
for win in other_windows:
|
||||
win.togroup(qtile.current_group.name)
|
||||
|
||||
return _inner
|
||||
|
||||
for i in groups:
|
||||
keys.extend(
|
||||
[
|
||||
@ -275,6 +287,12 @@ for i in groups:
|
||||
lazy.window.togroup(i.name, switch_group=False),
|
||||
desc="Switch to & move focused window to group {}".format(i.name),
|
||||
),
|
||||
Key(
|
||||
[mod, "control"],
|
||||
i.name,
|
||||
lazy.function(swap_windows(i.name)),
|
||||
desc="Swap all windows with windows from N group".format(i.name),
|
||||
),
|
||||
# Or, use below if you prefer not to switch to that group.
|
||||
# # mod1 + shift + letter of group = move focused window to group
|
||||
# Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
|
||||
|
Loading…
x
Reference in New Issue
Block a user