new switcher

This commit is contained in:
Greg 2024-10-23 19:31:58 +03:00
parent e1e48ca6bc
commit a4ee9d5e19
3 changed files with 20 additions and 4 deletions

View file

@ -17,7 +17,7 @@ titlebar_padding 1
titlebar_border_thickness 1
smart_borders off
gaps inner 10
for_window [app_id="kitty_shell"] floating enable, resize set 700 700, move center
### Variables
#
@ -30,7 +30,7 @@ set $right l
set $term kitty
set $browser firefox
set $menu fish -c 'rofi -show run -terminal $term'
set $switcher rofi -show window
set $switcher ~/.scripts/kitty_shell.fish ~/.scripts/switcher.fish
set $laptop eDP-1
set $external DP-1
@ -105,6 +105,7 @@ input "type:keyboard" {
bindsym $mod+Return exec $term
bindsym $mod+Shift+q kill
bindsym $mod+Space exec $menu
bindsym $mod+Tab exec $switcher
bindsym $mod+Backspace exec ~/.config/sway/power.fish
bindsym $mod+grave exec ~/.config/sway/shot.fish
bindsym $mod+backslash exec ~/.config/sway/search.fish
@ -125,7 +126,7 @@ input "type:keyboard" {
# Moving around:
#
# Move your focus around
bindsym $mod+Tab focus next
#bindsym $mod+Tab focus next
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up

3
.scripts/kitty_shell.fish Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/fish
kitty --class "kitty_shell" $argv

View file

@ -1,4 +1,16 @@
#!/usr/bin/fish
swaymsg -t get_tree -r | jq -r '.. | select(.app_id?) | (.pid|tostring) + " " + .app_id + " " + .name' | fzf --with-nth 2.. | awk '{print $1}' | xargs printf "[pid=%d] focus" | xargs swaymsg
set lock /tmp/window_switcher_lock
test -e $lock && exit
touch $lock
set windows (swaymsg -t get_tree -r)
set query '.. | select(.app_id?) | (.pid|tostring) + " " + .app_id + " " + .name'
set fzf_options --with-nth 2..
set id (echo $windows | jq -r $query | fzf $fzf_options | awk '{print $1}')
swaymsg "[pid=$id]" focus
rm $lock