Commit adc77dfa346a

Vincent Demeester <vincent@sbr.pm>
2024-01-12 09:41:06
wayland: split sway and hyprland configuration
and make wakasu hyprland only. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 0ff9ab2
Changed files (5)
systems
hosts
modules
users
systems/hosts/wakasu.nix
@@ -95,7 +95,7 @@ in
       bluetooth.enable = true;
     };
     desktop = {
-      wayland.sway.enable = true;
+      # wayland.sway.enable = true;
       wayland.hyprland.enable = true;
     };
     dev = {
systems/modules/desktop/hyprland.nix
@@ -11,12 +11,23 @@ in
     };
   };
   config = mkIf cfg.enable {
+    # Enable wayland desktop modules if not already
+    modules.desktop.wayland.enable = true;
+
+    # Enable pipewire
+    modules.hardware.audio = {
+      enable = true;
+      pipewire.enable = true;
+    };
+
+    services.blueman.enable = config.modules.hardware.bluetooth.enable;
+
     programs.hyprland.enable = true;
 
     xdg = {
       portal = {
         enable = true;
-        wlr.enable = true;
+        # wlr.enable = true;
         extraPortals = with pkgs; [
           # xdg-desktop-portal-wlr
           # xdg-desktop-portal-gtk
@@ -25,5 +36,16 @@ in
         gtkUsePortal = true;
       };
     };
+    # Allow swaylock to unlock the computer for us
+    security.pam.services.swaylock = {
+      text = "auth include login";
+    };
+
+    # FIXME are those needed
+    programs.dconf.enable = true;
+    services.dbus = {
+      enable = true;
+      packages = [ pkgs.dconf pkgs.gcr ];
+    };
   };
 }
users/vincent/desktop/hyprland.nix
@@ -1,10 +1,6 @@
 { config, lib, pkgs, ... }:
 
 {
-  home.packages = with pkgs; [
-    qogir-icon-theme
-    cliphist
-  ];
   xdg.configFile."hypr/hyprpaper.conf".text = ''
     preload = /home/vincent/desktop/pictures/lockscreen
     wallpaper = , /home/vincent/desktop/pictures/lockscreen
@@ -30,19 +26,41 @@
         "wl-paste -p --watch cliphist store"
         "${pkgs.hyprpaper}/bin/hyprpaper"
         "${pkgs.networkmanagerapplet}/bin/nm-applet --indicator"
-        # kanshi ? (systemctl --user restart kanshi)
+        "systemctl --user restart kanshi"
       ];
 
+      general = {
+        gaps_in = 6;
+        gaps_out = 6;
+        border_size = 2;
+        "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
+        "col.inactive_border" = "rgba(595959aa)";
+        layout = "master";
+        allow_tearing = false;
+      };
+
+      decoration = {
+        rounding = 2;
+
+        blur = {
+          enabled = true;
+          size = 3;
+          passes = 1;
+        };
+
+        drop_shadow = "yes";
+        shadow_range = 4;
+        shadow_render_power = 3;
+        "col.shadow" = "rgba(1a1a1aee)";
+      };
+
+      master = {
+        new_is_master = true;
+        orientation = "right";
+      };
+
       animations = {
-        enabled = "yes";
-        bezier = "myBezier, 0.05, 0.9, 0.1, 1.05";
-        animation = [
-          "windows, 1, 5, myBezier"
-          "windowsOut, 1, 7, default, popin 80%"
-          "border, 1, 10, default"
-          "fade, 1, 7, default"
-          "workspaces, 1, 6, default"
-        ];
+        enabled = "no";
       };
 
       monitor = [
@@ -64,6 +82,11 @@
         follow_mouse = 1;
       };
 
+      # layerrule = [
+      #   "blur,notifications"
+      #   "blur,wofi"
+      # ];
+
       "$mod" = "SUPER";
       bind = [
         "$mod, Return, exec, kitty"
@@ -149,11 +172,21 @@
         ", XF86AudioPrev, exec, playerctl previous"
         ", Cancel, exec, playerctl previous"
 
+        ", XF86MonBrightnessUp, exec, ${pkgs.brightnessctl}/bin/brightnessctl set 10%+"
+        ", XF86MonBrightnessDown, exec, ${pkgs.brightnessctl}/bin/brightnessctl set 10%-"
+        "Shift, XF86MonBrightnessUp, exec, ${pkgs.brightnessctl}/bin/brightnessctl set 1%+"
+        "Shift, XF86MonBrightnessDown, exec, ${pkgs.brightnessctl}/bin/brightnessctl set 1%-"
+
         "$mod, F10, exec, ${pkgs.my.scripts}/bin/shot %d"
         "$mod SHIFT, F10, exec, ${pkgs.my.scripts}/bin/shotf %d"
 
         "$mod, F9, exec, ${pkgs.mako}/bin/makoctl mode -s do-not-disturb"
         "$mod SHIFT, F9, exec, ${pkgs.mako}/bin/makoctl mode -s default"
+
+        "$mod, G, togglegroup"
+        "$mod, tab, changegroupactive"
+
+        "$mod, b, exec, pkill --signal=SIGUSR1 waybar"
       ];
       bindm = [
         "$mod, mouse:273, resizewindow"
users/vincent/desktop/sway.nix
@@ -242,173 +242,9 @@ in
         bindsym ${mod}+Shift+F9 exec ${pkgs.mako}/bin/makoctl mode -s default
       '';
   };
-  programs = {
-    waybar = {
-      enable = true;
-      # systemd.enable = true;
-      style = ./waybar.css;
-      settings = [{
-        layer = "bottom";
-        position = "bottom";
-        mode = "hide";
-        modules-left = [ "sway/workspaces" "hyprland/workspaces" "sway/mode" "custom/media" ];
-        modules-center = [ "clock" "custom/notification" ];
-        modules-right = [ "temperature" "pulseaudio" "backlight" "battery#bat0" "tray" ];
-        ipc = true;
-        id = "mainBar";
-        "clock" = {
-          "interval" = 30;
-          "format" = "{:<b>%H:%M</b>}";
-          "tooltip-format" = "<big><b>{:%Y %B}</b></big>\n{calendar}";
-          "format-alt" = "{:%A %d %B %Y}";
-        };
-        "battery#bat0" = {
-          "bat" = "BAT0";
-          "states" = {
-            "warning" = 30;
-            "critical" = 15;
-          };
-          "format" = "{icon} {capacity}";
-          "format-charging" = " {capacity}";
-          "format-plugged" = "";
-          "format-alt" = "{icon} {time}";
-          "format-full" = "";
-          "format-icons" = [ "" "" "" "" "" ];
-        };
-        "custom/notification" = {
-          "tooltip" = false;
-          "format" = "{icon} ";
-          "format-icons" = {
-            "notification" = "<span foreground='red'></span>";
-            "none" = "";
-            "dnd-notification" = "<sup></sup>";
-            "dnd-none" = "";
-          };
-          "return-type" = "json";
-          # "exec-if" = "which swaync-client";
-          "exec" = "swaync-client -swb";
-          "on-click" = "swaync-client -t -sw";
-          "on-click-right" = "swaync-client -d -sw";
-          "escape" = true;
-        };
-        "pulseaudio" = {
-          "format" = "{icon} {volume:2}% ";
-          "format-bluetooth" = "{icon}  {volume}% ";
-          "format-muted" = " ";
-          "format-icons" = {
-            "phone" = [
-              " "
-              " "
-              " "
-              " "
-            ];
-            "default" = [
-              ""
-              ""
-              ""
-            ];
-          };
-          "scroll-step" = 10;
-          "on-click-right" = "${pkgs.pavucontrol}/bin/pavucontrol";
-          "on-click" = "${pkgs.pamixer}/bin/pamixer -t";
-        };
-        "backlight" = {
-          "format" = "{icon} {percent}% ";
-          "format-icons" = [
-            ""
-            ""
-          ];
-        };
-      }];
-    };
-    mako = {
-      enable = true;
-      font = "Ubuntu Mono 12";
-      defaultTimeout = 5000; # 5s timeout
-      groupBy = "app-name,summary";
-      extraConfig = ''
-        on-button-left=dismiss
-        on-button-middle=invoke-default-action
-        on-button-right=dismiss
-        
-        [mode=do-not-disturb]
-        invisible=1
-      '';
-    };
-    kitty = {
-      enable = true;
-      settings = {
-        term = "xterm-256color";
-        close_on_child_death = "yes";
-        font_family = "Ubuntu Mono";
-      };
-      theme = "Tango Light";
-    };
-  };
-  services = {
-    blueman-applet.enable = nixosConfig.modules.hardware.bluetooth.enable;
-    pasystray.enable = nixosConfig.modules.hardware.audio.enable;
-    udiskie.enable = true;
-    # network-manager-applet.enable = true;
-    gammastep = {
-      enable = true;
-      provider = "geoclue2";
-      # longitude = "2.333333";
-      # latitude = "48.866667";
-    };
-    kanshi = {
-      enable = true;
-      profiles = {
-        "home-undocked" = {
-          outputs = [
-            # Output eDP-1 'AU Optronics 0xD291 Unknown'
-            { criteria = "eDP-1"; status = "enable"; position = "0,0"; mode = "1920x1200"; scale = 1.0; }
-          ];
-        };
-        "home-docked" = {
-          outputs = [
-            # Old: Output eDP-1 'AU Optronics 0xD291 Unknown'
-            # Output eDP-1 'Unknown 0xD291 Unknown'
-            # Output DP-5 'LG Electronics LG ULTRAWIDE 0x0005D10C' (focused)
-            # { criteria = "LG Electronics LG ULTRAWIDE 0x0000D50C"; status = "enable"; position = "0,0"; mode = "3440x1440"; scale = 1.0; }
-            { criteria = "DP-5"; status = "enable"; position = "0,0"; mode = "3440x1440"; scale = 1.0; }
-            # Use it as a "shareable" screen when needed
-            { criteria = "eDP-1"; status = "enable"; position = "1460,1440"; mode = "1920x1200"; scale = 1.0; }
-          ];
-        };
-      };
-    };
-    swayidle = {
-      enable = true;
-      events = [
-        { event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock --daemonize -i $HOME/desktop/pictures/lockscreen"; }
-        { event = "lock"; command = "${pkgs.swaylock}/bin/swaylock --daemonize -i $HOME/desktop/pictures/lockscreen"; }
-      ];
-      timeouts = [
-        { timeout = 600; command = "${pkgs.swaylock}/bin/swaylock --daemonize -i $HOME/desktop/pictures/lockscreen"; }
-        {
-          timeout = 1200;
-          command = ''${pkgs.sway}/bin/swaymsg "output * dpms off"'';
-          resumeCommand = ''${pkgs.sway}/bin/swaymsg "output * dpms on"'';
-        }
-      ];
-    };
-  };
   home.packages = with pkgs; [
-    swaylock
-    swayidle
     swaybg
-    wf-recorder
-    wl-clipboard
-    wtype
-    mako
     swaynotificationcenter
-    wofi
-    waybar
-    slurp
-    grim
-    gnome.zenity
-    clipman
     # terminals
     # FIXME move this away, they work on both Xorg and Wayland/Sway
     alacritty
users/vincent/desktop/wayland.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, pkgs, nixosConfig, ... }:
 
 {
   home.pointerCursor = {
@@ -8,4 +8,173 @@
     name = "Qogir";
     size = 24;
   };
+
+  programs = {
+    waybar = {
+      enable = true;
+      # systemd.enable = true;
+      style = ./waybar.css;
+      settings = [{
+        layer = "bottom";
+        position = "bottom";
+        mode = "hide";
+        modules-left = [ "sway/workspaces" "hyprland/workspaces" "sway/mode" "custom/media" ];
+        modules-center = [ "clock" "custom/notification" ];
+        modules-right = [ "temperature" "pulseaudio" "backlight" "battery#bat0" "tray" ];
+        ipc = true;
+        id = "mainBar";
+        "clock" = {
+          "interval" = 30;
+          "format" = "{:<b>%H:%M</b>}";
+          "tooltip-format" = "<big><b>{:%Y %B}</b></big>\n{calendar}";
+          "format-alt" = "{:%A %d %B %Y}";
+        };
+        "battery#bat0" = {
+          "bat" = "BAT0";
+          "states" = {
+            "warning" = 30;
+            "critical" = 15;
+          };
+          "format" = "{icon} {capacity}";
+          "format-charging" = " {capacity}";
+          "format-plugged" = "";
+          "format-alt" = "{icon} {time}";
+          "format-full" = "";
+          "format-icons" = [ "" "" "" "" "" ];
+        };
+        "custom/notification" = {
+          "tooltip" = false;
+          "format" = "{icon} ";
+          "format-icons" = {
+            "notification" = "<span foreground='red'></span>";
+            "none" = "";
+            "dnd-notification" = "<sup></sup>";
+            "dnd-none" = "";
+          };
+          "return-type" = "json";
+          # "exec-if" = "which swaync-client";
+          "exec" = "swaync-client -swb";
+          "on-click" = "swaync-client -t -sw";
+          "on-click-right" = "swaync-client -d -sw";
+          "escape" = true;
+        };
+        "pulseaudio" = {
+          "format" = "{icon} {volume:2}% ";
+          "format-bluetooth" = "{icon}  {volume}% ";
+          "format-muted" = " ";
+          "format-icons" = {
+            "phone" = [
+              " "
+              " "
+              " "
+              " "
+            ];
+            "default" = [
+              ""
+              ""
+              ""
+            ];
+          };
+          "scroll-step" = 10;
+          "on-click-right" = "${pkgs.pavucontrol}/bin/pavucontrol";
+          "on-click" = "${pkgs.pamixer}/bin/pamixer -t";
+        };
+        "backlight" = {
+          "format" = "{icon} {percent}% ";
+          "format-icons" = [
+            ""
+            ""
+          ];
+        };
+      }];
+    };
+    mako = {
+      enable = true;
+      font = "Ubuntu Mono 12";
+      defaultTimeout = 5000; # 5s timeout
+      groupBy = "app-name,summary";
+      extraConfig = ''
+        on-button-left=dismiss
+        on-button-middle=invoke-default-action
+        on-button-right=dismiss
+        
+        [mode=do-not-disturb]
+        invisible=1
+      '';
+    };
+    kitty = {
+      enable = true;
+      settings = {
+        term = "xterm-256color";
+        close_on_child_death = "yes";
+        font_family = "Ubuntu Mono";
+      };
+      theme = "Tango Light";
+    };
+  };
+  services = {
+    blueman-applet.enable = nixosConfig.modules.hardware.bluetooth.enable;
+    pasystray.enable = nixosConfig.modules.hardware.audio.enable;
+    udiskie.enable = true;
+    # network-manager-applet.enable = true;
+    gammastep = {
+      enable = true;
+      provider = "geoclue2";
+      # longitude = "2.333333";
+      # latitude = "48.866667";
+    };
+    kanshi = {
+      enable = true;
+      profiles = {
+        "home-undocked" = {
+          outputs = [
+            # Output eDP-1 'AU Optronics 0xD291 Unknown'
+            { criteria = "eDP-1"; status = "enable"; position = "0,0"; mode = "1920x1200"; scale = 1.0; }
+          ];
+        };
+        "home-docked" = {
+          outputs = [
+            # Old: Output eDP-1 'AU Optronics 0xD291 Unknown'
+            # Output eDP-1 'Unknown 0xD291 Unknown'
+            # Output DP-5 'LG Electronics LG ULTRAWIDE 0x0005D10C' (focused)
+            # { criteria = "LG Electronics LG ULTRAWIDE 0x0000D50C"; status = "enable"; position = "0,0"; mode = "3440x1440"; scale = 1.0; }
+            { criteria = "DP-5"; status = "enable"; position = "0,0"; mode = "3440x1440"; scale = 1.0; }
+            # Use it as a "shareable" screen when needed
+            { criteria = "eDP-1"; status = "enable"; position = "1460,1440"; mode = "1920x1200"; scale = 1.0; }
+          ];
+        };
+      };
+    };
+    swayidle = {
+      enable = true;
+      events = [
+        { event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock --daemonize -i $HOME/desktop/pictures/lockscreen"; }
+        { event = "lock"; command = "${pkgs.swaylock}/bin/swaylock --daemonize -i $HOME/desktop/pictures/lockscreen"; }
+      ];
+      timeouts = [
+        { timeout = 600; command = "${pkgs.swaylock}/bin/swaylock --daemonize -i $HOME/desktop/pictures/lockscreen"; }
+        {
+          timeout = 1200;
+          command = ''${pkgs.sway}/bin/swaymsg "output * dpms off"'';
+          resumeCommand = ''${pkgs.sway}/bin/swaymsg "output * dpms on"'';
+        }
+      ];
+    };
+  };
+  home.packages = with pkgs; [
+    swaylock
+    swayidle
+    wf-recorder
+    wl-clipboard
+    wtype
+    mako
+    wofi
+    waybar
+    slurp
+    grim
+    gnome.zenity
+    clipman
+    qogir-icon-theme
+    cliphist
+  ];
 }