refactor(dm): use home-manager for greeter hyprland config
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
f793e546f6
commit
13abafb1b2
3 changed files with 42 additions and 82 deletions
|
@ -1,11 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (import ./hyprland.nix {inherit config lib pkgs;}) hyprConf;
|
||||
|
||||
{config, ...}: let
|
||||
cfg = config.roles.desktop;
|
||||
|
||||
hyprland =
|
||||
|
@ -20,6 +13,7 @@
|
|||
in {
|
||||
imports = [
|
||||
./astal.nix
|
||||
./hyprland.nix
|
||||
];
|
||||
|
||||
services = {
|
||||
|
@ -29,7 +23,7 @@ in {
|
|||
enable = true;
|
||||
settings = {
|
||||
default_session = {
|
||||
command = "Hyprland --config ${hyprConf}";
|
||||
command = "Hyprland";
|
||||
user = "greeter";
|
||||
};
|
||||
|
||||
|
|
|
@ -4,17 +4,7 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit
|
||||
(lib)
|
||||
boolToString
|
||||
concatStringsSep
|
||||
filterAttrs
|
||||
hasPrefix
|
||||
isAttrs
|
||||
isBool
|
||||
mapAttrsToList
|
||||
optionalString
|
||||
;
|
||||
inherit (lib) filterAttrs hasPrefix optionals;
|
||||
|
||||
inherit (import ./setupMonitors.nix {inherit config pkgs;}) setupMonitors;
|
||||
|
||||
|
@ -31,72 +21,44 @@
|
|||
.hyprland;
|
||||
|
||||
devices = filterAttrs (n: v: hasPrefix "device:" n) cfgHypr.settings;
|
||||
monitors = cfgHypr.settings.monitor;
|
||||
inputs = cfgHypr.settings.input;
|
||||
misc = cfgHypr.settings.misc;
|
||||
|
||||
mkHyprBlock = attrs:
|
||||
concatStringsSep "\n" (mapAttrsToList (
|
||||
n: v:
|
||||
if (isAttrs v)
|
||||
then ''
|
||||
${n} {
|
||||
${mkHyprBlock v}
|
||||
}
|
||||
''
|
||||
else if (isBool v)
|
||||
then " ${n}=${boolToString v}"
|
||||
else " ${n}=${toString v}"
|
||||
)
|
||||
attrs);
|
||||
in {
|
||||
hyprConf = pkgs.writeText "greetd-hypr-config" (
|
||||
(optionalString config.nvidia.enable
|
||||
# hyprlang
|
||||
''
|
||||
env = LIBVA_DRIVER_NAME,nvidia
|
||||
env = XDG_SESSION_TYPE,wayland
|
||||
env = GBM_BACKEND,nvidia-drm
|
||||
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
|
||||
env = WLR_NO_HARDWARE_CURSORS,1
|
||||
'')
|
||||
+ (concatStringsSep "\n" (map (x: "monitor=${x}") monitors))
|
||||
+ "\n"
|
||||
+
|
||||
# hyprlang
|
||||
''
|
||||
misc {
|
||||
${mkHyprBlock misc}
|
||||
}
|
||||
home-manager.users.greeter = {
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
package = cfgHypr.finalPackage;
|
||||
systemd.enable = false;
|
||||
|
||||
# Devices
|
||||
${mkHyprBlock devices}
|
||||
settings =
|
||||
{
|
||||
inherit (cfgHypr.settings) cursor input misc monitor;
|
||||
|
||||
input {
|
||||
${mkHyprBlock inputs}
|
||||
}
|
||||
envd =
|
||||
(optionals (config.nvidia.enable) [
|
||||
"LIBVA_DRIVER_NAME, nvidia"
|
||||
"NVD_BACKEND, direct"
|
||||
"XDG_SESSION_TYPE, wayland"
|
||||
"GBM_BACKEND, nvidia-drm"
|
||||
"__GLX_VENDOR_LIBRARY_NAME, nvidia"
|
||||
])
|
||||
++ [
|
||||
"XCURSOR_SIZE,24"
|
||||
];
|
||||
|
||||
''
|
||||
+
|
||||
# hyprlang
|
||||
''
|
||||
#
|
||||
env = XCURSOR_SIZE,24
|
||||
exec-once = hyprctl setcursor Dracula-cursors 24
|
||||
general.border_size = 0;
|
||||
|
||||
general {
|
||||
border_size = 0
|
||||
}
|
||||
decoration = {
|
||||
blur.enabled = false;
|
||||
drop_shadow = false;
|
||||
};
|
||||
|
||||
decoration {
|
||||
blur {
|
||||
enabled = false
|
||||
}
|
||||
drop_shadow = false
|
||||
}
|
||||
exec-once = [
|
||||
"hyprctl setcursor Dracula-cursors 24"
|
||||
|
||||
exec-once = ${setupMonitors}
|
||||
exec-once = astal -b greeter &> /tmp/astal.log; hyprctl dispatch exit
|
||||
''
|
||||
);
|
||||
setupMonitors
|
||||
"astal -b greeter &> /tmp/astal.log; hyprctl dispatch exit"
|
||||
];
|
||||
}
|
||||
// devices;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs.lib) getExe;
|
||||
|
||||
cfg = config.roles.desktop;
|
||||
|
||||
hyprland =
|
||||
|
@ -38,6 +40,8 @@
|
|||
hyprctl keyword monitor "$name",preferred,auto,1,mirror,"$main"
|
||||
fi
|
||||
done
|
||||
|
||||
hyprctl dispatch focusmonitor "$main"
|
||||
'';
|
||||
};
|
||||
# Check if user wants the greeter only on main monitor
|
||||
|
@ -45,5 +49,5 @@ in {
|
|||
setupMonitors =
|
||||
if (cfg.mainMonitor != "null" && !cfg.displayManager.duplicateScreen)
|
||||
then "hyprctl dispatch focusmonitor ${cfg.mainMonitor}"
|
||||
else "${dupeMonitors}/bin/dupeMonitors";
|
||||
else getExe dupeMonitors;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue