From 8229f209754a19497d55d11e5b93fb59a4d5f52d Mon Sep 17 00:00:00 2001 From: Doloro1978 Date: Fri, 13 Mar 2026 10:24:07 +0000 Subject: [PATCH] gihcomit --- config/hosts/aspects/doloro-laptop/host.nix | 16 +++++- config/modules/power-management/tdp.nix | 51 +++++++++++++++++++ .../quickshell/quickshell/Workspaces.qml | 10 ++-- 3 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 config/modules/power-management/tdp.nix diff --git a/config/hosts/aspects/doloro-laptop/host.nix b/config/hosts/aspects/doloro-laptop/host.nix index 24b6e13..6ef12be 100644 --- a/config/hosts/aspects/doloro-laptop/host.nix +++ b/config/hosts/aspects/doloro-laptop/host.nix @@ -12,6 +12,20 @@ modules.tuigreet modules.fonts + (modules.tdp { + batt = { + cpu = { + long-term = 10; + short-term = 15; + }; + }; + ac = { + cpu = { + long-term = 120; + short-term = 120; + }; + }; + }) ]; nixos = { pkgs, config, ... }: @@ -20,7 +34,7 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; # boot.kernelPackages = pkgs.linuxPackages_6_12; # Hibernate works on 6.12 but not on latest - boot.kernelPackages = pkgs.linuxPackages_zen; # Unpinned the linux version for now.. as i am not using hibernate that often + boot.kernelPackages = pkgs.linuxPackages_latest; # Unpinned the linux version for now.. as i am not using hibernate that often networking.hostName = "doloro-nixos-laptop"; # Define your hostname. security.rtkit.enable = true; diff --git a/config/modules/power-management/tdp.nix b/config/modules/power-management/tdp.nix new file mode 100644 index 0000000..e4232dc --- /dev/null +++ b/config/modules/power-management/tdp.nix @@ -0,0 +1,51 @@ +{ modules, den, ... }: +{ + modules.tdp = settings: { + nixos = + { pkgs, ... }: + let + batt-tdp = pkgs.writeShellScript "batt-cpu-tdp" '' + ${pkgs.powercap}/bin/powercap-set intel-rapl -z 0 -c 0 -l ${ + toString (settings.batt.cpu.long-term * 1000000) + } + ${pkgs.powercap}/bin/powercap-set intel-rapl -z 0 -c 0 -l ${ + toString (settings.batt.cpu.short-term * 1000000) + } + ''; + ac-tdp = pkgs.writeShellScript "ac-cpu-tdp" '' + ${pkgs.powercap}/bin/powercap-set intel-rapl -z 0 -c 0 -l ${ + toString (settings.ac.cpu.long-term * 1000000) + } + ${pkgs.powercap}/bin/powercap-set intel-rapl -z 0 -c 0 -l ${ + toString (settings.ac.cpu.short-term * 1000000) + } + ''; + in + { + systemd.services.tdp-on-batt = { + enable = true; + before = [ "battery.target" ]; + + serviceConfig = { + Type = "oneshot"; + ExecStart = "${batt-tdp}"; + RemainAfterExit = true; + }; + wantedBy = [ "battery.target" ]; + partOf = [ "battery.target" ]; + }; + systemd.services.tdp-on-ac = { + enable = true; + before = [ "ac.target" ]; + + serviceConfig = { + Type = "oneshot"; + ExecStart = "${ac-tdp}"; + RemainAfterExit = true; + }; + wantedBy = [ "ac.target" ]; + partOf = [ "ac.target" ]; + }; + }; + }; +} diff --git a/config/modules/quickshell/quickshell/Workspaces.qml b/config/modules/quickshell/quickshell/Workspaces.qml index 2bd6878..33d9ddc 100644 --- a/config/modules/quickshell/quickshell/Workspaces.qml +++ b/config/modules/quickshell/quickshell/Workspaces.qml @@ -26,7 +26,7 @@ Item { name: "FOCUSED" PropertyChanges { target: content - width: 10 + implicitWidth: 10 scale: 1 } }, @@ -34,7 +34,7 @@ Item { name: "EXISTS" PropertyChanges { target: content - width: 10 + implicitWidth: 10 scale: 0.85 } }, @@ -42,15 +42,15 @@ Item { name: "NOT" PropertyChanges { target: content - width: 10 + implicitWidth: 10 scale: 0.75 } } ] height: 15 Rectangle { - width: parent.width - height: parent.height + implicitWidth: parent.width + implicitHeight: parent.height radius: 2.5 color: { if (HyprlandHelpers.getHyprlandWorkspaceById(index + 1) != null) {