diff --git a/.config/sway/app-focus b/.config/sway/app-focus new file mode 100755 index 0000000..cc4efc8 --- /dev/null +++ b/.config/sway/app-focus @@ -0,0 +1,53 @@ +#!/bin/sh + +app="$1" +command="$2" + +# Récupère les conteneurs correspondant à l'application. +windows=$(swaymsg -t get_tree | jq -r --arg app "$app" ' + recurse(.nodes[], .floating_nodes[]) + | select( + (.app_id == $app) or + (.window_properties.class == $app) + ) + | .id +') + +# Aucune fenêtre : lancer l'application +if [ -z "$windows" ]; then + swaymsg exec "$command" + exit 0 +fi + +# Récupère la fenêtre actuellement focalisée +focused=$(swaymsg -t get_tree | jq -r ' + recurse(.nodes[], .floating_nodes[]) + | select(.focused == true) + | .id +') + +# Transforme la liste en tableau +set -- $windows + +# Cherche la fenêtre suivante après celle qui est actuellement focus +next="" +found=0 + +for id in "$@"; do + if [ "$found" = 1 ]; then + next="$id" + break + fi + + if [ "$id" = "$focused" ]; then + found=1 + fi +done + +# Si on était sur la dernière fenêtre, revenir à la première +if [ -z "$next" ]; then + next="$1" +fi + +swaymsg "[con_id=$next] focus" + diff --git a/.config/sway/config.d/03-statusbar.conf b/.config/sway/config.d/03-statusbar.conf index e2f754d..2eb5e64 100644 --- a/.config/sway/config.d/03-statusbar.conf +++ b/.config/sway/config.d/03-statusbar.conf @@ -36,5 +36,5 @@ #} # show/hide bar -bindsym $mad+b exec "swaymsg bar mode hide bar-0" -bindsym $mad+Shift+b exec "swaymsg bar mode dock bar-0" +#bindsym $mad+b exec "swaymsg bar mode hide bar-0" +#bindsym $mad+Shift+b exec "swaymsg bar mode dock bar-0" diff --git a/.config/sway/config.d/05-scratchpad.conf b/.config/sway/config.d/05-scratchpad.conf index a365923..bbc3e7a 100644 --- a/.config/sway/config.d/05-scratchpad.conf +++ b/.config/sway/config.d/05-scratchpad.conf @@ -4,7 +4,7 @@ # You can send windows there and get them back later. # launch a terminal and move it to scratch at launch -exec --no-startup-id "sleep 10 && $term -t scratch -a scratch -m -e 'byobu'" +exec --no-startup-id "sleep 10 && $term -t scratch -a scratch -m -e byobu" for_window [app_id="scratch"] floating enable, move absolute position center for_window [app_id="scratch"] move scratchpad diff --git a/.config/sway/config.d/08-launchers.conf b/.config/sway/config.d/08-launchers.conf index 6acbe7e..3ebd1f8 100644 --- a/.config/sway/config.d/08-launchers.conf +++ b/.config/sway/config.d/08-launchers.conf @@ -11,9 +11,9 @@ bindsym $mod+ctrl+t exec $term bindsym $mad+F1 exec "nakedhelp" # infos system -bindsym $mad+m exec "$term --title=btop --app-id=btop btop" -bindsym $mad+i exec "$infosbox" -bindsym $mad+Shift+i exec "$infosystem" +#bindsym $mad+m exec "$term --title=btop --app-id=btop btop" +#bindsym $mad+i exec "$infosbox" +#bindsym $mad+Shift+i exec "$infosystem" # lockscreen bindsym $mad+Shift+l exec "$locker" @@ -31,8 +31,19 @@ bindsym $mad+Shift+x exec "$mailer" bindsym $mad+w exec "$browser" bindsym $mad+Shift+w exec "$browser" +# Applications +bindsym $mad+f exec ~/.config/sway/app-focus "firefox" "firefox" +bindsym $mad+m exec ~/.config/sway/app-focus "Mattermost.Desktop" "mattermost" +bindsym $mad+i exec ~/.config/sway/app-focus "jetbrains-idea" "idea" +bindsym $mad+j exec ~/.config/sway/app-focus "jitsi-meet" "jitsi-meet" +bindsym $mad+v exec ~/.config/sway/app-focus "freetube" "freetube" +bindsym $mad+s exec ~/.config/sway/app-focus "Spotify" "spotify" +bindsym $mad+d exec ~/.config/sway/app-focus "discord" "discord" +bindsym $mad+t exec ~/.config/sway/app-focus "foot" "foot" +bindsym $mad+b exec ~/.config/sway/app-focus "bruno" "bruno" + # audio bindings -bindsym $mad+v exec "$mixer" +#bindsym $mad+v exec "$mixer" bindsym XF86AudioRaiseVolume exec --no-startup-id "amixer -q sset Master 5%+ unmute" bindsym XF86AudioLowerVolume exec --no-startup-id "amixer -q sset Master 5%- unmute" bindsym XF86AudioMute exec --no-startup-id "amixer set Master toggle" @@ -49,7 +60,7 @@ bindsym XF86AudioPlay exec --no-startup-id "mocp --toggle-pause" bindsym XF86AudioNext exec --no-startup-id "mocp --next" # start search -bindsym $mad+f exec "nakedlocate" +#bindsym $mad+f exec "nakedlocate" # cleaner bindsym $mad+Backspace exec "dotcleaner" @@ -78,3 +89,4 @@ bindsym $mod+comma exec $ipc settings-toggle #bindsym --locked XF86AudioMute exec $ipc volume-mute #bindsym --locked XF86MonBrightnessUp exec $ipc brightness-up #bindsym --locked XF86MonBrightnessDown exec $ipc brightness-down + diff --git a/.config/sway/config.d/09-controls.conf b/.config/sway/config.d/09-controls.conf index 466de3a..3e42275 100644 --- a/.config/sway/config.d/09-controls.conf +++ b/.config/sway/config.d/09-controls.conf @@ -14,24 +14,24 @@ # Moving around: # Move your focus around vim like bindsym $mad+$left focus left - bindsym $mad+$down focus down - bindsym $mad+$up focus up + #bindsym $mad+$down focus down + #bindsym $mad+$up focus up bindsym $mad+$right focus right # Or use $mod+[up|down|left|right] bindsym $mad+Left focus left - bindsym $mad+Down focus down - bindsym $mad+Up focus up + #bindsym $mad+Down focus down + #bindsym $mad+Up focus up bindsym $mad+Right focus right # Move the focused window with the same, but add Shift bindsym $mod+Shift+$left move left - bindsym $mod+Shift+$down move down - bindsym $mod+Shift+$up move up + #bindsym $mod+Shift+$down move down + #bindsym $mod+Shift+$up move up bindsym $mod+Shift+$right move right # Ditto, with arrow keys bindsym $mod+Shift+Left move left - bindsym $mod+Shift+Down move down - bindsym $mod+Shift+Up move up + #bindsym $mod+Shift+Down move down + #bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right # window switcher Alt+Tab bindsym $mod+Tab workspace back_and_forth diff --git a/.config/sway/config.d/10-modes.conf b/.config/sway/config.d/10-modes.conf index 0095639..b18c781 100644 --- a/.config/sway/config.d/10-modes.conf +++ b/.config/sway/config.d/10-modes.conf @@ -1,42 +1,42 @@ # sway # modes # Resizing containers: -set $mode_resize "Resize(←↑↓→) Gaps(+/-)" -mode --pango_markup $mode_resize { - # resize windows vimlike - bindsym $left resize shrink width 10px - bindsym $down resize grow height 10px - bindsym $up resize shrink height 10px - bindsym $right resize grow width 10px - # with arrow keys - bindsym Left resize shrink width 10px - bindsym Down resize grow height 10px - bindsym Up resize shrink height 10px - bindsym Right resize grow width 10px - # resize window Gaps with +/- - bindsym minus gaps inner current minus 5px - bindsym plus gaps inner current plus 5px - # Return to default mode - bindsym Return mode "default" - bindsym Escape mode "default" -} -# launch resize mode (Alt+r) -bindsym $mod+r mode $mode_resize - -# Audio menu -set $mode_audio "Audio(↑/↓/m) Micro(+/-/n)" -mode --pango_markup $mode_audio { - # volume control - bindsym Up exec --no-startup-id "amixer -q sset Master 1%+ unmute" - bindsym Down exec --no-startup-id "amixer -q sset Master 1%- unmute" - bindsym m exec --no-startup-id "amixer set Master toggle" - # micro control - bindsym minus exec --no-startup-id "amixer -q sset Capture 1%- cap" - bindsym plus exec --no-startup-id "amixer -q sset Capture 1%+ cap" - bindsym n exec --no-startup-id "amixer set Capture toggle" - # Return to default mode - bindsym Return mode "default" - bindsym Escape mode "default" -} -# launch audio mode (Super+s) -bindsym $mad+s mode $mode_audio +#set $mode_resize "Resize(←↑↓→) Gaps(+/-)" +#mode --pango_markup $mode_resize { +# # resize windows vimlike +# bindsym $left resize shrink width 10px +# bindsym $down resize grow height 10px +# bindsym $up resize shrink height 10px +# bindsym $right resize grow width 10px +# # with arrow keys +# bindsym Left resize shrink width 10px +# bindsym Down resize grow height 10px +# bindsym Up resize shrink height 10px +# bindsym Right resize grow width 10px +# # resize window Gaps with +/- +# bindsym minus gaps inner current minus 5px +# bindsym plus gaps inner current plus 5px +# # Return to default mode +# bindsym Return mode "default" +# bindsym Escape mode "default" +#} +## launch resize mode (Alt+r) +#bindsym $mod+r mode $mode_resize +# +## Audio menu +#set $mode_audio "Audio(↑/↓/m) Micro(+/-/n)" +#mode --pango_markup $mode_audio { +# # volume control +# bindsym Up exec --no-startup-id "amixer -q sset Master 1%+ unmute" +# bindsym Down exec --no-startup-id "amixer -q sset Master 1%- unmute" +# bindsym m exec --no-startup-id "amixer set Master toggle" +# # micro control +# bindsym minus exec --no-startup-id "amixer -q sset Capture 1%- cap" +# bindsym plus exec --no-startup-id "amixer -q sset Capture 1%+ cap" +# bindsym n exec --no-startup-id "amixer set Capture toggle" +# # Return to default mode +# bindsym Return mode "default" +# bindsym Escape mode "default" +#} +## launch audio mode (Super+s) +#bindsym $mad+s mode $mode_audio