From 7489ec102bd11fede4aef34265e606a97ba0ee32 Mon Sep 17 00:00:00 2001 From: Ashhhleyyy Date: Tue, 6 Aug 2024 17:13:44 +0100 Subject: [PATCH] feat(alex): more niri stuffs --- flake.nix | 25 ++++ home/ash/niri.nix | 253 ++++++++++++++++++++++++++++++++++- home/ash/waybar/style.css | 131 ++++++++++++++++++ hosts/alex/configuration.nix | 3 +- 4 files changed, 409 insertions(+), 3 deletions(-) create mode 100644 home/ash/waybar/style.css diff --git a/flake.nix b/flake.nix index babc9ed..1f31aee 100644 --- a/flake.nix +++ b/flake.nix @@ -99,6 +99,7 @@ system = "x86_64-linux"; modules = [ overlays-module + niri-flake.nixosModules.niri ./hosts/alex/configuration.nix home-manager.nixosModules.home-manager { @@ -112,6 +113,7 @@ ./home/ash/desktop.nix ./home/ash/emacs.nix # ./home/ash/obs.nix + ./home/ash/niri.nix ./home/ash/tpm-fido.nix ./home/ash/vscodium.nix ./home/ash/zoom.nix @@ -142,6 +144,7 @@ ./home/ash/obs.nix ./home/ash/intellij.nix ./home/ash/lutris.nix + ./home/ash/vscodium.nix ./home/ash/zoom.nix ]; @@ -208,6 +211,28 @@ ]; }; + nixosConfigurations.em = nixpkgs-unstable.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + overlays-module + niri-flake.nixosModules.niri + ./hosts/em/configuration.nix + home-manager-unstable.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.ash = { ... }: { + imports = [ + fsh.homeModules.fsh + ./home/ash + ./home/ash/niri.nix + ./home/ash/desktop.nix + ]; + }; + } + ]; + }; + packages.x86_64-linux = { emira = nixos-generators.nixosGenerate { system = "x86_64-linux"; diff --git a/home/ash/niri.nix b/home/ash/niri.nix index 003eaf2..1e466df 100644 --- a/home/ash/niri.nix +++ b/home/ash/niri.nix @@ -1,5 +1,256 @@ { config, pkgs, ... }: { programs.niri = { - # enable = true; + settings = { + input = { + focus-follows-mouse.enable = true; + }; + layout = { + gaps = 8; + preset-column-widths = [ + { proportion = 1. / 3.; } + { proportion = 1. / 2.; } + { proportion = 2. / 3.; } + ]; + default-column-width.proportion = 1. / 2.; + focus-ring = { + active.color = "#cba6f7"; + inactive.color = "#313244"; + }; + }; + binds = with config.lib.niri.actions; { + "Mod+Shift+Slash".action = show-hotkey-overlay; + + "Mod+T".action = spawn "kitty"; + "Mod+Space".action = spawn "fuzzel"; + "Super+Alt+L".action = spawn "swaylock"; + + "XF86AudioRaiseVolume" = { + allow-when-locked = true; + action = spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; + }; + "XF86AudioLowerVolume" = { + allow-when-locked = true; + action = spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; + }; + "XF86AudioMute" = { + allow-when-locked = true; + action = spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; + }; + "XF86AudioMicMute" = { + allow-when-locked = true; + action = spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; + }; + + "Mod+Q".action = close-window; + + "Mod+Left".action = focus-column-left; + "Mod+Down".action = focus-window-down; + "Mod+Up".action = focus-window-up; + "Mod+Right".action = focus-column-right; + "Mod+H".action = focus-column-left; + "Mod+J".action = focus-window-down; + "Mod+K".action = focus-window-up; + "Mod+L".action = focus-column-right; + + "Mod+Ctrl+Left".action = move-column-left; + "Mod+Ctrl+Down".action = move-window-down; + "Mod+Ctrl+Up".action = move-window-up; + "Mod+Ctrl+Right".action = move-column-right; + "Mod+Ctrl+H".action = move-column-left; + "Mod+Ctrl+J".action = move-window-down; + "Mod+Ctrl+K".action = move-window-up; + "Mod+Ctrl+L".action = move-column-right; + + "Mod+Home".action = focus-column-first; + "Mod+End".action = focus-column-last; + "Mod+Ctrl+Home".action = move-column-to-first; + "Mod+Ctrl+End".action = move-column-to-last; + + "Mod+Shift+Left".action = focus-monitor-left; + "Mod+Shift+Down".action = focus-monitor-down; + "Mod+Shift+Up".action = focus-monitor-up; + "Mod+Shift+Right".action = focus-monitor-right; + "Mod+Shift+H".action = focus-monitor-left; + "Mod+Shift+J".action = focus-monitor-down; + "Mod+Shift+K".action = focus-monitor-up; + "Mod+Shift+L".action = focus-monitor-right; + + "Mod+Shift+Ctrl+Left".action = move-column-to-monitor-left; + "Mod+Shift+Ctrl+Down".action = move-column-to-monitor-down; + "Mod+Shift+Ctrl+Up".action = move-column-to-monitor-up; + "Mod+Shift+Ctrl+Right".action = move-column-to-monitor-right; + "Mod+Shift+Ctrl+H".action = move-column-to-monitor-left; + "Mod+Shift+Ctrl+J".action = move-column-to-monitor-down; + "Mod+Shift+Ctrl+K".action = move-column-to-monitor-up; + "Mod+Shift+Ctrl+L".action = move-column-to-monitor-right; + + "Mod+Page_Down".action = focus-workspace-down; + "Mod+Page_Up".action = focus-workspace-up; + "Mod+U".action = focus-workspace-down; + "Mod+I".action = focus-workspace-up; + "Mod+Ctrl+Page_Down".action = move-column-to-workspace-down; + "Mod+Ctrl+Page_Up".action = move-column-to-workspace-up; + "Mod+Ctrl+U".action = move-column-to-workspace-down; + "Mod+Ctrl+I".action = move-column-to-workspace-up; + + "Mod+Shift+Page_Down".action = move-workspace-down; + "Mod+Shift+Page_Up".action = move-workspace-up; + "Mod+Shift+U".action = move-workspace-down; + "Mod+Shift+I".action = move-workspace-up; + + "Mod+1".action = focus-workspace 1; + "Mod+2".action = focus-workspace 2; + "Mod+3".action = focus-workspace 3; + "Mod+4".action = focus-workspace 4; + "Mod+5".action = focus-workspace 5; + "Mod+6".action = focus-workspace 6; + "Mod+7".action = focus-workspace 7; + "Mod+8".action = focus-workspace 8; + "Mod+9".action = focus-workspace 9; + "Mod+Ctrl+1".action = move-column-to-workspace 1; + "Mod+Ctrl+2".action = move-column-to-workspace 2; + "Mod+Ctrl+3".action = move-column-to-workspace 3; + "Mod+Ctrl+4".action = move-column-to-workspace 4; + "Mod+Ctrl+5".action = move-column-to-workspace 5; + "Mod+Ctrl+6".action = move-column-to-workspace 6; + "Mod+Ctrl+7".action = move-column-to-workspace 7; + "Mod+Ctrl+8".action = move-column-to-workspace 8; + "Mod+Ctrl+9".action = move-column-to-workspace 9; + + "Mod+Comma".action = consume-window-into-column; + "Mod+Period".action = expel-window-from-column; + + "Mod+R".action = switch-preset-column-width; + "Mod+Shift+R".action = reset-window-height; + "Mod+F".action = maximize-column; + "Mod+Shift+F".action = fullscreen-window; + "Mod+C".action = center-column; + + "Mod+Minus".action = set-column-width "-10%"; + "Mod+Plus".action = set-column-width "+10%"; + + "Mod+Shift+Minus".action = set-window-height "-10%"; + "Mod+Shift+Plus".action = set-window-height "+10%"; + + "Print".action = screenshot; + "Ctrl+Print".action = screenshot-screen; + "Alt+Print".action = screenshot-window; + + "Mod+Shift+E".action = quit; + "Mod+Shift+P".action = power-off-monitors; + }; + }; + }; + + programs.swaylock.enable = true; + + programs.fuzzel = { + enable = true; + }; + + programs.waybar = { + enable = true; + style = ./waybar/style.css; + settings = [{ + "layer" = "top"; # Waybar at top layer + "position" = "top"; # Waybar position (top|bottom|left|right) + # "width" = 1280; # Waybar width + # Choose the order of the modules + "modules-left" = [ + "wlr/workspaces" + ]; + "modules-center" = [ + # "custom/music" + ]; + "modules-right" = [ + "pulseaudio" + "backlight" + "battery" + "clock" + "tray" + "custom/lock" + "custom/power" + ]; + "wlr/workspaces" = { + "disable-scroll" = true; + "sort-by-name" = true; + "format" = " {icon} "; + "format-icons" = { + "default" = ""; + }; + }; + "tray" = { + "icon-size" = 21; + "spacing" = 10; + }; + # "custom/music" = { + # "format" = " {}"; + # "escape" = true; + # "interval" = 5; + # "tooltip" = false; + # "exec" = "playerctl metadata --format='{{ title }}'"; + # "on-click" = "playerctl play-pause"; + # "max-length" = 50 + # }; + "clock" = { + "timezone" = "Europe/London"; + "tooltip-format" = "{:%Y %B}\n{calendar}"; + "format-alt" = " {:%d/%m/%Y}"; + "format" = " {:%H:%M}"; + }; + "backlight" = { + "device" = "intel_backlight"; + "format" = "{icon}"; + "format-icons" = ["" "" "" "" "" "" "" "" ""]; + }; + "battery" = { + "states" = { + "warning" = 30; + "critical" = 15; + }; + "format" = "{icon}"; + "format-charging" = ""; + "format-plugged" = ""; + "format-alt" = "{icon}"; + "format-icons" = ["" "" "" "" "" "" "" "" "" "" "" ""]; + }; + "pulseaudio" = { + # "scroll-step" = 1, # %, can be a float + "format" = "{icon} {volume}%"; + "format-muted" = ""; + "format-icons" = { + "default" = ["" "" " "]; + }; + "on-click" = "pavucontrol"; + }; + "custom/lock" = { + "tooltip" = false; + "on-click" = "sh -c '(sleep 0.5s; swaylock --grace 0)' & disown"; + "format" = ""; + }; + "custom/power" = { + "tooltip" = false; + "on-click" = "wlogout &"; + "format" = "Logout"; + }; + }]; + systemd.enable = true; + }; + + services.mako = { + enable = true; + }; + + systemd.user.services."swaybg" = { + Unit = { + Description = "swaybg"; + PartOf = ["graphical-session.target"]; + After = ["graphical-session.target"]; + Requisite = ["graphical-session.target"]; + }; + Service = { + ExecStart = "${pkgs.swaybg}/bin/swaybg -i $HOME/wallpaper.png"; + Restart = "on-failure"; + }; }; } diff --git a/home/ash/waybar/style.css b/home/ash/waybar/style.css new file mode 100644 index 0000000..39cb5d9 --- /dev/null +++ b/home/ash/waybar/style.css @@ -0,0 +1,131 @@ +@define-color base #1e1e2e; +@define-color mantle #181825; +@define-color crust #11111b; + +@define-color text #cdd6f4; +@define-color subtext0 #a6adc8; +@define-color subtext1 #bac2de; + +@define-color surface0 #313244; +@define-color surface1 #45475a; +@define-color surface2 #585b70; + +@define-color overlay0 #6c7086; +@define-color overlay1 #7f849c; +@define-color overlay2 #9399b2; + +@define-color blue #89b4fa; +@define-color lavender #b4befe; +@define-color sapphire #74c7ec; +@define-color sky #89dceb; +@define-color teal #94e2d5; +@define-color green #a6e3a1; +@define-color yellow #f9e2af; +@define-color peach #fab387; +@define-color maroon #eba0ac; +@define-color red #f38ba8; +@define-color mauve #cba6f7; +@define-color pink #f5c2e7; +@define-color flamingo #f2cdcd; +@define-color rosewater #f5e0dc; + +* { + font-family: FantasqueSansMono Nerd Font; + font-size: 17px; + min-height: 0; +} + +#waybar { + background: transparent; + color: @text; + margin: 5px 5px; +} + +#workspaces { + border-radius: 1rem; + margin: 5px; + background-color: @surface0; + margin-left: 1rem; +} + +#workspaces button { + color: @lavender; + border-radius: 1rem; + padding: 0.4rem; +} + +#workspaces button.active { + color: @sky; + border-radius: 1rem; +} + +#workspaces button:hover { + color: @sapphire; + border-radius: 1rem; +} + +#custom-music, +#tray, +#backlight, +#clock, +#battery, +#pulseaudio, +#custom-lock, +#custom-power { + background-color: @surface0; + padding: 0.5rem 1rem; + margin: 5px 0; +} + +#clock { + color: @blue; + border-radius: 0px 1rem 1rem 0px; + margin-right: 1rem; +} + +#battery { + color: @green; +} + +#battery.charging { + color: @green; +} + +#battery.warning:not(.charging) { + color: @red; +} + +#backlight { + color: @yellow; +} + +#backlight, #battery { + border-radius: 0; +} + +#pulseaudio { + color: @maroon; + border-radius: 1rem 0px 0px 1rem; + margin-left: 1rem; +} + +#custom-music { + color: @mauve; + border-radius: 1rem; +} + +#custom-lock { + border-radius: 1rem 0px 0px 1rem; + color: @lavender; +} + +#custom-power { + margin-right: 1rem; + border-radius: 0px 1rem 1rem 0px; + color: @red; +} + +#tray { + margin-right: 1rem; + border-radius: 1rem; +} \ No newline at end of file diff --git a/hosts/alex/configuration.nix b/hosts/alex/configuration.nix index 04cc50d..52c9a0c 100644 --- a/hosts/alex/configuration.nix +++ b/hosts/alex/configuration.nix @@ -7,6 +7,7 @@ ../../common/tpm.nix ../../roles/kodi.nix ../../roles/libvirt.nix + ../../roles/niri.nix ../../roles/podman.nix ./hardware-config.nix ]; @@ -22,7 +23,6 @@ networking.hostName = "alex"; networking.firewall.enable = false; - sound.enable = true; hardware.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { @@ -45,7 +45,6 @@ xkb.layout = "gb"; }; displayManager.sddm.enable = true; - desktopManager.plasma6.enable = true; }; #environment.systemPackages = with pkgs; [