diff --git a/configs/.zshrc b/configs/.zshrc index aba0dca..893f8b1 100644 --- a/configs/.zshrc +++ b/configs/.zshrc @@ -73,10 +73,3 @@ fi export PNPM_HOME="$HOME/.local/share/pnpm" export PATH="$PNPM_HOME:$PATH" -if [ -e /home/jim/.nix-profile/etc/profile.d/nix.sh ]; then . /home/jim/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer - -PATH="/home/jim/perl5/bin${PATH:+:${PATH}}"; export PATH; -PERL5LIB="/home/jim/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; -PERL_LOCAL_LIB_ROOT="/home/jim/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; -PERL_MB_OPT="--install_base \"/home/jim/perl5\""; export PERL_MB_OPT; -PERL_MM_OPT="INSTALL_BASE=/home/jim/perl5"; export PERL_MM_OPT; diff --git a/configs/sway/config b/configs/sway/config index d6c85bb..d9b3bdf 100644 --- a/configs/sway/config +++ b/configs/sway/config @@ -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: # diff --git a/configs/sway/select_window.sh b/configs/sway/select_window.sh new file mode 100755 index 0000000..7b77d50 --- /dev/null +++ b/configs/sway/select_window.sh @@ -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