From 69aaea8526d0844173d56470beea65f80cf1c929 Mon Sep 17 00:00:00 2001 From: Cookiez Date: Tue, 17 Feb 2026 16:21:12 +0100 Subject: [PATCH] KDE Power profiles are now managed by a separate file, so it is easier to select between them without changing theme. --- modules/packages/essentials.nix | 1 + plasma/home.nix | 8 +-- plasma/plasma.nix | 5 +- plasma/{themes => settings}/common.nix | 21 ++++---- plasma/{themes => settings}/desktop.nix | 61 ++--------------------- plasma/{themes => settings}/laptop.nix | 47 ------------------ plasma/settings/powerProfile.nix | 65 +++++++++++++++++++++++++ 7 files changed, 87 insertions(+), 121 deletions(-) rename plasma/{themes => settings}/common.nix (98%) rename plasma/{themes => settings}/desktop.nix (68%) rename plasma/{themes => settings}/laptop.nix (77%) create mode 100644 plasma/settings/powerProfile.nix diff --git a/modules/packages/essentials.nix b/modules/packages/essentials.nix index b935b46..790e590 100644 --- a/modules/packages/essentials.nix +++ b/modules/packages/essentials.nix @@ -44,5 +44,6 @@ samba kdePackages.ksshaskpass ntfs3g + appimage-run ]; } diff --git a/plasma/home.nix b/plasma/home.nix index e063a74..54392fa 100644 --- a/plasma/home.nix +++ b/plasma/home.nix @@ -2,9 +2,9 @@ { imports = [ - ./themes/common.nix + ./settings/common.nix + ./settings/powerProfile.nix ] - ++ lib.optionals (plasmaTheme == "laptop") [ ./themes/laptop.nix ] - ++ lib.optionals (plasmaTheme == "desktop") [ ./themes/desktop.nix ]; - + ++ lib.optionals (plasmaTheme == "laptop") [ ./settings/laptop.nix ] + ++ lib.optionals (plasmaTheme == "desktop") [ ./settings/desktop.nix ]; } diff --git a/plasma/plasma.nix b/plasma/plasma.nix index b4de23b..940de14 100644 --- a/plasma/plasma.nix +++ b/plasma/plasma.nix @@ -10,7 +10,8 @@ let ''; }; - plasmaTheme = "desktop"; #Possible values are "laptop" or "desktop" + plasmaTheme = "desktop"; #Possible values are "laptop" or "desktop" + powerProfile = "laptop"; #Possible values are "laptop" or "desktop" in { imports = @@ -21,7 +22,7 @@ in # Pass the variable to home-manager home-manager.extraSpecialArgs = { - inherit plasmaTheme; + inherit plasmaTheme powerProfile; }; home-manager.sharedModules = [ diff --git a/plasma/themes/common.nix b/plasma/settings/common.nix similarity index 98% rename from plasma/themes/common.nix rename to plasma/settings/common.nix index 3820681..2858f27 100644 --- a/plasma/themes/common.nix +++ b/plasma/settings/common.nix @@ -3,6 +3,7 @@ programs = { plasma = { enable = true; + overrideConfig = true; shortcuts = { # ActivityManager = { # switch-to-activity-0f8d8349-5b1b-4b77-bfa5-22829bfaf459 = [ ]; @@ -31,16 +32,16 @@ # mic_mute = ["Microphone Mute" "Meta+Volume Mute"]; # mute = "Volume Mute"; # }; - kmserver = { - "Halt Without Confirmation" = [ ]; - "Lock Session" = ["Meta+L" "Screensaver"]; - "Log Out" = "Ctrl+Alt+Del"; - "Log Out Without Confirmation" = [ ]; - LogOut = [ ]; - Reboot = [ ]; - "Reboot Without Confirmation" = [ ]; - "Shut Down" = [ ]; - }; +# kmserver = { +# "Halt Without Confirmation" = [ ]; +# "Lock Session" = ["Meta+L" "Screensaver"]; +# "Log Out" = "Ctrl+Alt+Del"; +# "Log Out Without Confirmation" = [ ]; +# LogOut = [ ]; +# Reboot = [ ]; +# "Reboot Without Confirmation" = [ ]; +# "Shut Down" = [ ]; +# }; kwin = { # "Activate Window Demanding Attention" = "Meta+Ctrl+A"; Cube = "Meta+C"; diff --git a/plasma/themes/desktop.nix b/plasma/settings/desktop.nix similarity index 68% rename from plasma/themes/desktop.nix rename to plasma/settings/desktop.nix index 97e01fd..12f0be8 100644 --- a/plasma/themes/desktop.nix +++ b/plasma/settings/desktop.nix @@ -84,14 +84,6 @@ }; }; } -# { -# name = "org.kde.plasma.battery"; -# config = { -# General = { -# showPercentage = true; -# }; -# }; -# } { name = "org.kde.plasma.digitalclock"; config = { @@ -105,56 +97,9 @@ } ]; - powerdevil = { - # On AC power (plugged in): Minimal power saving - AC = { - powerProfile = "performance"; - #turnOffDisplay.idleTimeout = 900; # 15 min idle - autoSuspend = { - action = "nothing"; - }; - dimDisplay.enable = false; - turnOffDisplay.idleTimeout = "never"; - }; - - # Normal battery: Balanced saving - battery = { - powerProfile = "performance"; - #turnOffDisplay.idleTimeout = 300; # 5 min - autoSuspend = { - action = "nothing"; - }; - whenLaptopLidClosed = "sleep"; - dimDisplay.enable = false; - turnOffDisplay.idleTimeout = "never"; - }; - - # Low battery (e.g., <10%): Critical actions - lowBattery = { - powerProfile = "performance"; - autoSuspend = { - action = "sleep"; - idleTimeout = 300; # 5 min idle - }; - whenLaptopLidClosed = "sleep"; - dimDisplay = { - idleTimeout = 60; - }; - displayBrightness = 30; #Go to 30% display Brightness - turnOffDisplay.idleTimeout = 120; - }; - - # Thresholds for "lowBattery" state - batteryLevels = { - lowLevel = 10; - criticalLevel = 5; - criticalAction = "sleep"; - }; - }; - workspace = { - theme = "WhiteSur-dark"; - colorScheme = "Win11OSDark"; + theme = "WhiteSur-dark"; + colorScheme = "Win11OSDark"; cursor = { theme = "Win10OS-cursors"; size = 24; @@ -163,7 +108,7 @@ soundTheme = "ocean"; iconTheme = "We10X"; splashScreen = { - theme = "com.github.yeyushengfan258.Win11OS-dark"; + theme = "fishy"; }; windowDecorations = { library = "org.kde.kwin.aurorae"; diff --git a/plasma/themes/laptop.nix b/plasma/settings/laptop.nix similarity index 77% rename from plasma/themes/laptop.nix rename to plasma/settings/laptop.nix index 6eb5273..c58b823 100644 --- a/plasma/themes/laptop.nix +++ b/plasma/settings/laptop.nix @@ -122,53 +122,6 @@ } ]; - powerdevil = { - # On AC power (plugged in): Minimal power saving - AC = { - powerProfile = "powerSaving"; - #turnOffDisplay.idleTimeout = 900; # 15 min idle - autoSuspend = { - action = "nothing"; - }; - dimDisplay.enable = false; - turnOffDisplay.idleTimeout = "never"; - }; - - # Normal battery: Balanced saving - battery = { - powerProfile = "powerSaving"; - #turnOffDisplay.idleTimeout = 300; # 5 min - autoSuspend = { - action = "nothing"; - }; - whenLaptopLidClosed = "sleep"; - dimDisplay.enable = false; - turnOffDisplay.idleTimeout = "never"; - }; - - # Low battery (e.g., <10%): Critical actions - lowBattery = { - powerProfile = "powerSaving"; - autoSuspend = { - action = "sleep"; - idleTimeout = 300; # 5 min idle - }; - whenLaptopLidClosed = "sleep"; - dimDisplay = { - idleTimeout = 60; - }; - displayBrightness = 30; #Go to 30% display Brightness - turnOffDisplay.idleTimeout = 120; - }; - - # Thresholds for "lowBattery" state - batteryLevels = { - lowLevel = 10; - criticalLevel = 5; - criticalAction = "sleep"; - }; - }; - workspace = { theme = "WhiteSur-dark"; colorScheme = "BreezeDark"; diff --git a/plasma/settings/powerProfile.nix b/plasma/settings/powerProfile.nix new file mode 100644 index 0000000..6cf8ea3 --- /dev/null +++ b/plasma/settings/powerProfile.nix @@ -0,0 +1,65 @@ +{pkgs, inputs, username, project, powerProfile, ...}: +let + profiles = { + laptop = { + AC.powerProfile = "powerSaving"; + battery.powerProfile = "powerSaving"; + lowBattery.powerProfile = "powerSaving"; + }; + desktop = { + AC.powerProfile = "performance"; + battery.powerProfile = "performance"; + lowBattery.powerProfile = "performance"; + }; + }; + + selectedProfile = profiles.${powerProfile}; +in +{ + programs = { + plasma = { + overrideConfig = true; + + powerdevil = { + AC = { + powerProfile = selectedProfile.AC.powerProfile; + autoSuspend = { + action = "nothing"; + }; + dimDisplay.enable = false; + turnOffDisplay.idleTimeout = "never"; + }; + + battery = { + powerProfile = selectedProfile.battery.powerProfile; + autoSuspend = { + action = "nothing"; + }; + whenLaptopLidClosed = "sleep"; + dimDisplay.enable = false; + turnOffDisplay.idleTimeout = "never"; + }; + + lowBattery = { + powerProfile = selectedProfile.lowBattery.powerProfile; + autoSuspend = { + action = "sleep"; + idleTimeout = 300; + }; + whenLaptopLidClosed = "sleep"; + dimDisplay = { + idleTimeout = 60; + }; + displayBrightness = 30; + turnOffDisplay.idleTimeout = 120; + }; + + batteryLevels = { + lowLevel = 10; + criticalLevel = 5; + criticalAction = "sleep"; + }; + }; + }; + }; +}