feat(t14): add power and fan control

This commit is contained in:
steveej 2023-05-25 11:29:46 +02:00
parent acaa6dc4cf
commit 7df87bf0bb
3 changed files with 79 additions and 148 deletions

View file

@ -1,146 +1,6 @@
* {
/* all: unset;*/
border: none; #custom-cputemp {
border-radius: 0; padding: 0 10px;
/* `otf-font-awesome` is required to be installed for icons */ background-color: #f0932b;
/* font matches sway-config.nix */
font-family: "Iosevka Comfy Fixed"; /* TODO: parameterize this? */
font-weight: bold;
font-size: 12px;
min-height: 0;
padding: 0px;
}
window#waybar {
background-color: #111111;
color: #666666;
border-bottom: 2px double #fff;
border-bottom: 2px double #33ccff;
}
/*
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
*/
#workspaces button {
padding: 0px;
margin: 4px;
margin-left: 2px;
margin-right: 2px;
color: #cccccc;
min-width: 25px;
border: 1px solid transparent;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
/*
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
box-shadow: inherit;
border-bottom: 3px solid #ffffff;
}
*/
#workspaces button.current_output {
border-color: #aaa;
border-style: dotted;
color: #ffffff; color: #ffffff;
} }
#workspaces button.focused {
background-color: #aaa;
color: #000000;
border-color: #aaa;
border-style: solid;
}
#workspaces button.focused.current_output {
border-color: #ee00ff;
border-style: solid;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
border-bottom: 1px solid #ffffff;
}
#tray {
background-color: #111111;
}
#clock,
#clock-time,
#battery,
#cpu,
#memory,
#temperature,
#network,
#custom-ppp,
#custom-rog,
#tray,
#mode,
#backlight,
#pulseaudio,
#idle_inhibitor,
#mpd {
/*padding: 2px;*/
padding: 0px;
padding-left: 4px;
padding-right: 4px;
margin: 4px;
margin-right: 6px;
color: #fff;
background-color: #333;
}
#battery {
}
#battery.charging {
color: #26A65B;
}
@keyframes blink {
to {
background-color: #f53c3c;
color: #ffffff;
}
}
#battery.Charging {
color: green;
}
#battery.Discharging {
color: blue;
}
#battery.Discharging.warning {
color: orange;
}
#battery.Discharging.critical {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
/*
label:focus {
background-color: #000000;
}
*/

View file

@ -10,7 +10,8 @@
programs.waybar = { programs.waybar = {
enable = true; enable = true;
package = repoFlake.inputs.nixpkgs-wayland.outputs.packages.${pkgs.stdenv.hostPlatform.system}.waybar; package = repoFlake.inputs.nixpkgs-wayland.outputs.packages.${pkgs.stdenv.hostPlatform.system}.waybar;
# style = pkgs.lib.readFile ./waybar.css; style = pkgs.lib.readFile "${pkgs.waybar.src}/resources/style.css"
+ pkgs.lib.readFile ./waybar.css;
systemd.enable = true; systemd.enable = true;
settings = { settings = {
mainBar = { mainBar = {
@ -44,7 +45,7 @@
"cpu" "cpu"
"memory" "memory"
"temperature" "custom/cputemp"
"custom/fan" "custom/fan"
"battery" "battery"
"pulseaudio" "pulseaudio"
@ -60,19 +61,24 @@
hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input"; hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input";
format = " {temperatureC} °C"; format = " {temperatureC} °C";
}; };
"custom/fan" = {
"custom/cputemp" = {
format = " {}";
exec = "${pkgs.lm_sensors}/bin/sensors | ${pkgs.gawk}/bin/awk '/CPU:/ {print $2}'";
interval = 2;
};
"custom/fan" = {
format = " {} rpm "; format = " {} rpm ";
exec = "${pkgs.lm_sensors}/bin/sensors | ${pkgs.gawk}/bin/awk '/fan1:/ {print $2}'"; exec = "${pkgs.lm_sensors}/bin/sensors | ${pkgs.gawk}/bin/awk '/fan1:/ {print $2}'";
interval = 5; interval = 2;
}; };
battery.format = "🔋 {}%"; battery.format = "🔋 {}%";
pulseaudio = { pulseaudio = {
format = "🔉 {volume}%"; format = "🔉 {volume}%";
# on-click-middle = ''${pkgs.sway}/bin/swaymsg exec "${pkgs.pavucontrol}/bin/pavucontrol"''; # on-click-middle = ''${pkgs.sway}/bin/swaymsg exec "${pkgs.pavucontrol}/bin/pavucontrol"'';
}; };
"clock#date".format = "{:%d %b %Y}";
clock.format = "{:%H:%M %p}"; clock.format = "{:%H:%M %p}";
"clock#date".format = "{:%a, %d %b '%y}";
}; };
}; };
}; };

View file

@ -16,6 +16,71 @@ in {
diskId = "nvme-WD_BLACK_SN850X_4000GB_2227DT443901"; diskId = "nvme-WD_BLACK_SN850X_4000GB_2227DT443901";
}; };
# see https://linrunner.de/tlp/
services.tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_AC = "schedutil";
CPU_SCALING_GOVERNOR_ON_BAT = "schedutil";
CPU_ENERGY_PERF_POLICY_ON_AC="balance_power";
CPU_ENERGY_PERF_POLICY_ON_BAT="power";
SCHED_POWERSAVE_ON_AC="1";
SCHED_POWERSAVE_ON_BAT="1";
CPU_BOOST_ON_AC="0";
CPU_BOOST_ON_BAT="0";
RADEON_DPM_PERF_LEVEL_ON_AC="auto";
RADEON_DPM_PERF_LEVEL_ON_BAT="low";
RADEON_DPM_STATE_ON_AC="balanced";
RADEON_DPM_STATE_ON_BAT="battery";
SOUND_POWER_SAVE_ON_AC="1";
SOUND_POWER_SAVE_ON_BAT="1";
# PLATFORM_PROFILE_ON_AC="low-power";
# PLATFORM_PROFILE_ON_BAT="low-power";
PLATFORM_PROFILE_ON_AC="balanced";
PLATFORM_PROFILE_ON_BAT="low-power";
RUNTIME_PM_ON_AC = "auto";
RUNTIME_PM_ON_BAT = "auto";
PCIE_ASPM_ON_AC="default";
PCIE_ASPM_ON_BAT="powersave";
START_CHARGE_THRESH_BAT0 = "75";
STOP_CHARGE_THRESH_BAT0 = "80";
WOL_DISABLE="Y";
WIFI_PWR_ON_AC="on";
WIFI_PWR_ON_BAT="on";
DEVICES_TO_DISABLE_ON_STARTUP="wwan";
#DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan";
#DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan";
#DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi";
};
};
services.thinkfan = {
enable = true;
levels = [
[0 0 55]
[1 55 65]
[1 65 75]
[3 75 78]
[4 78 80]
[5 80 82]
[6 82 84]
[7 84 86]
["level full-speed" 86 999]
];
};
# boot.initrd.availableKernelModules = stage1Modules; # boot.initrd.availableKernelModules = stage1Modules;
boot.initrd.kernelModules = stage1Modules; boot.initrd.kernelModules = stage1Modules;
} }