KDE Power profiles are now managed by a separate file, so it is easier to select between them without changing theme.

This commit is contained in:
2026-02-17 16:21:12 +01:00
parent 48378c963d
commit 69aaea8526
7 changed files with 87 additions and 121 deletions

View File

@ -44,5 +44,6 @@
samba samba
kdePackages.ksshaskpass kdePackages.ksshaskpass
ntfs3g ntfs3g
appimage-run
]; ];
} }

View File

@ -2,9 +2,9 @@
{ {
imports = [ imports = [
./themes/common.nix ./settings/common.nix
./settings/powerProfile.nix
] ]
++ lib.optionals (plasmaTheme == "laptop") [ ./themes/laptop.nix ] ++ lib.optionals (plasmaTheme == "laptop") [ ./settings/laptop.nix ]
++ lib.optionals (plasmaTheme == "desktop") [ ./themes/desktop.nix ]; ++ lib.optionals (plasmaTheme == "desktop") [ ./settings/desktop.nix ];
} }

View File

@ -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 in
{ {
imports = imports =
@ -21,7 +22,7 @@ in
# Pass the variable to home-manager # Pass the variable to home-manager
home-manager.extraSpecialArgs = { home-manager.extraSpecialArgs = {
inherit plasmaTheme; inherit plasmaTheme powerProfile;
}; };
home-manager.sharedModules = [ home-manager.sharedModules = [

View File

@ -3,6 +3,7 @@
programs = { programs = {
plasma = { plasma = {
enable = true; enable = true;
overrideConfig = true;
shortcuts = { shortcuts = {
# ActivityManager = { # ActivityManager = {
# switch-to-activity-0f8d8349-5b1b-4b77-bfa5-22829bfaf459 = [ ]; # switch-to-activity-0f8d8349-5b1b-4b77-bfa5-22829bfaf459 = [ ];
@ -31,16 +32,16 @@
# mic_mute = ["Microphone Mute" "Meta+Volume Mute"]; # mic_mute = ["Microphone Mute" "Meta+Volume Mute"];
# mute = "Volume Mute"; # mute = "Volume Mute";
# }; # };
kmserver = { # kmserver = {
"Halt Without Confirmation" = [ ]; # "Halt Without Confirmation" = [ ];
"Lock Session" = ["Meta+L" "Screensaver"]; # "Lock Session" = ["Meta+L" "Screensaver"];
"Log Out" = "Ctrl+Alt+Del"; # "Log Out" = "Ctrl+Alt+Del";
"Log Out Without Confirmation" = [ ]; # "Log Out Without Confirmation" = [ ];
LogOut = [ ]; # LogOut = [ ];
Reboot = [ ]; # Reboot = [ ];
"Reboot Without Confirmation" = [ ]; # "Reboot Without Confirmation" = [ ];
"Shut Down" = [ ]; # "Shut Down" = [ ];
}; # };
kwin = { kwin = {
# "Activate Window Demanding Attention" = "Meta+Ctrl+A"; # "Activate Window Demanding Attention" = "Meta+Ctrl+A";
Cube = "Meta+C"; Cube = "Meta+C";

View File

@ -84,14 +84,6 @@
}; };
}; };
} }
# {
# name = "org.kde.plasma.battery";
# config = {
# General = {
# showPercentage = true;
# };
# };
# }
{ {
name = "org.kde.plasma.digitalclock"; name = "org.kde.plasma.digitalclock";
config = { 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 = { workspace = {
theme = "WhiteSur-dark"; theme = "WhiteSur-dark";
colorScheme = "Win11OSDark"; colorScheme = "Win11OSDark";
cursor = { cursor = {
theme = "Win10OS-cursors"; theme = "Win10OS-cursors";
size = 24; size = 24;
@ -163,7 +108,7 @@
soundTheme = "ocean"; soundTheme = "ocean";
iconTheme = "We10X"; iconTheme = "We10X";
splashScreen = { splashScreen = {
theme = "com.github.yeyushengfan258.Win11OS-dark"; theme = "fishy";
}; };
windowDecorations = { windowDecorations = {
library = "org.kde.kwin.aurorae"; library = "org.kde.kwin.aurorae";

View File

@ -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 = { workspace = {
theme = "WhiteSur-dark"; theme = "WhiteSur-dark";
colorScheme = "BreezeDark"; colorScheme = "BreezeDark";

View File

@ -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";
};
};
};
};
}