From 39f04b8a2e18c0e4927c65aac5858c3ef73e4376 Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Sat, 13 Jun 2020 15:24:05 +0200 Subject: [PATCH] add script to manage focus on devel workspace --- .config/mako/config | 8 ++++---- .config/sway/config | 32 ++++++++++++++++---------------- bin/sway-focus | 19 +++++++++++++++++++ 3 files changed, 39 insertions(+), 20 deletions(-) create mode 100755 bin/sway-focus diff --git a/.config/mako/config b/.config/mako/config index 250eef2..b6f551d 100644 --- a/.config/mako/config +++ b/.config/mako/config @@ -1,9 +1,9 @@ -font=IBM Plex Sans Condensed 20 -width=800 +font=IBM Plex Sans Condensed 16 +width=600 height=400 -padding=20 +padding=10 margin=10,0,2 -anchor=bottom-right +anchor=bottom-left background-color=#000000ff border-color=#e65100ff text-color=#ff6f00ff diff --git a/.config/sway/config b/.config/sway/config index 3b30722..0b02231 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -33,22 +33,22 @@ bindsym XF86AudioPlay exec playerctl play-pause bindsym XF86AudioNext exec playerctl next bindsym XF86AudioPrev exec playerctl previous -bindsym F1 swap container with mark F1 -bindsym F2 swap container with mark F2 -bindsym F3 swap container with mark F3 -bindsym F4 swap container with mark F4 -bindsym F5 swap container with mark F5 -bindsym F6 swap container with mark F6 -bindsym F7 swap container with mark F7 -bindsym F8 swap container with mark F8 -bindsym Shift+F1 mark F1 -bindsym Shift+F2 mark F2 -bindsym Shift+F3 mark F3 -bindsym Shift+F4 mark F4 -bindsym Shift+F5 mark F5 -bindsym Shift+F6 mark F6 -bindsym Shift+F7 mark F7 -bindsym Shift+F8 mark F8 +bindsym F1 exec sway-focus F1 +bindsym F2 exec sway-focus F2 +bindsym F3 exec sway-focus F3 +bindsym F4 exec sway-focus F4 +bindsym F5 workspace 5 +bindsym F6 workspace 6 +bindsym F7 workspace 7 +bindsym F8 workspace 8 +bindsym Shift+F1 mark F1; exec sway-focus F1 +bindsym Shift+F2 mark F2; exec sway-focus F2 +bindsym Shift+F3 mark F3; exec sway-focus F3 +bindsym Shift+F4 mark F4; exec sway-focus F4 +bindsym Shift+F5 move container to workspace 5 +bindsym Shift+F6 move container to workspace 6 +bindsym Shift+F7 move container to workspace 7 +bindsym Shift+F8 move container to workspace 8 bindsym Mod4+1 workspace 1 bindsym Mod4+2 workspace 2 diff --git a/bin/sway-focus b/bin/sway-focus new file mode 100755 index 0000000..8d24e84 --- /dev/null +++ b/bin/sway-focus @@ -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}')