1
1
Fork 0

desktops: add main desktop option for use with module conditions

Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
Myned 2024-12-24 09:26:54 -05:00
parent 99e0c4ec14
commit 7d2190a8f0
Signed by: myned
GPG key ID: C7224454F7881A34
4 changed files with 27 additions and 12 deletions

View file

@ -3,12 +3,21 @@
lib, lib,
... ...
}: }:
with lib; { with lib; let
config.custom.desktops = mkIf config.custom.full { cfg = config.custom.desktops;
#// gnome.enable = true; in {
#// hyprland.enable = true; options.custom.desktops = {
#// kde.enable = true; enable = mkOption {default = config.custom.minimal;};
niri.enable = true; desktop = mkOption {default = "niri";};
#// sway.enable = true; };
config = mkIf cfg.enable {
custom.desktops = {
gnome.enable = cfg.desktop == "gnome";
hyprland.enable = cfg.desktop == "hyprland";
kde.enable = cfg.desktop == "kde";
niri.enable = cfg.desktop == "niri";
sway.enable = cfg.desktop == "sway";
};
}; };
} }

View file

@ -9,6 +9,7 @@ with lib; let
hyprctl = "${config.programs.hyprland.package}/bin/hyprctl"; hyprctl = "${config.programs.hyprland.package}/bin/hyprctl";
hyprlock = "${config.home-manager.users.${config.custom.username}.programs.hyprlock.package}/bin/hyprlock"; hyprlock = "${config.home-manager.users.${config.custom.username}.programs.hyprlock.package}/bin/hyprlock";
loginctl = "${pkgs.systemd}/bin/loginctl"; loginctl = "${pkgs.systemd}/bin/loginctl";
niri = "${config.programs.niri.package}/bin/niri";
pgrep = "${pkgs.procps}/bin/pgrep"; pgrep = "${pkgs.procps}/bin/pgrep";
pw-cli = "${pkgs.pipewire}/bin/pw-cli"; pw-cli = "${pkgs.pipewire}/bin/pw-cli";
systemctl = "${pkgs.systemd}/bin/systemctl"; systemctl = "${pkgs.systemd}/bin/systemctl";
@ -37,7 +38,12 @@ in {
{ {
timeout = 20 * 60; # Seconds timeout = 20 * 60; # Seconds
on-timeout = "${hyprctl} dispatch dpms off"; on-timeout =
if config.custom.desktops.desktop == "hyprland"
then "${hyprctl} dispatch dpms off"
else if config.custom.desktops.desktop == "niri"
then "${niri} msg action power-off-monitors"
else "";
} }
{ {

View file

@ -12,9 +12,9 @@
minimal = true; minimal = true;
profile = "console"; profile = "console";
desktops.gnome = { desktops = {
enable = true; desktop = "gnome";
gdm = false; gnome.gdm = false;
}; };
programs = { programs = {

View file

@ -1,7 +1,7 @@
{ {
custom = { custom = {
full = true; full = true;
profile = "desktop"; # Inherit desktop profile = "desktop"; # Inherit desktop profile
}; };
#!! Rebuild offline - drastically increases initial download and resulting closure size #!! Rebuild offline - drastically increases initial download and resulting closure size