Skip to content

Instantly share code, notes, and snippets.

@m-col
Created May 6, 2020 19:14
Show Gist options
  • Save m-col/4f96e9c1b417574a68c6787e1f825857 to your computer and use it in GitHub Desktop.
Save m-col/4f96e9c1b417574a68c6787e1f825857 to your computer and use it in GitHub Desktop.
scroll groups in qtile
"""
mod-m and mod-n scroll between groups right and left respectively.
Depending on the number of screens used the integers will need changing (where there are 3s, 4s and 5s below).
The numbers below are for 3 groups on one screen and 2 on the other - knowing that it can be worked out (hopefully!)
"""
def _scroll_screen(direction):
""" Scroll next group of subset allocated to specific screen """
if num_monitors > 1:
def _inner(qtile):
current = qtile.groups.index(qtile.current_group)
if current < 3:
destination = (current + direction) % 3
else:
destination = 3 if current == 4 else 4
qtile.groups[destination].cmd_toscreen()
else:
def _inner(qtile):
current = qtile.groups.index(qtile.current_group)
destination = (current + direction) % 5
qtile.groups[destination].cmd_toscreen()
return _inner
keys.extend([
Key([mod], 'm', lazy.function(_scroll_screen(1))),
Key([mod], 'n', lazy.function(_scroll_screen(-1))),
])
@pawamoy
Copy link

pawamoy commented May 6, 2020

This is why I love Qtile, you can do anything with it 😍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment