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
kdePackages.ksshaskpass
ntfs3g
appimage-run
];
}

View File

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

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

View File

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

View File

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

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 = {
theme = "WhiteSur-dark";
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";
};
};
};
};
}