init: firstCommit
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
{
|
||||
imports = [
|
||||
./theme-switcher.nix
|
||||
];
|
||||
|
||||
home.activation = {
|
||||
makedir = ''
|
||||
mkdir -p ~/.config/cornflake
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
apply-theme-script = pkgs.writeScript "apply-theme" ''
|
||||
curr=$(cat ~/.config/cornflake/current-theme)
|
||||
if [ "$curr" = "prefer-light" ]; then
|
||||
dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'"
|
||||
else
|
||||
dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
|
||||
fi
|
||||
'';
|
||||
|
||||
desktopEntry = {
|
||||
name = "Toggle theme";
|
||||
exec = ''${pkgs.writeScript "theme" ''
|
||||
curr=$(cat ~/.config/cornflake/current-theme)
|
||||
if [ "$curr" = "prefer-light" ]; then
|
||||
echo 'prefer-dark' > ~/.config/cornflake/current-theme
|
||||
else
|
||||
echo 'prefer-light' > ~/.config/cornflake/current-theme
|
||||
fi
|
||||
${apply-theme-script}
|
||||
''}'';
|
||||
};
|
||||
in
|
||||
{
|
||||
xdg.desktopEntries = {
|
||||
theme-switcher = desktopEntry;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user