add script to manage focus on devel workspace

This commit is contained in:
Daniel Lundin 2020-06-13 15:24:05 +02:00
parent 63330cbe42
commit 39f04b8a2e
No known key found for this signature in database
GPG key ID: 6AB527C9196ACDCC
3 changed files with 39 additions and 20 deletions

19
bin/sway-focus Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env python
from i3ipc import Connection
import sys
try:
mark=sys.argv[1]
except IndexError:
mark=None
c = Connection()
c.command('workspace 1')
# Focus on widest window
windows = c.get_tree().find_focused().workspace().descendants()
w = sorted(windows, key=lambda w: w.window_rect.width)[-1]
w.command('focus')
if mark:
w.command(f'swap container with mark {mark}')