diff --git a/home/config/sway/default.nix b/home/config/sway/default.nix index f842f0d1..1c04bd5a 100644 --- a/home/config/sway/default.nix +++ b/home/config/sway/default.nix @@ -22,6 +22,7 @@ ./module/Keyd.nix ./module/Waybar.nix ./module/System.nix + ./module/Mouse.nix ] args; in { text = (util.trimTabs '' diff --git a/home/config/sway/module/Mouse.nix b/home/config/sway/module/Mouse.nix new file mode 100644 index 00000000..b846df23 --- /dev/null +++ b/home/config/sway/module/Mouse.nix @@ -0,0 +1,7 @@ +{ ... }: { + text = '' + bindsym --whole-window $mod+button2 kill + bindsym --whole-window $mod+button8 floating toggle + bindsym --whole-window $mod+button9 fullscreen + ''; +} diff --git a/home/config/sway/module/Navigation.nix b/home/config/sway/module/Navigation.nix index 3a94ba72..8eeb99e3 100644 --- a/home/config/sway/module/Navigation.nix +++ b/home/config/sway/module/Navigation.nix @@ -1,22 +1,16 @@ { ... }: { text = '' - # Navigation keys. - set $down s - set $left a - set $right d - set $up w - # Move focus. - bindsym $mod+$down focus down - bindsym $mod+$left focus left - bindsym $mod+$right focus right - bindsym $mod+$up focus up + bindsym --to-code $mod+a focus left + bindsym --to-code $mod+d focus right + bindsym --to-code $mod+s focus down + bindsym --to-code $mod+w focus up # Move the focused window. - bindsym $mod+Shift+$down move down - bindsym $mod+Shift+$left move left - bindsym $mod+Shift+$right move right - bindsym $mod+Shift+$up move up + bindsym --to-code $mod+Shift+a move left + bindsym --to-code $mod+Shift+d move right + bindsym --to-code $mod+Shift+s move down + bindsym --to-code $mod+Shift+w move up # Focus mouse following. focus_follows_mouse yes diff --git a/home/config/sway/module/Notification.nix b/home/config/sway/module/Notification.nix index 2f492bf8..64fb1b1a 100644 --- a/home/config/sway/module/Notification.nix +++ b/home/config/sway/module/Notification.nix @@ -1,9 +1,9 @@ { ... }: { text = '' # Show last notification. - bindsym $mod+n exec makoctl restore + bindsym --to-code $mod+n exec makoctl restore # Hide all notifications. - bindsym $mod+shift+N exec makoctl dismiss --all + bindsym --to-code $mod+shift+N exec makoctl dismiss --all ''; } diff --git a/home/config/sway/module/Resize.nix b/home/config/sway/module/Resize.nix index ded0997d..1758cc04 100644 --- a/home/config/sway/module/Resize.nix +++ b/home/config/sway/module/Resize.nix @@ -3,9 +3,9 @@ stepHorizontal = 10; in { text = '' - bindsym $mod+j resize grow height ${toString stepVertical}px - bindsym $mod+k resize shrink height ${toString stepVertical}px - bindsym $mod+h resize shrink width ${toString stepHorizontal}px - bindsym $mod+l resize grow width ${toString stepHorizontal}px + bindsym --to-code $mod+j resize grow height ${toString stepVertical}px + bindsym --to-code $mod+k resize shrink height ${toString stepVertical}px + bindsym --to-code $mod+h resize shrink width ${toString stepHorizontal}px + bindsym --to-code $mod+l resize grow width ${toString stepHorizontal}px ''; } diff --git a/home/config/sway/module/Screenshot.nix b/home/config/sway/module/Screenshot.nix index 7017e370..4aa75daa 100644 --- a/home/config/sway/module/Screenshot.nix +++ b/home/config/sway/module/Screenshot.nix @@ -1,9 +1,9 @@ { ... }: { text = '' # Fullscreen screenshot. - bindsym $mod+shift+v exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy -t image/png + bindsym --to-code $mod+shift+v exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy -t image/png # Select screenshot. - bindsym $mod+v exec grim -g "$(slurp -d)" - | wl-copy + bindsym --to-code $mod+v exec grim -g "$(slurp -d)" - | wl-copy ''; } diff --git a/home/config/sway/module/Session.nix b/home/config/sway/module/Session.nix index 7887217a..46a50097 100644 --- a/home/config/sway/module/Session.nix +++ b/home/config/sway/module/Session.nix @@ -2,7 +2,7 @@ lock = "swaylock -f -F -c 000000 -k --font \"${config.style.font.serif.name}\" --font-size ${toString config.style.font.size.desktop}"; in { text = '' - bindsym $mod+z exec '_twice 1 ${lock}' - bindsym $mod+Shift+Z exec _twice 1 bash -c '${lock}; systemctl suspend -i' + bindsym --to-code $mod+z exec '_twice 1 ${lock}' + bindsym --to-code $mod+Shift+Z exec _twice 1 bash -c '${lock}; systemctl suspend -i' ''; } diff --git a/home/config/sway/module/Sound.nix b/home/config/sway/module/Sound.nix index bd71777d..a1ade29a 100644 --- a/home/config/sway/module/Sound.nix +++ b/home/config/sway/module/Sound.nix @@ -3,17 +3,17 @@ step_music = config.setting.step.media; in { text = '' - bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +${toString step_volume}%' - bindsym XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -${toString step_volume}%' - bindsym XF86AudioMute exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle' + bindsym --to-code XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +${toString step_volume}%' + bindsym --to-code XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -${toString step_volume}%' + bindsym --to-code XF86AudioMute exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle' - bindsym XF86AudioPlay exec 'playerctl play-pause' - bindsym XF86AudioPause exec 'playerctl pause' - bindsym XF86AudioStop exec 'playerctl stop' - bindsym XF86AudioNext exec 'playerctl next' - bindsym XF86AudioPrev exec 'playerctl previous' - bindsym XF86Forward exec 'playerctl position ${toString step_music}+' - bindsym XF86Back exec 'playerctl position ${toString step_music}-' - bindsym XF86Eject exec 'swayscript sound_output_cycle' + bindsym --to-code XF86AudioPlay exec 'playerctl play-pause' + bindsym --to-code XF86AudioPause exec 'playerctl pause' + bindsym --to-code XF86AudioStop exec 'playerctl stop' + bindsym --to-code XF86AudioNext exec 'playerctl next' + bindsym --to-code XF86AudioPrev exec 'playerctl previous' + bindsym --to-code XF86Forward exec 'playerctl position ${toString step_music}+' + bindsym --to-code XF86Back exec 'playerctl position ${toString step_music}-' + bindsym --to-code XF86Eject exec 'swayscript sound_output_cycle' ''; } diff --git a/home/config/sway/module/System.nix b/home/config/sway/module/System.nix index fa54d92b..872e8099 100644 --- a/home/config/sway/module/System.nix +++ b/home/config/sway/module/System.nix @@ -2,13 +2,13 @@ mod = config.setting.sysctrl; in { text = '' - bindsym ${mod}+c exec 'systemctl reboot -i' - bindsym ${mod}+g exec 'swayscript gamingtoggle' - bindsym ${mod}+l exec 'powerlimit toggle' - bindsym ${mod}+m exec 'swayscript montoggle' - bindsym ${mod}+p exec 'powersave toggle' - bindsym ${mod}+v exec 'swayscript vpntoggle' - bindsym ${mod}+x exec 'systemctl poweroff -i' - bindsym ${mod}+z exec 'systemctl suspend -i' + bindsym --to-code ${mod}+c exec 'systemctl reboot -i' + bindsym --to-code ${mod}+g exec 'swayscript gamingtoggle' + bindsym --to-code ${mod}+l exec 'powerlimit toggle' + bindsym --to-code ${mod}+m exec 'swayscript montoggle' + bindsym --to-code ${mod}+p exec 'powersave toggle' + bindsym --to-code ${mod}+v exec 'swayscript vpntoggle' + bindsym --to-code ${mod}+x exec 'systemctl poweroff -i' + bindsym --to-code ${mod}+z exec 'systemctl suspend -i' ''; } diff --git a/home/config/sway/module/Terminal.nix b/home/config/sway/module/Terminal.nix index cdf22695..a3baf495 100644 --- a/home/config/sway/module/Terminal.nix +++ b/home/config/sway/module/Terminal.nix @@ -2,6 +2,6 @@ text = '' set $term ${config.setting.terminal.bin} - bindsym $mod+Escape exec $term -e bash -c "tmux new-session -A -s $USER; bash" + bindsym --to-code $mod+Escape exec $term -e bash -c "tmux new-session -A -s $USER; bash" ''; } diff --git a/home/config/sway/module/Tiling.nix b/home/config/sway/module/Tiling.nix index 4ffc5212..5aabfdba 100644 --- a/home/config/sway/module/Tiling.nix +++ b/home/config/sway/module/Tiling.nix @@ -1,23 +1,20 @@ { config, ... }: { text = '' # Toggle tiling. - bindsym $mod+shift+f floating toggle + bindsym --to-code $mod+shift+f floating toggle # Swap focus between the tiling area and the floating area - bindsym $mod+r focus mode_toggle - - # Move focus to the parent container - # bindsym $mod+a focus parent + bindsym --to-code $mod+r focus mode_toggle # Split directions. - bindsym $mod+backslash splith - bindsym $mod+minus splitv + bindsym --to-code $mod+backslash splith + bindsym --to-code $mod+minus splitv # Switch the current container between different layout styles. - bindsym $mod+Tab layout toggle split tabbed + bindsym --to-code $mod+Tab layout toggle split tabbed # Fullscreen. - bindsym $mod+f fullscreen + bindsym --to-code $mod+f fullscreen # Drag floating windows by holding down $mod and left mouse button. # Resize them with right mouse button + $mod. @@ -27,7 +24,7 @@ floating_modifier $mod normal # Kill focused window. - bindsym $mod+x kill + bindsym --to-code $mod+x kill # Add gaps. gaps inner ${toString config.style.window.gap} diff --git a/home/config/sway/module/Waybar.nix b/home/config/sway/module/Waybar.nix index a6034680..719b1c68 100644 --- a/home/config/sway/module/Waybar.nix +++ b/home/config/sway/module/Waybar.nix @@ -1,6 +1,6 @@ { ... }: { text = '' - bindsym $mod+shift+r exec 'pkill -SIGUSR1 waybar || waybar' + bindsym --to-code $mod+shift+r exec 'pkill -SIGUSR1 waybar || waybar' exec waybar exec nm-applet ''; diff --git a/home/config/sway/module/Workspace.nix b/home/config/sway/module/Workspace.nix index 59a5ad50..7e9930ab 100644 --- a/home/config/sway/module/Workspace.nix +++ b/home/config/sway/module/Workspace.nix @@ -1,37 +1,37 @@ { ... }: { text = '' # Switch to workspace. - bindsym $mod+1 workspace number 1 - bindsym $mod+2 workspace number 2 - bindsym $mod+3 workspace number 3 - bindsym $mod+4 workspace number 4 - bindsym $mod+5 workspace number 5 - bindsym $mod+6 workspace number 6 - bindsym $mod+7 workspace number 7 - bindsym $mod+8 workspace number 8 - bindsym $mod+9 workspace number 9 - bindsym $mod+0 workspace number 10 + bindsym --to-code $mod+1 workspace number 1 + bindsym --to-code $mod+2 workspace number 2 + bindsym --to-code $mod+3 workspace number 3 + bindsym --to-code $mod+4 workspace number 4 + bindsym --to-code $mod+5 workspace number 5 + bindsym --to-code $mod+6 workspace number 6 + bindsym --to-code $mod+7 workspace number 7 + bindsym --to-code $mod+8 workspace number 8 + bindsym --to-code $mod+9 workspace number 9 + bindsym --to-code $mod+0 workspace number 10 # Move focused container to workspace. - bindsym $mod+Shift+1 move container to workspace number 1 - bindsym $mod+Shift+2 move container to workspace number 2 - bindsym $mod+Shift+3 move container to workspace number 3 - bindsym $mod+Shift+4 move container to workspace number 4 - bindsym $mod+Shift+5 move container to workspace number 5 - bindsym $mod+Shift+6 move container to workspace number 6 - bindsym $mod+Shift+7 move container to workspace number 7 - bindsym $mod+Shift+8 move container to workspace number 8 - bindsym $mod+Shift+9 move container to workspace number 9 - bindsym $mod+Shift+0 move container to workspace number 10 + bindsym --to-code $mod+Shift+1 move container to workspace number 1 + bindsym --to-code $mod+Shift+2 move container to workspace number 2 + bindsym --to-code $mod+Shift+3 move container to workspace number 3 + bindsym --to-code $mod+Shift+4 move container to workspace number 4 + bindsym --to-code $mod+Shift+5 move container to workspace number 5 + bindsym --to-code $mod+Shift+6 move container to workspace number 6 + bindsym --to-code $mod+Shift+7 move container to workspace number 7 + bindsym --to-code $mod+Shift+8 move container to workspace number 8 + bindsym --to-code $mod+Shift+9 move container to workspace number 9 + bindsym --to-code $mod+Shift+0 move container to workspace number 10 # Note: workspaces can have any name you want, not just numbers. # We just use 1-10 as the default. # Switch left-right. - bindsym $mod+e workspace next - bindsym $mod+q workspace prev + bindsym --to-code $mod+e workspace next + bindsym --to-code $mod+q workspace prev # Move left-right. - bindsym $mod+Shift+e move container to workspace next - bindsym $mod+Shift+q move container to workspace prev + bindsym --to-code $mod+Shift+e move container to workspace next + bindsym --to-code $mod+Shift+q move container to workspace prev ''; }