moved color scheme swap scripts to gnome and kde modules respectively

gnome/kde: nixify cs adjustment scripts
This commit is contained in:
Aly Raffauf 2024-05-23 23:21:23 -04:00
parent fcc8f9980e
commit 3c2ed253ff
3 changed files with 51 additions and 49 deletions

View file

@ -4,34 +4,7 @@
lib,
pkgs,
...
}: let
cs-adjuster = pkgs.writeShellScriptBin "cs-adjuster" ''
# Get current color scheme
color_scheme=$(gsettings get org.gnome.desktop.interface color-scheme)
# Toggle between light and dark color schemes
if [ "$color_scheme" == "'default'" ] || [ "$color_scheme" == "'prefer-light'" ]; then
color_scheme="'prefer-dark'"
else
color_scheme="'prefer-light'"
fi
# Apply the updated color scheme
gsettings set org.gnome.desktop.interface color-scheme $color_scheme
'';
cs-adjuster-plasma = pkgs.writeShellScriptBin "cs-adjuster-plasma" ''
# Query the Desktop Portal Service for the current color scheme
color_scheme=$(qdbus org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read org.freedesktop.appearance color-scheme)
# Check the color scheme and apply the appropriate look and feel
if [ "$color_scheme" = "1" ]; then
plasma-apply-lookandfeel -a org.kde.breeze.desktop
else
plasma-apply-lookandfeel -a org.kde.breezedark.desktop
fi
'';
in {
}: {
imports = [
./disko.nix
./hardware-configuration.nix # Include the results of the hardware scan.
@ -49,8 +22,6 @@ in {
networking.hostName = "petalburg"; # Define your hostname.
environment.systemPackages = [cs-adjuster cs-adjuster-plasma];
alyraffauf = {
system = {
plymouth.enable = true;

View file

@ -3,7 +3,22 @@
lib,
config,
...
}: {
}: let
gnomeCsAdjuster = pkgs.writeShellScriptBin "gnome-cs-adjuster" ''
# Get current color scheme
color_scheme=$(${lib.getExe' pkgs.glib "gsettings"} get org.gnome.desktop.interface color-scheme)
# Toggle between light and dark color schemes
if [ "$color_scheme" == "'default'" ] || [ "$color_scheme" == "'prefer-light'" ]; then
color_scheme="'prefer-dark'"
else
color_scheme="'prefer-light'"
fi
# Apply the updated color scheme
${lib.getExe' pkgs.glib "gsettings"} set org.gnome.desktop.interface color-scheme $color_scheme
'';
in {
imports = [
# Include X settings.
./fprintdFix.nix
@ -16,16 +31,18 @@
};
config = lib.mkIf config.alyraffauf.desktop.gnome.enable {
environment.systemPackages = with pkgs; [
gnomeExtensions.appindicator
gnomeExtensions.blur-my-shell
gnomeExtensions.gsconnect
gnomeExtensions.light-shell
gnomeExtensions.night-theme-switcher
gnomeExtensions.noannoyance-fork
gnomeExtensions.tailscale-status
gnomeExtensions.tiling-assistant
];
environment.systemPackages = with pkgs;
[
gnomeExtensions.appindicator
gnomeExtensions.blur-my-shell
gnomeExtensions.gsconnect
gnomeExtensions.light-shell
gnomeExtensions.night-theme-switcher
gnomeExtensions.noannoyance-fork
gnomeExtensions.tailscale-status
gnomeExtensions.tiling-assistant
]
++ [gnomeCsAdjuster];
# Enable keyring support for KDE apps in GNOME.
security.pam.services.gdm.enableKwallet = true;

View file

@ -3,7 +3,19 @@
lib,
config,
...
}: {
}: let
plasmaCsAdjuster = pkgs.writeShellScriptBin "plasma-cs-adjuster" ''
# Query the Desktop Portal Service for the current color scheme
color_scheme=$(${lib.getExe' pkgs.kdePackages.qttools "qdbus"} org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read org.freedesktop.appearance color-scheme)
# Check the color scheme and apply the appropriate look and feel
if [ "$color_scheme" = "1" ]; then
${lib.getExe' pkgs.kdePackages.plasma-workspace "plasma-apply-lookandfeel"} -a org.kde.breeze.desktop
else
${lib.getExe' pkgs.kdePackages.plasma-workspace "plasma-apply-lookandfeel"} -a org.kde.breezedark.desktop
fi
'';
in {
options = {
alyraffauf.desktop.plasma.enable =
lib.mkEnableOption "Enable plasma desktop session.";
@ -21,13 +33,15 @@
};
};
environment.systemPackages = with pkgs; [
kdePackages.kate
kdePackages.kimageformats
kdePackages.kio-gdrive
kdePackages.sddm-kcm
maliit-keyboard
];
environment.systemPackages = with pkgs;
[
kdePackages.kate
kdePackages.kimageformats
kdePackages.kio-gdrive
kdePackages.sddm-kcm
maliit-keyboard
]
++ [plasmaCsAdjuster];
programs.kdeconnect.enable = true;
# nixpkgs.config.firefox.enablePlasmaBrowserIntegration = true;