From 25c9a2a3585bccd443f20e61875a5620c08ff75b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Sun, 16 Jun 2024 15:49:52 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20(home)=20nixify=20hyprland=20con?= =?UTF-8?q?fig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flake.lock | 18 +-- flake.nix | 2 +- home/desktop/default.nix | 2 +- home/desktop/gtk.nix | 5 +- home/desktop/hyprland.nix | 166 ++++++++++++++++++++++++ home/desktop/hyprland/default.nix | 20 --- home/desktop/hyprland/hyprland.conf | 151 --------------------- home/desktop/swayidle.nix | 5 +- home/packages.nix | 7 - hosts/aurum/system/hardware/default.nix | 9 +- 10 files changed, 185 insertions(+), 200 deletions(-) create mode 100644 home/desktop/hyprland.nix delete mode 100644 home/desktop/hyprland/default.nix delete mode 100644 home/desktop/hyprland/hyprland.conf diff --git a/flake.lock b/flake.lock index 82e21c0..71aab63 100644 --- a/flake.lock +++ b/flake.lock @@ -81,15 +81,15 @@ }, "catppuccin": { "locked": { - "lastModified": 1718339789, - "narHash": "sha256-Q3fgY7huFE+uaw7BNsAl1x+FvjDAi3EDWPnlALJt5pM=", - "owner": "catppuccin", + "lastModified": 1718475615, + "narHash": "sha256-sFrx1xlce6uaCLVtrTm4PH4PESXBpCd9vTqjXKhFZCg=", + "owner": "Laurent2916", "repo": "nix", - "rev": "73e06d5bd7ed34bdd0168030893ef8364fdc1d4a", + "rev": "e632faeda1ca013e983e45f78cff13a36ca64b1e", "type": "github" }, "original": { - "owner": "catppuccin", + "owner": "Laurent2916", "repo": "nix", "type": "github" } @@ -352,11 +352,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1718461895, - "narHash": "sha256-qlNHD6ScCIQ6lzTyy9cDj5h+jZOC55FM3JHp8p3qMQ0=", + "lastModified": 1718468441, + "narHash": "sha256-yLoQC4IaaM3xijxoGMkyPgwKKr3xYLdToA7j3zNRn7A=", "ref": "refs/heads/main", - "rev": "fb82f6bcd7d829a3ab2d2cb7d9a27f3837abfb80", - "revCount": 4832, + "rev": "91fe58f8f278d126852877eadc87c50ca7b9b78d", + "revCount": 4836, "submodules": true, "type": "git", "url": "https://github.com/hyprwm/Hyprland" diff --git a/flake.nix b/flake.nix index 99de079..0ce2d87 100644 --- a/flake.nix +++ b/flake.nix @@ -65,7 +65,7 @@ flake = false; }; catppuccin = { - url = "github:catppuccin/nix"; + url = "github:Laurent2916/nix"; }; # cesium nginx sites diff --git a/home/desktop/default.nix b/home/desktop/default.nix index c7e5580..4e6acb2 100644 --- a/home/desktop/default.nix +++ b/home/desktop/default.nix @@ -1,9 +1,9 @@ {...}: { imports = [ ./eww - ./hyprland ./fuzzel.nix ./gtk.nix + ./hyprland.nix ./kanshi.nix ./mako.nix ./swayidle.nix diff --git a/home/desktop/gtk.nix b/home/desktop/gtk.nix index 7e2da5b..f4e5bc7 100644 --- a/home/desktop/gtk.nix +++ b/home/desktop/gtk.nix @@ -12,7 +12,10 @@ enable = true; size = "compact"; tweaks = ["rimless" "normal"]; - cursor.accent = "dark"; + cursor = { + enable = true; + accent = "dark"; + }; }; }; } diff --git a/home/desktop/hyprland.nix b/home/desktop/hyprland.nix new file mode 100644 index 0000000..6e2dcef --- /dev/null +++ b/home/desktop/hyprland.nix @@ -0,0 +1,166 @@ +{ + inputs, + config, + pkgs, + lib, + ... +}: let + hyprland = inputs.hyprland.packages."${pkgs.system}".hyprland; + cursor = config.gtk.catppuccin.cursor; +in { + wayland.windowManager.hyprland = { + enable = true; + + settings = { + # https://wiki.hyprland.org/Configuring/Variables/#variable-types + "$mod" = "SUPER"; + + # https://wiki.hyprland.org/Configuring/Keywords/#executing + exec-once = [ + "env XDG_CACHE_HOME=`${pkgs.coreutils}/bin/mktemp -d --suffix '-eww'` ${lib.getExe pkgs.eww} open bar" + "${lib.getExe pkgs.swaybg} -i ${inputs.wallpaper}" + "${lib.getExe pkgs.mako}" + "${lib.getExe pkgs.thunderbird}" + "${pkgs.wl-clipboard}/bin/wl-paste --watch ${lib.getExe pkgs.cliphist} store" + "${pkgs.gnome.gnome-keyring}/bin/gnome-keyring-daemon --start --components=secrets" + "${hyprland}/bin/hyprctl setcursor catppuccin-${cursor.flavor}-${cursor.accent}-cursors 24" # FIXME: shouldn't be necessary + ]; + + # https://wiki.hyprland.org/Configuring/Monitors/ + monitor = [ + "DP-3,1920x1080@120,0x0,1" + "eDP-1,1920x1200,0x1080,1" + ]; + + # https://wiki.hyprland.org/Configuring/Variables/#general + general = { + gaps_in = 2; + gaps_out = 4; + border_size = 0; + "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; + "col.inactive_border" = "rgba(595959aa)"; + }; + + # https://wiki.hyprland.org/Configuring/Variables/#input + input = { + kb_layout = "fr"; + sensitivity = 0; + follow_mouse = 2; + + # https://wiki.hyprland.org/Configuring/Variables/#touchpad + touchpad = { + natural_scroll = false; + }; + }; + + # https://wiki.hyprland.org/Configuring/Variables/#decoration + decoration = { + rounding = 2; + drop_shadow = true; + shadow_range = 4; + shadow_render_power = 3; + "col.shadow" = "rgba(1a1a1aee)"; + + # https://wiki.hyprland.org/Configuring/Variables/#blur + blur = { + enabled = true; + size = 3; + passes = 3; + new_optimizations = 3; + }; + }; + + # https://wiki.hyprland.org/Configuring/Animations/ + animations = { + enabled = false; + }; + + # https://wiki.hyprland.org/Configuring/Dwindle-Layout/ + general.layout = "dwindle"; + dwindle = { + pseudotile = true; + preserve_split = true; + no_gaps_when_only = true; + }; + + # https://wiki.hyprland.org/Configuring/Master-Layout/ + master = { + new_is_master = false; + }; + + # https://wiki.hyprland.org/Configuring/Variables/#gestures + gestures = { + workspace_swipe = false; + }; + + # https://wiki.hyprland.org/Configuring/Variables/#misc + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + + mouse_move_enables_dpms = true; + key_press_enables_dpms = true; + }; + + bind = [ + "$mod, Return, exec, ${lib.getExe pkgs.alacritty}" + "$mod, Q, killactive," + "$mod, S, togglefloating," + "$mod, L, exec, ${lib.getExe pkgs.swaylock-effects} -f" + "$mod, space, exec, ${lib.getExe pkgs.fuzzel}" + "$mod, C, exec, ${lib.getExe pkgs.cliphist} list | ${lib.getExe pkgs.fuzzel} -d --tabs 2 --width 100 | ${lib.getExe pkgs.cliphist} decode | ${pkgs.wl-clipboard}/bin/wl-copy" + "$mod, E, exec, BEMOJI_PICKER_CMD='${lib.getExe pkgs.fuzzel} -d' ${lib.getExe pkgs.bemoji} -n" + + # Screenshot + ", Print, exec, ${lib.getExe pkgs.grim} `date +'%Y-%m-%dT%H:%M:%S'`.png" + "SHIFT, Print, exec, ${lib.getExe pkgs.grim} - | wl-copy -t 'image/png'" + "$mod, Print, exec, ${lib.getExe pkgs.slurp} -d | ${lib.getExe pkgs.grim} -g - `date +'%Y-%m-%dT%H:%M:%S'`.png" + "$mod SHIFT, Print, exec, ${lib.getExe pkgs.slurp} -d | ${lib.getExe pkgs.grim} -g - - | ${pkgs.wl-clipboard}/bin/wl-copy -t 'image/png'" + + # Backlight + ", XF86MonBrightnessUp, exec, ${lib.getExe pkgs.light} -A 5" + ", XF86MonBrightnessDown, exec, ${lib.getExe pkgs.light} -U 5" + + # Audio + ", XF86AudioMute, exec, ${lib.getExe pkgs.pamixer} --sink 0 -t" + ", XF86AudioRaiseVolume, exec, ${lib.getExe pkgs.pamixer} -i 5" + ", XF86AudioLowerVolume, exec, ${lib.getExe pkgs.pamixer} -d 5" + ", XF86AudioMicMute, exec, ${lib.getExe pkgs.pamixer} --source 0 -t" + ", XF86AudioPlay, exec, ${lib.getExe pkgs.playerctl} play-pause" + ", XF86AudioStop, exec, ${lib.getExe pkgs.playerctl} stop" + ", XF86AudioNext, exec, ${lib.getExe pkgs.playerctl} next" + ", XF86AudioPrev, exec, ${lib.getExe pkgs.playerctl} previous" + + # Switch workspaces + "$mod, ampersand, workspace, 1" + "$mod, eacute, workspace, 2" + "$mod, quotedbl, workspace, 3" + "$mod, apostrophe, workspace, 4" + "$mod, parenleft, workspace, 5" + "$mod, minus, workspace, 6" + "$mod, egrave, workspace, 7" + "$mod, underscore, workspace, 8" + "$mod, ccedilla, workspace, 9" + "$mod, agrave, workspace, 10" + + # Switch window to workspace + "$mod SHIFT, ampersand, movetoworkspacesilent, 1" + "$mod SHIFT, eacute, movetoworkspacesilent, 2" + "$mod SHIFT, quotedbl, movetoworkspacesilent, 3" + "$mod SHIFT, apostrophe, movetoworkspacesilent, 4" + "$mod SHIFT, parenleft, movetoworkspacesilent, 5" + "$mod SHIFT, minus, movetoworkspacesilent, 6" + "$mod SHIFT, egrave, movetoworkspacesilent, 7" + "$mod SHIFT, underscore, movetoworkspacesilent, 8" + "$mod SHIFT, ccedilla, movetoworkspacesilent, 9" + "$mod SHIFT, agrave, movetoworkspacesilent, 10" + ]; + + bindm = [ + # Move/resize windows + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + }; + }; +} diff --git a/home/desktop/hyprland/default.nix b/home/desktop/hyprland/default.nix deleted file mode 100644 index dd31d4f..0000000 --- a/home/desktop/hyprland/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - inputs, - pkgs, - ... -}: { - wayland.windowManager.hyprland = { - enable = true; - - extraConfig = - '' - exec-once=env XDG_CACHE_HOME=/tmp ${pkgs.eww}/bin/eww open bar - exec-once=${pkgs.swaybg}/bin/swaybg -i ${inputs.wallpaper} - exec-once=${pkgs.mako}/bin/mako - exec-once=${pkgs.thunderbird}/bin/thunderbird - exec-once=${pkgs.wl-clipboard}/bin/wl-paste --watch ${pkgs.cliphist}/bin/cliphist store - exec-once=${pkgs.gnome.gnome-keyring}/bin/gnome-keyring-daemon --start --components=secrets - '' - + builtins.readFile ./hyprland.conf; - }; -} diff --git a/home/desktop/hyprland/hyprland.conf b/home/desktop/hyprland/hyprland.conf deleted file mode 100644 index 5a93c16..0000000 --- a/home/desktop/hyprland/hyprland.conf +++ /dev/null @@ -1,151 +0,0 @@ -# https://wiki.hyprland.org/Configuring/Monitors/ -monitor=DP-3,1920x1080@120,0x0,1 -monitor=eDP-1,1920x1200,0x1080,1 - -# https://wiki.hyprland.org/Configuring/Keywords/ - -# Some default env vars. -env = XCURSOR_SIZE,20 - -# https://wiki.hyprland.org/Configuring/Variables/ -input { - kb_layout = fr - kb_variant = - kb_model = - kb_options = - kb_rules = - - follow_mouse = 2 - - touchpad { - natural_scroll = no - } - - sensitivity = 0 # -1.0 - 1.0, 0 means no modification. -} - -# https://wiki.hyprland.org/Configuring/Variables/ -general { - gaps_in = 2 - gaps_out = 4 - - border_size = 0 - col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg - col.inactive_border = rgba(595959aa) - - layout = dwindle -} - -# See https://wiki.hyprland.org/Configuring/Variables/ -decoration { - rounding = 2 - - blur { - enabled = yes - size = 3 - passes = 3 - new_optimizations = 3 - } - - drop_shadow = yes - shadow_range = 4 - shadow_render_power = 3 - col.shadow = rgba(1a1a1aee) -} - -# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ -animations { - enabled = no -} - -# https://wiki.hyprland.org/Configuring/Dwindle-Layout/ -dwindle { - pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below - preserve_split = yes # you probably want this - no_gaps_when_only = true -} - -# https://wiki.hyprland.org/Configuring/Master-Layout/ -master { - new_is_master = false -} - -# https://wiki.hyprland.org/Configuring/Variables/ -gestures { - workspace_swipe = off -} - -misc { - # no thanks - disable_hyprland_logo = true - disable_splash_rendering = true - - # turn on screen when mouse moves or key is pressed - mouse_move_enables_dpms = true - key_press_enables_dpms = true -} - -# https://wiki.hyprland.org/Configuring/Window-Rules/ -# None - -# https://wiki.hyprland.org/Configuring/Keywords/ -$mainMod = SUPER - -# https://wiki.hyprland.org/Configuring/Binds/ - -# Main binds -bind = $mainMod, Return, exec, alacritty -bind = $mainMod, Q, killactive, -bind = $mainMod, S, togglefloating, -bind = $mainMod, L, exec, swaylock -f -bind = $mainMod, space, exec, fuzzel -bind = $mainMod, C, exec, cliphist list | fuzzel -d --tabs 2 --width 100 | cliphist decode | wl-copy -bind = $mainMod, E, exec, BEMOJI_PICKER_CMD="fuzzel -d" bemoji -n - -# Screenshot -bind = , Print, exec, grim `date +'%Y-%m-%dT%H:%M:%S'`.png -bind = SHIFT, Print, exec, grim - | wl-copy -t 'image/png' -bind = $mainMod, Print, exec, slurp -d | grim -g - `date +'%Y-%m-%dT%H:%M:%S'`.png -bind = $mainMod SHIFT, Print, exec, slurp -d | grim -g - - | wl-copy -t 'image/png' - -# Backlight -bind = , XF86MonBrightnessUp, exec, light -A 5 -bind = , XF86MonBrightnessDown, exec, light -U 5 - -# Audio -bind = , XF86AudioMute, exec, pamixer --sink 0 -t -bind = , XF86AudioRaiseVolume, exec, pamixer -i 5 -bind = , XF86AudioLowerVolume, exec, pamixer -d 5 -bind = , XF86AudioMicMute, exec, pamixer --source 0 -t -bind = , XF86AudioPlay, exec, playerctl play-pause -bind = , XF86AudioStop, exec, playerctl stop -bind = , XF86AudioNext, exec, playerctl next -bind = , XF86AudioPrev, exec, playerctl previous - -# Switch workspaces -bind = $mainMod, ampersand, workspace, 1 -bind = $mainMod, eacute, workspace, 2 -bind = $mainMod, quotedbl, workspace, 3 -bind = $mainMod, apostrophe, workspace, 4 -bind = $mainMod, parenleft, workspace, 5 -bind = $mainMod, minus, workspace, 6 -bind = $mainMod, egrave, workspace, 7 -bind = $mainMod, underscore, workspace, 8 -bind = $mainMod, ccedilla, workspace, 9 -bind = $mainMod, agrave, workspace, 10 - -# Switch window to workspace -bind = $mainMod SHIFT, ampersand, movetoworkspacesilent, 1 -bind = $mainMod SHIFT, eacute, movetoworkspacesilent, 2 -bind = $mainMod SHIFT, quotedbl, movetoworkspacesilent, 3 -bind = $mainMod SHIFT, apostrophe, movetoworkspacesilent, 4 -bind = $mainMod SHIFT, parenleft, movetoworkspacesilent, 5 -bind = $mainMod SHIFT, minus, movetoworkspacesilent, 6 -bind = $mainMod SHIFT, egrave, movetoworkspacesilent, 7 -bind = $mainMod SHIFT, underscore, movetoworkspacesilent, 8 -bind = $mainMod SHIFT, ccedilla, movetoworkspacesilent, 9 -bind = $mainMod SHIFT, agrave, movetoworkspacesilent, 10 - -# Move/resize windows -bindm = $mainMod, mouse:272, movewindow -bindm = $mainMod, mouse:273, resizewindow diff --git a/home/desktop/swayidle.nix b/home/desktop/swayidle.nix index ca8fa27..d4273c3 100644 --- a/home/desktop/swayidle.nix +++ b/home/desktop/swayidle.nix @@ -1,6 +1,7 @@ { inputs, pkgs, + lib, ... }: let hyprland_pkg = inputs.hyprland.packages."${pkgs.system}".hyprland; @@ -15,13 +16,13 @@ in { } { event = "before-sleep"; - command = "${pkgs.swaylock-effects}/bin/swaylock -f"; + command = "${lib.getExe pkgs.swaylock-effects} -f"; } ]; timeouts = [ { timeout = 120; - command = "${pkgs.swaylock-effects}/bin/swaylock -f --grace 3"; + command = "${lib.getExe pkgs.swaylock-effects} -f --grace 3"; } { timeout = 150; diff --git a/home/packages.nix b/home/packages.nix index fadce58..b31acec 100644 --- a/home/packages.nix +++ b/home/packages.nix @@ -2,30 +2,23 @@ services.mpris-proxy.enable = true; # media keys home.packages = with pkgs; [ - bemoji alejandra # nix formatter borgbackup # backup - cliphist # clipboard manager dconf # required by home-manager distrobox # docker utils docker-compose # docker compose duf # replacement for df gnome.nautilus # file explorer gnome.seahorse # key manager - grim # screenshot utils jaq # (fast) json utils jmtpfs # for Android MTP keepassxc # password manager nil # nix language server - pamixer # volume mixer cli pavucontrol # volume mixer - playerctl # media keys pwgen # password generator rsync # better scp - slurp # region selector socat # socket cat sysz # better systemctl - wl-clipboard # clipboard utils xdg-utils ]; } diff --git a/hosts/aurum/system/hardware/default.nix b/hosts/aurum/system/hardware/default.nix index 3b760ae..a8fa419 100644 --- a/hosts/aurum/system/hardware/default.nix +++ b/hosts/aurum/system/hardware/default.nix @@ -33,12 +33,6 @@ ./partitions.nix ]; - # tests, temporary or move this shit to nixos-hardware public repo - # services.thermald.enable = lib.mkDefault true; - - # Includes the Wi-Fi and Bluetooth firmware for the QCA6390. ?????? - # hardware.enableRedistributableFirmware = true; - # enable finger print sensor. # this has to be configured with `sudo fprintd-enroll `. services.fprintd.enable = true; @@ -48,8 +42,7 @@ # Allows for updating firmware via `fwupdmgr`. services.fwupd.enable = true; - # webcam bullshit fuck you intel - # bugged my power down ? try to uninstall ? doesn't work anyway + # webcam # hardware.firmware = [ # pkgs.ivsc-firmware # ];