From 40edb95bb144968fc00592f28a7a80c353de5edc Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Wed, 28 Aug 2024 14:17:38 +0200 Subject: [PATCH] hyprland: cleanup --- hosts/vali/hermit/programs.nix | 4 - modules/wms/wayland/default.nix | 2 +- modules/wms/wayland/hyprland/binds.nix | 1 + modules/wms/wayland/hyprland/workspaces.nix | 82 ++++++++++----------- modules/wms/wayland/services.nix | 31 -------- 5 files changed, 42 insertions(+), 78 deletions(-) delete mode 100644 modules/wms/wayland/services.nix diff --git a/hosts/vali/hermit/programs.nix b/hosts/vali/hermit/programs.nix index 179724f..181a59b 100644 --- a/hosts/vali/hermit/programs.nix +++ b/hosts/vali/hermit/programs.nix @@ -24,14 +24,12 @@ ffmpeg-full fftw fzf - #gadacz gcc gdb gnumake grc git helvum - hmm httpie hyperfine imagemagick @@ -45,7 +43,6 @@ libtool links2 mapscii - mars-mips moc ncmpcpp neofetch @@ -79,7 +76,6 @@ trash-cli tree ttyper - typst unzip util-linux v4l-utils diff --git a/modules/wms/wayland/default.nix b/modules/wms/wayland/default.nix index 93bb5f9..54ab46d 100644 --- a/modules/wms/wayland/default.nix +++ b/modules/wms/wayland/default.nix @@ -1,6 +1,6 @@ _: { imports = [ - ./hypr + ./hyprland/module.nix ./variables.nix ]; } diff --git a/modules/wms/wayland/hyprland/binds.nix b/modules/wms/wayland/hyprland/binds.nix index ddaa2aa..d944f3d 100644 --- a/modules/wms/wayland/hyprland/binds.nix +++ b/modules/wms/wayland/hyprland/binds.nix @@ -1,6 +1,7 @@ { config, pkgs, + ... }: let cfg = config.modules.usrEnv.desktops.hyprland; inherit (config.modules.other.system) username; diff --git a/modules/wms/wayland/hyprland/workspaces.nix b/modules/wms/wayland/hyprland/workspaces.nix index 55e9b99..1e739d1 100644 --- a/modules/wms/wayland/hyprland/workspaces.nix +++ b/modules/wms/wayland/hyprland/workspaces.nix @@ -9,49 +9,47 @@ inherit (builtins) map genList attrNames toString; in { home-manager.users.${username} = { - wayland.windowManager.hyprland = { - settings = { - # Monitor config - # monitor = [ - # "eDP-1,1920x1080,0x0,1" - # # "DP-2,1920x1080,0x0,1" - # # "HDMI-A-2,1920x1080,1920x0,1" - # # "HDMI-A-1,1920x1080,3840x0,1" - # # Had the shadow monitor bug, so had to disable all unknown monitors. - # "Unknown-1,disable" - # ]; + wayland.windowManager.hyprland.settings = { + # Monitor config + # monitor = [ + # "eDP-1,1920x1080,0x0,1" + # # "DP-2,1920x1080,0x0,1" + # # "HDMI-A-2,1920x1080,1920x0,1" + # # "HDMI-A-1,1920x1080,3840x0,1" + # # Had the shadow monitor bug, so had to disable all unknown monitors. + # "Unknown-1,disable" + # ]; - # INFO: This is a custom function to map all of my monitors to workspaces. - # Since I use split-monitor-workspaces, I map 10 workspaces to each monitor - # and set the first one to be the default one. - # To be able to use this for a varying amount of monitors we do some nasty trickery: - workspace = - # We're creating several lists of workspace assignments, one for each monitor, - # and have to merge them into one big list. - (flatten - # We then use imap0 insted of map because imap0 starts indexing at zero as oppsed to one with map. - (imap0 (monitorIndex: monitorName: ( - map ( - i: let - # we define our own modulo operation for this, - # since only the first workspace on each monitor is the default workspace. - mod = a: b: a - (b * (a / b)); - workspace = toString i; - isDefault = (mod i 10) == 1; # 11, 21, 31, ... - in "${workspace}, monitor:${monitorName}${optionalString isDefault ", default:true"}" - ) - # we generate a list of 10 elements for each monitor. We have to add 1 each time since genList starts indexing at 0. - # also, we add the monitorIndex * 10 to get 10 workspaces for each individual monitor. - (genList (i: i + 1 + (10 * monitorIndex)) 10) - )) - # our attrSet of different monitors - (attrNames monitors))) - # These are my two special workspaces - ++ [ - "special:nixos, decorate:false" - "special:keepassxc, decorate:false" - ]; - }; + # INFO: This is a custom function to map all of my monitors to workspaces. + # Since I use split-monitor-workspaces, I map 10 workspaces to each monitor + # and set the first one to be the default one. + # To be able to use this for a varying amount of monitors we do some nasty trickery: + workspace = + # We're creating several lists of workspace assignments, one for each monitor, + # and have to merge them into one big list. + (flatten + # We then use imap0 insted of map because imap0 starts indexing at zero as oppsed to one with map. + (imap0 (monitorIndex: monitorName: ( + map ( + i: let + # we define our own modulo operation for this, + # since only the first workspace on each monitor is the default workspace. + mod = a: b: a - (b * (a / b)); + workspace = toString i; + isDefault = (mod i 10) == 1; # 11, 21, 31, ... + in "${workspace}, monitor:${monitorName}${optionalString isDefault ", default:true"}" + ) + # we generate a list of 10 elements for each monitor. We have to add 1 each time since genList starts indexing at 0. + # also, we add the monitorIndex * 10 to get 10 workspaces for each individual monitor. + (genList (i: i + 1 + (10 * monitorIndex)) 10) + )) + # our attrSet of different monitors + (attrNames monitors))) + # These are my two special workspaces + ++ [ + "special:nixos, decorate:false" + "special:keepassxc, decorate:false" + ]; }; }; } diff --git a/modules/wms/wayland/services.nix b/modules/wms/wayland/services.nix deleted file mode 100644 index 8950587..0000000 --- a/modules/wms/wayland/services.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - inputs', - config, - ... -}: { - programs.niri = { - enable = true; - package = inputs'.niri.packages.niri-unstable; - }; - services = { - greetd = { - enable = true; - settings = rec { - initial_session = { - command = "${config.programs.niri.package}/bin/niri-session"; - user = "vali"; - }; - default_session = initial_session; - }; - }; - - gnome = { - # glib-networking.enable = true; - }; - - # lorri.enable = true; - # udisks2.enable = true; - # printing.enable = true; - # fstrim.enable = true; - }; -}