This commit is contained in:
2022-01-04 15:45:42 +01:00
parent a6721b9de2
commit cd4e91381b
3 changed files with 21 additions and 9 deletions

View File

@@ -35,7 +35,7 @@ set $settings gnome-control-center
set $toggle_layout ~/.config/sway/toggle_layout.sh
set $toggle_gaps ~/.config/sway/toggle_gaps.sh
set $web_search $wofi_scripts/web-search.sh
set $select_window ~/.config/sway/select_window.sh
# Input configuration
input * {
@@ -217,7 +217,7 @@ output * bg `find ~/.customization/background -type f | shuf -n 1` fill
bindsym $mod+s exec $screenshot
bindsym $mod+Tab exec $wofi_scripts/sway-select-window.sh
bindsym $mod+Tab exec $select_window
#
# Scratchpad:
#

19
configs/sway/select_window.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
# ------Get available windows:
windows=$(swaymsg -t get_tree | jq -r '
recurse(.nodes[]?) |
recurse(.floating_nodes[]?) |
select(.type=="con"), select(.type=="floating_con") |
(.id | tostring) + " " + .app_id + ": " + .name')
# ------Limit wofi's height with the number of opened windows:
height=$(echo "$windows" | wc -l)
height=$(($height + 2))
# ------Select window with wofi:
selected=$(echo "$windows" | wofi -d --lines $height -i -p "Switch to:" | awk '{print $1}')
# ------Tell sway to focus said window:
swaymsg [con_id="$selected"] focus