This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / 2configs / themes.nix
2.3 kB 75 lines
1{ config, lib, pkgs, ... }: let 2 3 switch-theme = pkgs.writers.writeDashBin "switch-theme" '' 4 set -efux 5 if [ "$1" = toggle ]; then 6 if [ "$(${pkgs.coreutils}/bin/cat /var/theme/current_theme)" = dark ]; then 7 ${placeholder "out"}/bin/switch-theme light 8 else 9 ${placeholder "out"}/bin/switch-theme dark 10 fi 11 elif test -e "/etc/themes/$1"; then 12 ${pkgs.coreutils}/bin/mkdir -p /var/theme/config 13 ${pkgs.rsync}/bin/rsync --chown=lass:users -a --delete "/etc/themes/$1/" /var/theme/config/ 14 echo "$1" > /var/theme/current_theme 15 ${pkgs.coreutils}/bin/chown lass:users /var/theme/current_theme 16 ${pkgs.xorg.xrdb}/bin/xrdb -merge /var/theme/config/xresources 17 ${pkgs.procps}/bin/pkill -HUP xsettingsd || : 18 ${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface gtk-theme "$(cat /var/theme/config/gtk-theme)" || : 19 else 20 echo "theme $1 not found" 21 fi 22 ''; 23 24in { 25 systemd.services.xsettingsd = { 26 wantedBy = [ "multi-user.target" ]; 27 after = [ "display-manager.service" ]; 28 environment.DISPLAY = ":0"; 29 serviceConfig = { 30 ExecStart = "${pkgs.xsettingsd}/bin/xsettingsd -c /var/theme/config/xsettings.conf"; 31 User = "lass"; 32 Restart = "always"; 33 RestartSec = "15s"; 34 }; 35 }; 36 systemd.tmpfiles.rules = [ 37 "d /var/theme/ 755 lass users" 38 ]; 39 environment.systemPackages = [ 40 switch-theme 41 pkgs.dracula-theme 42 pkgs.gnome3.adwaita-icon-theme 43 ]; 44 environment.etc = { 45 "themes/light/gtk-theme".text = '' 46 Adwaita 47 ''; 48 "themes/light/xsettings.conf".text = '' 49 Net/ThemeName "Adwaita" 50 ''; 51 "themes/light/xresources".text = '' 52 *background: #ffffff 53 *foreground: #000000 54 ''; 55 "themes/dark/gtk-theme".text = '' 56 Dracula 57 ''; 58 "themes/dark/xsettings.conf".text = '' 59 Net/ThemeName "Dracula" 60 ''; 61 "themes/dark/xresources".text = '' 62 *background: #000000 63 *foreground: #ffffff 64 ''; 65 }; 66 system.activationScripts.theme.text = '' 67 export DISPLAY=:0 68 if test -e /var/theme/current_theme; then 69 ${switch-theme}/bin/switch-theme "$(cat /var/theme/current_theme)" || 70 ${switch-theme}/bin/switch-theme dark 71 else 72 ${switch-theme}/bin/switch-theme dark 73 fi 74 ''; 75}