nixos/home/desktop/plasma/default.nix
Evie Litherland-Smith 6606da7db7 Tweak power settings and timings
When sleeping enter standby then hibernate

Default autoSuspend action still sleep, except low power which is
direct to hibernate

Reduce idle times for battery and lower power settings
2024-08-25 06:35:15 +01:00

387 lines
10 KiB
Nix

{
config,
lib,
pkgs,
inputs,
fonts,
rc2nix,
accentColourName,
...
}:
{
imports = [
inputs.plasma-manager.homeManagerModules.plasma-manager
../default.nix
./konsole.nix
];
home.packages = [
rc2nix
pkgs.wl-clipboard
(pkgs.papirus-icon-theme.override { color = "violet"; })
];
services.gpg-agent.pinentryPackage = pkgs.pinentry-qt;
programs.plasma = {
enable = true;
overrideConfig = true;
workspace =
let
toCapital = import ../lib/to_capital.nix lib;
in
{
clickItemTo = "open";
theme = "default";
colorScheme = "Breeze${toCapital config.scheme.variant}";
iconTheme = "Papirus-${toCapital config.scheme.variant}";
windowDecorations = {
library = "org.kde.breeze";
theme = "Breeze";
};
cursor = {
inherit (config.home.pointerCursor) size;
theme = config.home.pointerCursor.name;
};
wallpaper = "${../wallpapers/landscapes/tropic_island_day.jpg}";
};
fonts =
let
general = {
family = fonts.sansSerif.name;
pointSize = 12;
};
small = {
inherit (general) family;
pointSize = general.pointSize - 2;
};
fixedWidth = {
family = fonts.monospace.name;
pointSize = 12;
};
in
{
inherit general small fixedWidth;
menu = general;
toolbar = general;
windowTitle = small;
};
hotkeys.commands = {
"launch-terminal" =
let
command = config.programs.plasma.configFile.kdeglobals.General.TerminalApplication.value;
in
{
inherit command;
name = "Launch ${command} emulator";
key = "Ctrl+Alt+T";
};
"launch-emacs" = {
name = "Launch Emacs Client Window";
key = "Meta+Alt+X";
command = "emacsclient -c";
};
};
panels = [
{
height = 32;
lengthMode = "fill";
location = "bottom";
alignment = "center";
hiding = "normalpanel";
floating = true;
widgets = [
{
name = "org.kde.plasma.kickoff";
config.General = {
icon = "nix-snowflake";
primaryActions = "0";
favoritesDisplay = "0";
applicationsDisplay = "1";
pin = "false";
showActionButtonCaptions = "true";
compactMode = "false";
};
}
{
name = "org.kde.plasma.icontasks";
config.General = {
maxStripes = "1";
showToolTips = "true";
launchers = [
"preferred://filemanager"
"applications:emacs.desktop"
];
};
}
{
name = "org.kde.plasma.pager";
config.General = {
showWindowIcons = "true";
showOnlyCurrentScreen = "false";
wrapPage = "true";
};
}
"org.kde.plasma.marginsseparator"
"org.kde.plasma.keyboardindicator"
"org.kde.plasma.cameraindicator"
{
systemTray = {
icons = {
spacing = "small";
scaleToFit = false;
};
};
}
{
digitalClock = {
date = {
enable = true;
format = "isoDate";
position = "besideTime";
};
time = {
format = "24h";
showSeconds = "onlyInTooltip";
};
calendar.showWeekNumbers = true;
};
}
{
name = "org.kde.plasma.userswitcher";
config.General = {
showFace = "true";
showName = "false";
showFullName = "true";
showTechnicalInfo = "true";
};
}
];
}
];
shortcuts = {
ksmserver = {
"Lock Session" = [
"Screensaver"
"Meta+Alt+L"
];
};
kwin = {
"Walk Through Windows of Current Application" = "Alt+`";
"Walk Through Windows of Current Application (Reverse)" = "Alt+¬";
"ToggleMouseClick" = "Meta+*";
"Expose" = "Meta+,";
"Switch Window Down" = "Meta+J";
"Switch Window Left" = "Meta+H";
"Switch Window Right" = "Meta+L";
"Switch Window Up" = "Meta+K";
"Invert" = "Meta+Ctrl+I";
"InvertWindow" = "Meta+Ctrl+U";
"Invert Screen Colors" = [ ];
};
"services/org.kde.konsole.desktop"."_launch" = [ ];
"services/org.kde.krunner.desktop"."_launch" = [
"Meta+Space"
"Search"
"Alt+F2"
];
};
kwin = {
virtualDesktops = {
rows = 1;
number = 4;
};
effects = {
translucency.enable = true;
blur.enable = true;
cube.enable = true;
dimAdminMode.enable = true;
};
};
powerdevil =
let
powerButtonAction = "turnOffScreen";
whenSleepingEnter = "standbyThenHibernate";
whenLaptopLidClosed = "sleep";
in
{
AC = {
inherit powerButtonAction whenSleepingEnter whenLaptopLidClosed;
autoSuspend = {
action = "sleep";
idleTimeout = 7200;
};
dimDisplay = {
enable = true;
idleTimeOut = 300;
};
turnOffDisplay = {
idleTimeout = 1800;
idleTimeoutWhenLocked = 120;
};
};
battery = {
inherit powerButtonAction whenSleepingEnter whenLaptopLidClosed;
autoSuspend = {
action = "sleep";
idleTimeout = 900;
};
dimDisplay = {
enable = true;
idleTimeOut = 120;
};
turnOffDisplay = {
idleTimeout = 300;
idleTimeoutWhenLocked = 60;
};
};
lowBattery = {
inherit powerButtonAction whenSleepingEnter whenLaptopLidClosed;
autoSuspend = {
action = "hibernate";
idleTimeout = 300;
};
dimDisplay = {
enable = true;
idleTimeOut = 60;
};
turnOffDisplay = {
idleTimeout = 120;
idleTimeoutWhenLocked = "immediately";
};
};
};
configFile = {
baloofilerc."Basic Settings"."Indexing-Enabled" = false;
kcminputrc.Keyboard.NumLock = 1;
yakuakerc = {
Dialogs.FirstRun = false;
Window = {
DynamicTabTitles = true;
Height = 80;
Width = 80;
KeepOpen = false;
ShowSystrayIcon = false;
ShowTitleBar = false;
};
};
plasmanotifyrc = {
Notifications = {
NormalAlwaysOnTop = true;
};
};
krunnerrc = {
General = {
ActivateWhenTypingOnDesktop = false;
FreeFloating = true;
};
};
kscreenlockerrc = {
Daemon.Timeout = 15;
Greeter.WallpaperPlugin = "org.kde.potd";
};
klipperrc = {
General = {
SyncClipboards = true;
MaxClipItems = 5;
IgnoreImages = false;
KeepClipboardContents = false;
};
};
kdeglobals = {
General =
let
AccentColor =
let
r = config.scheme."${accentColourName}-rgb-r";
g = config.scheme."${accentColourName}-rgb-g";
b = config.scheme."${accentColourName}-rgb-b";
in
"${r}, ${g}, ${b}";
in
{
inherit AccentColor;
LastUsedCustomAccentColor = AccentColor;
TerminalApplication = if config.programs.alacritty.enable then "alacritty" else "konsole";
TerminalService =
if config.programs.alacritty.enable then "Alacritty.desktop" else "org.kde.konsole.desktop";
};
WM = {
# TODO convert to base16 colours at some point
activeBackground = "227,229,231";
activeBlend = "227,229,231";
activeForeground = "35,38,41";
inactiveBackground = "239,240,241";
inactiveBlend = "239,240,241";
inactiveForeground = "112,125,138";
};
};
breezerc = {
Common = {
OutlineClassButton = true;
OutlineCloseButtone = true;
ShadowSize = "ShadowVeryLarge";
ShadowStrength = "128";
};
Style = {
MenuOpacity = "100";
};
};
dolphinrc = {
ContentDisplay = {
UsePermissionsFormat = "CombinedFormat";
};
General = {
BrowseThroughArchives = true;
OpenNewTabAfterLastTab = true;
RememberOpenedTabs = false;
};
};
kwinrc = {
Plugins = {
frozenappEnabled = false;
mouseclickEnabled = true;
shakecursorEnabled = false;
invertEnabled = true;
};
Windows = {
FocusPolicy = "FocusFollowsMouse";
RollOverDesktops = true;
};
NightColor = {
Active = true;
Mode = "Location";
LatitudeFixed = "51.7";
LongitudeFixed = "-1.2";
};
"Effect-translucency" = {
# Re-enable translucency when I can work out how to apply
# blur to all windows
Inactive = 100;
MoveResize = 100;
Dialogs = 100;
ComboboxPopups = 100;
Menus = 100;
};
"org.kde.kdecoration2" = {
BorderSize = "None";
BorderSizeAuto = "false";
};
"Script-krohnkite" = {
limitTileWidth = true;
screenGapBottom = 5;
screenGapLeft = 5;
screenGapRight = 5;
screenGapTop = 5;
tileLayoutGap = 5;
};
};
};
};
}