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, lib,
pkgs, 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 = [ imports = [
./disko.nix ./disko.nix
./hardware-configuration.nix # Include the results of the hardware scan. ./hardware-configuration.nix # Include the results of the hardware scan.
@ -49,8 +22,6 @@ in {
networking.hostName = "petalburg"; # Define your hostname. networking.hostName = "petalburg"; # Define your hostname.
environment.systemPackages = [cs-adjuster cs-adjuster-plasma];
alyraffauf = { alyraffauf = {
system = { system = {
plymouth.enable = true; plymouth.enable = true;

View file

@ -3,7 +3,22 @@
lib, lib,
config, 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 = [ imports = [
# Include X settings. # Include X settings.
./fprintdFix.nix ./fprintdFix.nix
@ -16,7 +31,8 @@
}; };
config = lib.mkIf config.alyraffauf.desktop.gnome.enable { config = lib.mkIf config.alyraffauf.desktop.gnome.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs;
[
gnomeExtensions.appindicator gnomeExtensions.appindicator
gnomeExtensions.blur-my-shell gnomeExtensions.blur-my-shell
gnomeExtensions.gsconnect gnomeExtensions.gsconnect
@ -25,7 +41,8 @@
gnomeExtensions.noannoyance-fork gnomeExtensions.noannoyance-fork
gnomeExtensions.tailscale-status gnomeExtensions.tailscale-status
gnomeExtensions.tiling-assistant gnomeExtensions.tiling-assistant
]; ]
++ [gnomeCsAdjuster];
# Enable keyring support for KDE apps in GNOME. # Enable keyring support for KDE apps in GNOME.
security.pam.services.gdm.enableKwallet = true; security.pam.services.gdm.enableKwallet = true;

View file

@ -3,7 +3,19 @@
lib, lib,
config, 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 = { options = {
alyraffauf.desktop.plasma.enable = alyraffauf.desktop.plasma.enable =
lib.mkEnableOption "Enable plasma desktop session."; lib.mkEnableOption "Enable plasma desktop session.";
@ -21,13 +33,15 @@
}; };
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs;
[
kdePackages.kate kdePackages.kate
kdePackages.kimageformats kdePackages.kimageformats
kdePackages.kio-gdrive kdePackages.kio-gdrive
kdePackages.sddm-kcm kdePackages.sddm-kcm
maliit-keyboard maliit-keyboard
]; ]
++ [plasmaCsAdjuster];
programs.kdeconnect.enable = true; programs.kdeconnect.enable = true;
# nixpkgs.config.firefox.enablePlasmaBrowserIntegration = true; # nixpkgs.config.firefox.enablePlasmaBrowserIntegration = true;