home.desktop: generic autoSuspend, randomWallpaper, and redShift options (#67)

* move sway/hyprland autoSuspend settings to desktop module

* mauville: migrate settings

* migrate missing if statements

* home/desktop: move randomWallpaper to to desktop

* migrate randomWallpaper

* home: migrate redShift options to desktop
This commit is contained in:
Aly Raffauf 2024-07-30 16:34:06 -04:00 committed by GitHub
parent d037323c60
commit 3f9918caf9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 39 additions and 59 deletions

View file

@ -30,7 +30,7 @@ in {
timeouts =
["timeout 120 '${lib.getExe pkgs.brightnessctl} -s set 10' resume '${lib.getExe pkgs.brightnessctl} -r'"]
++ (
if cfg.desktop.hyprland.autoSuspend
if cfg.desktop.autoSuspend
then ["timeout 600 '${lib.getExe' pkgs.systemd "systemctl"} suspend'"]
else [
"timeout 600 '${lib.getExe pkgs.swaylock}'"
@ -39,7 +39,7 @@ in {
);
beforeSleeps =
lib.optionals cfg.desktop.hyprland.autoSuspend
lib.optionals cfg.desktop.autoSuspend
[
"before-sleep '${lib.getExe pkgs.playerctl} pause'"
"before-sleep '${lib.getExe pkgs.swaylock}'"

View file

@ -125,7 +125,6 @@ in {
exec-once =
[
helpers.wallpaperD
(lib.getExe pkgs.waybar)
scripts.idleD
(lib.getExe pkgs.wayland-pipewire-idle-inhibit)
@ -134,8 +133,12 @@ in {
(lib.getExe pkgs.mako)
"${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1"
]
++ lib.lists.optional (cfg.desktop.hyprland.redShift)
"${lib.getExe pkgs.gammastep} -l 33.74:-84.38";
++ lib.lists.optional (cfg.desktop.redShift)
"${lib.getExe pkgs.gammastep} -l 33.74:-84.38"
++ lib.lists.optional (cfg.desktop.randomWallpaper)
helpers.wallpaperD
++ lib.lists.optional (!cfg.desktop.randomWallpaper)
"${lib.getExe pkgs.swaybg} -i ${cfg.theme.wallpaper}";
input = {
follow_mouse = 1;

View file

@ -11,7 +11,7 @@ in {
timeouts =
["timeout 120 '${lib.getExe pkgs.brightnessctl} -s set 10' resume '${lib.getExe pkgs.brightnessctl} -r'"]
++ (
if cfg.desktop.sway.autoSuspend
if cfg.desktop.autoSuspend
then ["timeout 600 '${lib.getExe' pkgs.systemd "systemctl"} suspend'"]
else [
"timeout 600 '${lib.getExe pkgs.swaylock}'"
@ -20,7 +20,7 @@ in {
);
beforeSleeps =
lib.optionals cfg.desktop.sway.autoSuspend
lib.optionals cfg.desktop.autoSuspend
[
"before-sleep '${lib.getExe pkgs.playerctl} pause'"
"before-sleep '${lib.getExe pkgs.swaylock}'"

View file

@ -165,10 +165,10 @@ in {
{command = lib.getExe' pkgs.swayosd "swayosd-server";}
{command = lib.getExe pkgs.mako;}
]
++ lib.optional cfg.desktop.sway.redShift
++ lib.optional cfg.desktop.redShift
{command = "${lib.getExe pkgs.gammastep} -l 33.74:-84.38";}
++ lib.optional cfg.desktop.sway.randomWallpaper {command = "${helpers.wallpaperD}";}
++ lib.optional (!cfg.desktop.sway.randomWallpaper) {command = "${lib.getExe pkgs.swaybg} -i ${cfg.theme.wallpaper}";};
++ lib.optional cfg.desktop.randomWallpaper {command = "${helpers.wallpaperD}";}
++ lib.optional (!cfg.desktop.randomWallpaper) {command = "${lib.getExe pkgs.swaybg} -i ${cfg.theme.wallpaper}";};
floating.criteria = [
{app_id = ".blueman-manager-wrapped";}

View file

@ -107,6 +107,24 @@ in {
};
desktop = {
autoSuspend = lib.mkOption {
description = "Whether to autosuspend on idle.";
default = cfg.desktop.hyprland.enable || cfg.desktop.sway.enable;
type = lib.types.bool;
};
randomWallpaper = lib.mkOption {
description = "Whether to enable random wallpaper script.";
default = cfg.desktop.hyprland.enable || cfg.desktop.sway.enable;
type = lib.types.bool;
};
redShift = lib.mkOption {
description = "Whether to redshift display colors at night.";
default = cfg.desktop.hyprland.enable || cfg.desktop.sway.enable;
type = lib.types.bool;
};
hyprland = {
enable = lib.mkOption {
description = "Hyprland with full desktop session components.";
@ -114,12 +132,6 @@ in {
type = lib.types.bool;
};
autoSuspend = lib.mkOption {
description = "Whether to autosuspend on idle.";
default = cfg.desktop.hyprland.enable;
type = lib.types.bool;
};
laptopMonitors = lib.mkOption {
description = "List of internal laptop monitors.";
default = [];
@ -132,18 +144,6 @@ in {
type = lib.types.listOf lib.types.str;
};
randomWallpaper = lib.mkOption {
description = "Whether to enable random wallpaper script.";
default = cfg.desktop.hyprland.enable;
type = lib.types.bool;
};
redShift = lib.mkOption {
description = "Whether to redshift display colors at night.";
default = cfg.desktop.hyprland.enable;
type = lib.types.bool;
};
windowManagerBinds = lib.mkOption {
description = "Default binds for window management.";
default = {
@ -195,24 +195,6 @@ in {
type = lib.types.bool;
};
autoSuspend = lib.mkOption {
description = "Whether to autosuspend on idle.";
default = cfg.desktop.sway.enable;
type = lib.types.bool;
};
randomWallpaper = lib.mkOption {
description = "Whether to enable random wallpaper script.";
default = cfg.desktop.sway.enable;
type = lib.types.bool;
};
redShift = lib.mkOption {
description = "Whether to redshift display colors at night.";
default = cfg.desktop.sway.enable;
type = lib.types.bool;
};
windowManagerBinds = lib.mkOption {
description = "Default binds for window management.";
default = {

View file

@ -46,17 +46,12 @@ self: {
defaultApps.enable = true;
desktop = {
hyprland = {
monitors = [
"desc:Guangxi Century Innovation Display Electronics Co. Ltd 27C1U-D 0000000000001,preferred,-2400x0,1.6"
"desc:HP Inc. HP 24mh 3CM037248S,preferred,-1920x0,auto"
"desc:LG Electronics LG IPS QHD 109NTWG4Y865,preferred,-2560x0,auto"
];
randomWallpaper = false;
};
sway.randomWallpaper = false;
hyprland.monitors = [
"desc:Guangxi Century Innovation Display Electronics Co. Ltd 27C1U-D 0000000000001,preferred,-2400x0,1.6"
"desc:HP Inc. HP 24mh 3CM037248S,preferred,-1920x0,auto"
"desc:LG Electronics LG IPS QHD 109NTWG4Y865,preferred,-2560x0,auto"
];
randomWallpaper = false;
};
theme = {

View file

@ -11,9 +11,9 @@
xdg.userDirs.music = "/mnt/Media/Music";
ar.home = {
desktop.hyprland = {
desktop = {
autoSuspend = false;
monitors = ["desc:LG Electronics LG ULTRAWIDE 311NTAB5M720,preferred,auto,1.25,vrr,2"];
hyprland.monitors = ["desc:LG Electronics LG ULTRAWIDE 311NTAB5M720,preferred,auto,1.25,vrr,2"];
};
theme.darkMode = false;