106 lines
3.1 KiB
Nix
106 lines
3.1 KiB
Nix
{config, pkgs, ... }:
|
|
{
|
|
services.darkman = {
|
|
enable = true;
|
|
|
|
settings = {
|
|
lat = 33.7490;
|
|
lng = -84.3880;
|
|
};
|
|
|
|
darkModeScripts.gsettings = ''
|
|
${pkgs.glib}/bin/gsettings \
|
|
set org.gnome.desktop.interface color-scheme prefer-dark
|
|
'';
|
|
|
|
lightModeScripts.gsettings = ''
|
|
${pkgs.glib}/bin/gsettings \
|
|
set org.gnome.desktop.interface color-scheme prefer-light
|
|
'';
|
|
};
|
|
home.file."bin/themer.sh" = {
|
|
executable = true;
|
|
text = ''
|
|
#!/usr/bin/env bash
|
|
|
|
set_theme() {
|
|
scheme="$(${pkgs.glib}/bin/gsettings get \
|
|
org.gnome.desktop.interface color-scheme)"
|
|
|
|
if [[ "$scheme" == *dark* ]]; then
|
|
wallpaper="$HOME/media/pics/wall-dark.png"
|
|
fuzzel="$HOME/.config/fuzzel/themes/zenwritten-dark.ini"
|
|
mako="$HOME/.config/mako/themes/zenwritten-dark.conf"
|
|
tmux="$HOME/.config/tmux/themes/zenwritten-dark.conf"
|
|
keys=$'<C-\\><C-n>:silent! let g:light_mode=0 | set background=dark | doautocmd ColorScheme | redraw!<CR>'
|
|
|
|
else
|
|
wallpaper="$HOME/media/pics/wall-light.png"
|
|
fuzzel="$HOME/.config/fuzzel/themes/zenwritten-light.ini"
|
|
mako="$HOME/.config/mako/themes/zenwritten-light.conf"
|
|
tmux="$HOME/.config/tmux/themes/zenwritten-light.conf"
|
|
keys=$'<C-\\><C-n>:silent! let g:light_mode=1 | set background=light | doautocmd ColorScheme | redraw!<CR>'
|
|
fi
|
|
|
|
${pkgs.awww}/bin/awww img "$wallpaper" \
|
|
--transition-type fade \
|
|
--transition-duration 0.4
|
|
|
|
ln -sf "$fuzzel" "$HOME/.config/fuzzel/colors.ini"
|
|
ln -sf "$mako" "$HOME/.config/mako/theme.conf"
|
|
ln -sf "$tmux" $HOME/.config/tmux/theme.conf
|
|
makoctl reload
|
|
tmux source-file ~/.config/tmux/theme.conf
|
|
for sock in "$XDG_RUNTIME_DIR"/nvim.*.0; do
|
|
timeout 1s nvim --server "$sock" --remote-send "$keys" >/dev/null 2>&1 || true
|
|
done
|
|
|
|
}
|
|
|
|
set_theme
|
|
|
|
${pkgs.glib}/bin/gsettings monitor \
|
|
org.gnome.desktop.interface color-scheme |
|
|
while read -r _; do
|
|
set_theme
|
|
done
|
|
'';
|
|
};
|
|
home.file."media/pics/wall-light.png".source = ./wall-light.png;
|
|
home.file."media/pics/wall-dark.png".source = ./wall-dark.png;
|
|
|
|
systemd.user.services.awww = {
|
|
Unit = {
|
|
Description = "Awww wallpaper daemon";
|
|
After = [ "graphical-session.target" ];
|
|
PartOf = [ "graphical-session.target" ];
|
|
};
|
|
|
|
Service = {
|
|
ExecStart = "${pkgs.awww}/bin/awww-daemon";
|
|
Restart = "on-failure";
|
|
};
|
|
|
|
Install = {
|
|
WantedBy = [ "graphical-session.target" ];
|
|
};
|
|
};
|
|
|
|
systemd.user.services.themer = {
|
|
Unit = {
|
|
Description = "gsettings monitor to swap light/dark themes";
|
|
After = [ "graphical-session.target" "awww.service"];
|
|
Requires = [ "awww.service" ];
|
|
PartOf = [ "graphical-session.target" ];
|
|
};
|
|
|
|
Service = {
|
|
ExecStart = "/home/aselimov/bin/themer.sh";
|
|
Restart = "always";
|
|
};
|
|
|
|
Install = {
|
|
WantedBy = [ "graphical-session.target" ];
|
|
};
|
|
};
|
|
}
|