sway.nix 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. { config, pkgs, lib, ... }:
  2. let
  3. left = "j";
  4. up = "k";
  5. down = "l";
  6. right = "oslash";
  7. mod = "Mod1";
  8. super = "Super";
  9. in
  10. {
  11. wayland.windowManager.sway = {
  12. enable = true;
  13. checkConfig = true;
  14. config = {
  15. bars = [
  16. {
  17. command = "swaybar_command waybar";
  18. }
  19. ];
  20. modes = {
  21. resize = {
  22. # Letters
  23. ${left} = "resize shrink width 10 px or 10 ppt";
  24. ${up} = "resize grow height 10 px or 10 ppt";
  25. ${down} = "resize shrink height 10 px or 10 ppt";
  26. ${right} = "resize grow width 10 px or 10 ppt";
  27. # Arrow keys
  28. "Left" = "resize shrink width 10 px or 10 ppt";
  29. "Down" = "resize grow height 10 px or 10 ppt";
  30. "Up" = "resize shrink height 10 px or 10 ppt";
  31. "Right" = "resize grow width 10 px or 10 ppt";
  32. # Exit mode
  33. "Escape" = "mode default";
  34. "Return" = "mode default";
  35. };
  36. passthrough = { # Passthrough mode, disables all sway keybinds to let other apps use them, eg. use sway mod in other apps.
  37. "${mod}+c" = "mode default";
  38. };
  39. futhark = {
  40. "f" = "exec wtype ᚠ";
  41. "u" = "exec wtype ᚢ";
  42. "q" = "exec wtype ᚦ";
  43. "a" = "exec wtype ᚨ";
  44. "r" = "exec wtype ᚱ";
  45. "k" = "exec wtype ᚲ";
  46. "x" = "exec wtype ᚷ";
  47. "v" = "exec wtype ᚹ";
  48. "h" = "exec wtype ᚺ";
  49. "n" = "exec wtype ᚾ";
  50. "i" = "exec wtype ᛁ";
  51. "j" = "exec wtype ᛃ";
  52. "ae" = "exec wtype ᛇ";
  53. "p" = "exec wtype ᛈ";
  54. "z" = "exec wtype ᛉ";
  55. "s" = "exec wtype ᛊ";
  56. "t" = "exec wtype ᛏ";
  57. "b" = "exec wtype ᛒ";
  58. "e" = "exec wtype ᛖ";
  59. "m" = "exec wtype ᛗ";
  60. "l" = "exec wtype ᛚ";
  61. "g" = "exec wtype ᛝ";
  62. "d" = "exec wtype ᛞ";
  63. "o" = "exec wtype ᛟ";
  64. "Escape" = "mode default";
  65. };
  66. };
  67. keybindings = {
  68. "${mod}+Shift+r" = "reload";
  69. "${mod}+Shift+q" = "kill";
  70. "${mod}+d" = "exec wofi";
  71. "${mod}+Return" = "exec alacritty";
  72. "${mod}+Shift+Return" = "exec alacritty -e bash -c 'moose; exec bash'";
  73. "${super}+l" = "exec swaylock";
  74. "${mod}+r" = "mode \"resize\"";
  75. "${mod}+c" = "mode \"passthrough\"";
  76. "${mod}+x" = "mode \"futhark\"";
  77. "${mod}+Shift+e" = "exec /home/johron/.config/rofi/powermenu/type-1/powermenu.sh";
  78. "${mod}+h" = "split h";
  79. "${mod}+v" = "split v";
  80. "${mod}+f" = "fullscreen toggle";
  81. "${mod}+s" = "layout stacking";
  82. "${mod}+t" = "layout tabbed";
  83. "${mod}+e" = "layout toggle split";
  84. "${mod}+Shift+space" = "floating toggle";
  85. "${mod}+space" = "focus mode_toggle";
  86. "${mod}+a" = "focus parent";
  87. # Focus movement
  88. "${mod}+${left}" = "focus left";
  89. "${mod}+${down}" = "focus down";
  90. "${mod}+${up}" = "focus up";
  91. "${mod}+${right}" = "focus right";
  92. # Focus movement (arrow keys)
  93. "${mod}+Left" = "focus left";
  94. "${mod}+Down" = "focus down";
  95. "${mod}+Up" = "focus up";
  96. "${mod}+Right" = "focus right";
  97. # Move windows
  98. "${mod}+Shift+${left}" = "move left";
  99. "${mod}+Shift+${down}" = "move down";
  100. "${mod}+Shift+${up}" = "move up";
  101. "${mod}+Shift+${right}" = "move right";
  102. # Move windows (arrow keys)
  103. "${mod}+Shift+Left" = "move left";
  104. "${mod}+Shift+Down" = "move down";
  105. "${mod}+Shift+Up" = "move up";
  106. "${mod}+Shift+Right" = "move right";
  107. # Switch to workspace
  108. "${mod}+1" = "workspace number 1";
  109. "${mod}+2" = "workspace number 2";
  110. "${mod}+3" = "workspace number 3";
  111. "${mod}+4" = "workspace number 4";
  112. "${mod}+5" = "workspace number 5";
  113. "${mod}+6" = "workspace number 6";
  114. "${mod}+7" = "workspace number 7";
  115. "${mod}+8" = "workspace number 8";
  116. "${mod}+9" = "workspace number 9";
  117. "${mod}+0" = "workspace number 10";
  118. ## Switch to secondary workspace
  119. "${super}+1" = "workspace number 11";
  120. "${super}+2" = "workspace number 12";
  121. "${super}+3" = "workspace number 13";
  122. "${super}+4" = "workspace number 14";
  123. "${super}+5" = "workspace number 15";
  124. "${super}+6" = "workspace number 16";
  125. "${super}+7" = "workspace number 17";
  126. "${super}+8" = "workspace number 18";
  127. "${super}+9" = "workspace number 19";
  128. "${super}+0" = "workspace number 20";
  129. # Move to workspace
  130. "${mod}+Shift+1" = "move container to workspace number 1";
  131. "${mod}+Shift+2" = "move container to workspace number 2";
  132. "${mod}+Shift+3" = "move container to workspace number 3";
  133. "${mod}+Shift+4" = "move container to workspace number 4";
  134. "${mod}+Shift+5" = "move container to workspace number 5";
  135. "${mod}+Shift+6" = "move container to workspace number 6";
  136. "${mod}+Shift+7" = "move container to workspace number 7";
  137. "${mod}+Shift+8" = "move container to workspace number 8";
  138. "${mod}+Shift+9" = "move container to workspace number 9";
  139. "${mod}+Shift+0" = "move container to workspace number 10";
  140. ## Move to secondary workspace
  141. "${super}+Shift+1" = "move container to workspace number 11";
  142. "${super}+Shift+2" = "move container to workspace number 12";
  143. "${super}+Shift+3" = "move container to workspace number 13";
  144. "${super}+Shift+4" = "move container to workspace number 14";
  145. "${super}+Shift+5" = "move container to workspace number 15";
  146. "${super}+Shift+6" = "move container to workspace number 16";
  147. "${super}+Shift+7" = "move container to workspace number 17";
  148. "${super}+Shift+8" = "move container to workspace number 18";
  149. "${super}+Shift+9" = "move container to workspace number 19";
  150. "${super}+Shift+0" = "move container to workspace number 20";
  151. # Multimedia
  152. XF86AudioMute = "exec wpctl set-mute @DEFAULT_SINK@ toggle";
  153. XF86AudioPlay = "exec playerctl play-pause";
  154. XF86AudioPause = "exec playerctl pause";
  155. XF86AudioNext = "exec playerctl next";
  156. XF86AudioPrev = "exec playerctl previous";
  157. XF86AudioRaiseVolume = "exec wpctl set-volume @DEFAULT_SINK@ 5%+";
  158. XF86AudioLowerVolume = "exec wpctl set-volume @DEFAULT_SINK@ 5%-";
  159. # Applications
  160. "${super}+q" = "exec firefox";
  161. "${super}+e" = "exec dolphin";
  162. "${super}+s" = "exec spotify";
  163. "${super}+d" = "exec discord";
  164. "${super}+v" = "exec cliphist list | wofi --dmenu | cliphist decode | wl-copy";
  165. "${super}+Shift+s" = ''exec $HOME/Scripts/ss.sh'';
  166. "${super}+Shift+c" = "exec hyprpicker --autocopy";
  167. # Scripts
  168. "${mod}+Control+a" = "exec $HOME/.config/waybar/mic-mute.sh";
  169. "${mod}+Control+s" = "exec $HOME/.config/waybar/output-mute.sh";
  170. };
  171. window.commands = [
  172. { command = "floating enable"; criteria.class = "Spotify"; }
  173. #{ command = "floating enable"; criteria.class = "steam"; }
  174. ];
  175. input = {
  176. "*" = {
  177. xkb_layout = "no";
  178. #xkb_variant = "cole";
  179. };
  180. "type:touchpad" = {
  181. tap = "enabled";
  182. click_method = "clickfinger";
  183. };
  184. };
  185. colors = {
  186. focused = {
  187. border = "#0A0101";
  188. background = "#140202";
  189. text = "#ffffff";
  190. indicator = "#410303";
  191. childBorder = "#140202";
  192. };
  193. unfocused = {
  194. border = "#333333";
  195. background = "#222222";
  196. text = "#888888";
  197. indicator = "#292929";
  198. childBorder = "#222222";
  199. };
  200. focusedInactive = {
  201. border = "#333333";
  202. background = "#3b3b3b";
  203. text = "#888888";
  204. indicator = "#292929";
  205. childBorder = "#222222";
  206. };
  207. };
  208. };
  209. extraConfig = ''
  210. exec wl-paste --watch cliphist store
  211. seat seat0 xcursor_theme Notwaita-Black 20
  212. ## Bind Alt+Shift+e to show a Swaynag exit confirmation
  213. #bindsym Mod1+Shift+e exec swaynag -t warning \
  214. # -m "Are you sure you want to exit Sway?" \
  215. # -b "Exit" "swaymsg exit" \
  216. # -b "Reboot" "reboot"
  217. exec swaybg -i "$HOME/.config/sway/bg/reef-2.png" -m fill
  218. input * xkb_options compose:rctrl
  219. exec_always {
  220. systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
  221. lxqt-policykit-agent
  222. swayidle \
  223. timeout 600 'swaylock -f' \
  224. timeout 1200 'systemctl suspend' \
  225. before-sleep 'swaylock -f'
  226. }
  227. ''
  228. + config.custom.swayExtras.displays;
  229. };
  230. }