From 461b1099ad87afc7ca5876720cbf5543979416a1 Mon Sep 17 00:00:00 2001 From: kenji Date: Sat, 10 Jan 2026 23:01:23 -0600 Subject: [PATCH] add(matugen): auto-theme switch --- apps/matugen/config.toml | 5 +++++ apps/matugen/default.nix | 2 ++ apps/matugen/templates/theme-switch | 11 +++++++++++ 3 files changed, 18 insertions(+) create mode 100644 apps/matugen/templates/theme-switch diff --git a/apps/matugen/config.toml b/apps/matugen/config.toml index 7897ddb..2f3bb75 100644 --- a/apps/matugen/config.toml +++ b/apps/matugen/config.toml @@ -55,3 +55,8 @@ post_hook = "makoctl reload" input_path = "~/.config/matugen/templates/vicinae" output_path = "~/.local/share/vicinae/themes/matugen.toml" post_hook = "vicinae theme set matugen" + +[templates.theme-switch] +input_path = "~/.config/matugen/templates/theme-switch" +output_path = "~/.config/matugen/scripts/theme-switch.sh" +post_hook = "sh ~/.config/matugen/scripts/theme-switch.sh" diff --git a/apps/matugen/default.nix b/apps/matugen/default.nix index ee46fb5..34af09d 100644 --- a/apps/matugen/default.nix +++ b/apps/matugen/default.nix @@ -6,6 +6,7 @@ }: { home.packages = with pkgs; [ matugen + dconf psmisc # for killall ]; home.file.".config/matugen/config.toml" = { @@ -13,6 +14,7 @@ }; # Copy static templates + home.file.".config/matugen/templates/theme-switch".source = ./templates/theme-switch; home.file.".config/matugen/templates/cava".source = ./templates/cava; home.file.".config/matugen/templates/firefox".source = ./templates/firefox; home.file.".config/matugen/templates/ghostty".source = ./templates/ghostty; diff --git a/apps/matugen/templates/theme-switch b/apps/matugen/templates/theme-switch new file mode 100644 index 0000000..303e0d7 --- /dev/null +++ b/apps/matugen/templates/theme-switch @@ -0,0 +1,11 @@ +#!/bin/sh +# Generated by Matugen + +# mode will be replaced by 'dark' or 'light' +MODE="{{mode}}" + +if [ "$MODE" = "dark" ]; then + ${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'" +else + ${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'" +fi