dotfiles/bin/sway-focus

20 lines
393 B
Text
Raw Normal View History

#!/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}')