diff --git a/home/profiles/io/default.nix b/home/profiles/io/default.nix index de38dbba..d84e7f6a 100644 --- a/home/profiles/io/default.nix +++ b/home/profiles/io/default.nix @@ -23,6 +23,7 @@ ../../services/system/power-monitor.nix ../../services/system/syncthing.nix ../../services/system/tailray.nix + ../../services/system/theme.nix ../../services/system/udiskie.nix # wayland-specific diff --git a/home/services/system/theme.nix b/home/services/system/theme.nix new file mode 100644 index 00000000..a24f93e2 --- /dev/null +++ b/home/services/system/theme.nix @@ -0,0 +1,42 @@ +{ + lib, + pkgs, + ... +}: { + systemd.user.timers = { + theme-toggle-dark = { + Unit.Description = "Toggle dark theme"; + Timer.OnCalendar = [ + "*-*-* 18:00:00" + ]; + Install.WantedBy = ["graphical-session.target"]; + }; + + theme-toggle-light = { + Unit.Description = "Toggle light theme"; + Timer.OnCalendar = [ + "*-*-* 06:00:00" + ]; + Install.WantedBy = ["graphical-session.target"]; + }; + }; + + systemd.user.services = { + theme-toggle-dark = { + Unit.Description = "Toggle dark theme"; + Service = { + Type = "simple"; + ExecStart = "${lib.getExe pkgs.dconf} write /org/gnome/desktop/interface/color-scheme \"'prefer-dark'\""; + TimeoutStopSec = 5; + }; + }; + theme-toggle-light = { + Unit.Description = "Toggle light theme"; + Service = { + Type = "simple"; + ExecStart = "${lib.getExe pkgs.dconf} write /org/gnome/desktop/interface/color-scheme \"'prefer-light'\""; + TimeoutStopSec = 5; + }; + }; + }; +}