sway.nix 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. { pkgs, config, lib, ... }:
  2. {
  3. # Wallpaper stuff
  4. #systemd.user.services.wallpaper = {
  5. # Service = { ExecStart = [ "%h/.local/bin/waywall wall" ]; };
  6. # Unit = { Description = "Wallpaper Service for Sway"; };
  7. # Install = { WantedBy = [ "sway-session.target" ]; };
  8. #};
  9. # Locker
  10. systemd.user.services.locker = {
  11. Unit = { Description = [ "Automatic Locker for Sway" ]; };
  12. Install = { WantedBy = [ "sway-session.target" ]; };
  13. Service = {
  14. ExecStart = [
  15. "${pkgs.swayidle}/bin/swayidle -w timeout 60 '~/.local/bin/waywall lock' before-sleep '~/.local/bin/waywall lock' timeout 75 '${pkgs.light}/bin/light -O; ${pkgs.light}/bin/light -S 0' resume '${pkgs.light}/bin/light -I' lock '~/.local/bin/waywall lock'"
  16. ];
  17. };
  18. };
  19. wayland.windowManager = {
  20. sway = {
  21. enable = true;
  22. config = {
  23. assigns = { "2: web" = [{ class = "^Google-chrome$"; }]; };
  24. focus = {
  25. followMouse = "always";
  26. newWindow = "smart";
  27. };
  28. modifier = "Mod4";
  29. defaultWorkspace = "workspace number 1";
  30. workspaceAutoBackAndForth = true;
  31. window = {
  32. hideEdgeBorders = "smart";
  33. border = 2;
  34. };
  35. gaps = {
  36. top = 1;
  37. bottom = 1;
  38. horizontal = 5;
  39. vertical = 5;
  40. inner = 5;
  41. outer = 5;
  42. left = 5;
  43. right = 5;
  44. smartBorders = "on";
  45. smartGaps = true;
  46. };
  47. keybindings =
  48. let modifier = config.wayland.windowManager.sway.config.modifier;
  49. in lib.mkOptionDefault {
  50. "${modifier}+Return" = "exec ${pkgs.alacritty}/bin/alacritty";
  51. "${modifier}+q" = "kill";
  52. "${modifier}+x" = "exec ~/.local/bin/waywall lock";
  53. "Mod1+w" = "exec ~/.local/bin/waywall wall";
  54. "Mod1+Shift+r" = "reload";
  55. "Mod1+Shift+q" = "exit";
  56. "Mod4+b" = "splith";
  57. "Mod4+v" = "splitv";
  58. "Mod4+s" = "layout stacking";
  59. "Mod4+w" = "layout tabbed";
  60. "Mod4+e" = "layout toggle split";
  61. "Mod4+f" = "fullscreen";
  62. "Mod4+Shift+space" = "floating toggle";
  63. "Mod4+space" = "focus mode_toggle";
  64. "Mod4+Shift+w" =
  65. "exec ${pkgs.google-chrome}/bin/google-chrome-stable";
  66. "Print" =
  67. "exec ${pkgs.wayshot}/bin/wayshot -f /tmp/foo.png; exec sleep 1; exec ${pkgs.wl-clipboard}/bin/wl-copy -t image/png < /tmp/foo.png"; # TODO: would like to change the program for screenshots
  68. "XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5";
  69. "XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5";
  70. "XF86AudioRaiseVolume" =
  71. "exec ${pkgs.pamixer}/bin/pamixer --allow-boost -i 5";
  72. "XF86AudioLowerVolume" =
  73. "exec ${pkgs.pamixer}/bin/pamixer --allow-boost -d 5";
  74. "XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute";
  75. "Mod4+Shift+i" = "move scratchpad";
  76. "Mod4+i" = "scratchpad show";
  77. };
  78. up = "k";
  79. down = "j";
  80. right = "l";
  81. left = "h";
  82. #terminal = "alacritty";
  83. floating = {
  84. titlebar = false;
  85. criteria =
  86. [ { class = "feh"; } { title = "Mpv"; } { class = "meh"; } ];
  87. modifier = "Mod4";
  88. };
  89. fonts = {
  90. names = [ "DejaVu Sans Mono" "FontAwesome5Free" ];
  91. style = "Bold Semi-Condensed";
  92. size = 11.0;
  93. };
  94. modes = {
  95. resize = {
  96. h = "resize shrink width 10 px";
  97. j = "resize grow height 10 px";
  98. k = "resize shrink height 10 px";
  99. l = "resize grow width 10 px";
  100. Escape = "mode default";
  101. Return = "mode default";
  102. };
  103. };
  104. startup = [{
  105. command = "systemctl --user restart waybar";
  106. always = true;
  107. }];
  108. menu = "${pkgs.wofi}/bin/wofi --insensitive --show drun,run";
  109. bars = [ ];
  110. output = {
  111. eDP-1 = {
  112. bg = "~/mus/album_arts/nazia/nazia.jpg fill";
  113. resolution = "1920x1080";
  114. };
  115. };
  116. };
  117. };
  118. };
  119. }