Waybar : Add temperature.

This commit is contained in:
Dmitry Voronin 2024-08-20 20:24:43 +03:00
parent 5f86b85dda
commit a3d777256e
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
19 changed files with 86 additions and 113 deletions

View file

@ -17,44 +17,12 @@
}; };
}; };
# Default browser settings.
browser = mkOption {
default = { };
type = types.submodule {
options = {
bin = mkOption {
default = "firefox-esr";
type = types.str;
};
};
};
};
# Terminal settings.
terminal = mkOption {
default = { };
type = types.submodule {
options = {
bin = mkOption {
default = "foot";
type = types.str;
};
};
};
};
# Whether to use Dpi-aware setting in supported apps. # Whether to use Dpi-aware setting in supported apps.
dpiAware = mkOption { dpiAware = mkOption {
default = false; default = false;
type = types.bool; type = types.bool;
}; };
# The key used for system-related shortcuts.
sysctrl = mkOption {
default = "print";
type = types.str;
};
# Keyboard options. # Keyboard options.
keyboard = mkOption { keyboard = mkOption {
default = { }; default = { };
@ -72,57 +40,6 @@
}; };
}; };
# Settings related to different refreshes, like top apps.
refresh = mkOption {
default = { };
type = types.submodule {
options = {
top = mkOption {
default = 2000;
type = types.int;
};
};
};
};
# Configure steps for different actions.
step = mkOption {
default = { };
type = types.submodule {
options = {
brightness = mkOption {
default = 5;
type = types.int;
};
volume = mkOption {
default = 5;
type = types.int;
};
media = mkOption {
default = 10;
type = types.int;
};
};
};
};
# Specify timeouts.
timeout = mkOption {
default = { };
type = types.submodule {
options = {
popup = mkOption {
default = 5000;
type = types.int;
};
keyd = mkOption {
default = 150;
type = types.int;
};
};
};
};
# Zapret params. # Zapret params.
zapret = mkOption { zapret = mkOption {
default = {}; default = {};
@ -135,5 +52,29 @@
}; };
}; };
}; };
# CPU configurations.
cpu = mkOption {
default = {};
type = types.submodule {
options = {
hwmon = mkOption {
default = {};
type = types.submodule {
options = {
path = mkOption {
default = "";
type = types.str;
};
file = mkOption {
default = "";
type = types.str;
};
};
};
};
};
};
};
}; };
} }

View file

@ -82,31 +82,31 @@ in {
}; };
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = { "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
binding = "${config.setting.sysctrl}z"; binding = "printz";
command = "systemctl suspend -i"; command = "systemctl suspend -i";
name = "System Sleep"; name = "System Sleep";
}; };
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2" = { "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2" = {
binding = "${config.setting.sysctrl}x"; binding = "printx";
command = "systemctl poweroff -i"; command = "systemctl poweroff -i";
name = "System Poweroff"; name = "System Poweroff";
}; };
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3" = { "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3" = {
binding = "${config.setting.sysctrl}c"; binding = "printc";
command = "systemctl reboot -i"; command = "systemctl reboot -i";
name = "System Reboot"; name = "System Reboot";
}; };
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4" = { "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4" = {
binding = "${config.setting.sysctrl}p"; binding = "printp";
command = "powersave toggle"; command = "powersave toggle";
name = "Toggle Powersave"; name = "Toggle Powersave";
}; };
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5" = { "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5" = {
binding = "${config.setting.sysctrl}l"; binding = "printl";
command = "powerlimit toggle"; command = "powerlimit toggle";
name = "Toggle Powerlimit"; name = "Toggle Powerlimit";
}; };

View file

@ -9,7 +9,7 @@ in {
lines = 20; lines = 20;
prompt = "\"\""; prompt = "\"\"";
show-actions = "yes"; show-actions = "yes";
terminal = config.setting.terminal.bin; terminal = "foot";
width = 40; width = 40;
# list-executables-in-path = "no"; # list-executables-in-path = "no";
}; };

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { { pkgs, ... }: {
file = (pkgs.formats.ini {}).generate "KeydDrgConfig" { file = (pkgs.formats.ini {}).generate "KeydDrgConfig" {
steam-app-548430 = { steam-app-548430 = {
"alt.1" = "macro(enter 10ms L e t ' s 10ms space d o 10ms space t h i s 10ms space T e x a s 10ms space s t y l e ! 10ms enter)"; "alt.1" = "macro(enter 10ms L e t ' s 10ms space d o 10ms space t h i s 10ms space T e x a s 10ms space s t y l e ! 10ms enter)";
@ -26,7 +26,7 @@
"alt.w" = "macro(enter 10ms r enter)"; "alt.w" = "macro(enter 10ms r enter)";
"alt.x" = "macro(enter 10ms > space H e r e space < enter)"; "alt.x" = "macro(enter 10ms > space H e r e space < enter)";
"alt.z" = "macro(enter 10ms < space L e f t enter)"; "alt.z" = "macro(enter 10ms < space L e f t enter)";
leftshift = "timeout(leftcontrol, ${toString config.setting.timeout.keyd}, leftshift)"; leftshift = "timeout(leftcontrol, 150, leftshift)";
}; };
}; };
} }

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { { pkgs, ... }: {
file = (pkgs.formats.ini {}).generate "KeydJetbrainsConfig" { file = (pkgs.formats.ini {}).generate "KeydJetbrainsConfig" {
"jetbrains-*" = { "jetbrains-*" = {
"alt./" = "C-/"; "alt./" = "C-/";
@ -16,7 +16,7 @@
"alt.q" = "A-left"; "alt.q" = "A-left";
"alt.r" = "S-f10"; "alt.r" = "S-f10";
"alt.s" = "C-A-s"; "alt.s" = "C-A-s";
"alt.tab" = "timeout(f8, ${toString config.setting.timeout.keyd}, macro2(0, 0, f7))"; "alt.tab" = "timeout(f8, 150, macro2(0, 0, f7))";
"alt.v" = "C-q"; "alt.v" = "C-q";
"alt.w" = "C-S-A-t"; "alt.w" = "C-S-A-t";
"alt.x" = "C-f4"; "alt.x" = "C-f4";

View file

@ -6,7 +6,7 @@ in {
anchor = "top-center"; anchor = "top-center";
background-color = "#${config.style.color.bg.dark}${alpha}"; background-color = "#${config.style.color.bg.dark}${alpha}";
border-color = "#${config.style.color.border}${alpha}"; border-color = "#${config.style.color.border}${alpha}";
default-timeout = config.setting.timeout.popup; default-timeout = 5000;
font = "${config.style.font.serif.name} ${toString config.style.font.size.popup}"; font = "${config.style.font.serif.name} ${toString config.style.font.size.popup}";
height = 120; height = 120;
icons = 0; icons = 0;

View file

@ -1,5 +1,5 @@
{ config, ... }: let { config, ... }: let
step = config.setting.step.brightness; step = 5;
in { in {
text = '' text = ''
bindsym XF86MonBrightnessDown exec light -U ${toString step} bindsym XF86MonBrightnessDown exec light -U ${toString step}

View file

@ -38,7 +38,7 @@
} }
# Hide mouse cursor after a period of inactivity. # Hide mouse cursor after a period of inactivity.
seat seat0 hide_cursor ${toString config.setting.timeout.popup} seat seat0 hide_cursor 5000
# Per-window languages. # Per-window languages.
exec swaykbdd exec swaykbdd

View file

@ -1,6 +1,6 @@
{ config, ... }: let { ... }: let
step_volume = config.setting.step.volume; step_volume = 5;
step_music = config.setting.step.media; step_music = 10;
in { in {
text = '' text = ''
bindsym --to-code XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +${toString step_volume}%' bindsym --to-code XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +${toString step_volume}%'

View file

@ -1,5 +1,5 @@
{ config, ... }: let { ... }: let
mod = config.setting.sysctrl; mod = "print";
in { in {
text = '' text = ''
bindsym ${mod} input * xkb_switch_layout 0 bindsym ${mod} input * xkb_switch_layout 0

View file

@ -1,6 +1,6 @@
{ config, ... }: { { ... }: {
text = '' text = ''
set $term ${config.setting.terminal.bin} set $term foot
bindsym --to-code $mod+Escape exec $term -e bash -i -c "tmux new-session -A -s $USER; bash -i" bindsym --to-code $mod+Escape exec $term -e bash -i -c "tmux new-session -A -s $USER; bash -i"
''; '';

View file

@ -55,7 +55,7 @@
shown_boxes = "cpu mem net proc" shown_boxes = "cpu mem net proc"
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs. #* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
update_ms = ${toString config.setting.refresh.top} update_ms = 2000
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct", #* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly. #* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.

View file

@ -30,7 +30,7 @@ in {
"battery" "battery"
"custom/powerlimit" "custom/powerlimit"
"cpu" "cpu"
# "temperature" "temperature"
"memory" "memory"
"custom/powersave" "custom/powersave"
"custom/display" "custom/display"
@ -81,7 +81,7 @@ in {
on-click-right = "powerlimit toggle"; on-click-right = "powerlimit toggle";
}; };
pulseaudio = { pulseaudio = {
scroll-step = config.setting.step.volume; scroll-step = 5;
format = "{volume}% {icon}"; format = "{volume}% {icon}";
format-muted = "󰸈"; format-muted = "󰸈";
format-icons = { format-icons = {
@ -108,26 +108,29 @@ in {
cpu = { cpu = {
format = "{usage}% ({load})"; format = "{usage}% ({load})";
interval = refreshInterval; interval = refreshInterval;
on-click = "${config.setting.terminal.bin} -e bash -c btop"; on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle"; on-click-right = "powersave toggle";
tooltip = false; tooltip = false;
}; };
memory = { memory = {
format = "{percentage}%"; format = "{percentage}%";
interval = refreshInterval; interval = refreshInterval;
on-click = "${config.setting.terminal.bin} -e bash -c btop"; on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle"; on-click-right = "powersave toggle";
}; };
temperature = { temperature = {
format = "{temperatureC}°C"; format = "{temperatureC}°C";
hwmon-path-abs = "${config.setting.cpu.hwmon.path}";
input-filename = "${config.setting.cpu.hwmon.file}";
interval = refreshInterval; interval = refreshInterval;
on-click = "${config.setting.terminal.bin} -e bash -c btop"; on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle"; on-click-right = "powersave toggle";
tooltip = false;
}; };
"custom/powersave" = { "custom/powersave" = {
exec = "powersave waybar"; exec = "powersave waybar";
interval = refreshInterval; interval = refreshInterval;
on-click = "${config.setting.terminal.bin} -e bash -c btop"; on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle"; on-click-right = "powersave toggle";
}; };
"custom/display" = { "custom/display" = {

View file

@ -30,7 +30,7 @@
browser = [{ browser = [{
desc = "Browser"; desc = "Browser";
orphan = true; orphan = true;
run = openWith config.setting.browser.bin; run = openWith "firefox-esr";
}]; }];
text = [{ text = [{
desc = "Text"; desc = "Text";

View file

@ -1,4 +1,4 @@
{ lib, ... }: { { ... }: {
imports = [ imports = [
./Filesystem.nix ./Filesystem.nix
]; ];
@ -24,4 +24,12 @@
gaming.enable = true; gaming.enable = true;
}; };
}; };
setting = {
cpu.hwmon = {
path = "/sys/devices/platform/coretemp.0/hwmon";
file = "temp1_input";
};
};
} }

View file

@ -32,4 +32,11 @@
gaming.enable = true; gaming.enable = true;
}; };
}; };
setting = {
cpu.hwmon = {
path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon";
file = "temp1_input";
};
};
} }

View file

@ -33,4 +33,11 @@
desktop.enable = true; desktop.enable = true;
}; };
}; };
setting = {
cpu.hwmon = {
path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon";
file = "temp1_input";
};
};
} }

View file

@ -24,4 +24,11 @@
gaming.enable = true; gaming.enable = true;
}; };
}; };
setting = {
cpu.hwmon = {
path = "/sys/devices/platform/coretemp.0/hwmon";
file = "temp1_input";
};
};
} }

View file

@ -19,7 +19,7 @@ in {
backspace = "delete"; # Delete key on backspace. backspace = "delete"; # Delete key on backspace.
capslock = "overload(control, esc)"; # Ctrl/esc combo. capslock = "overload(control, esc)"; # Ctrl/esc combo.
compose = "layer(layer_number)"; # Number input layer. compose = "layer(layer_number)"; # Number input layer.
esc = "${config.setting.sysctrl}"; # System controls. esc = "print"; # System controls.
leftcontrol = "overload(layer_alternative, leftcontrol)"; # Alternative layer for home, end etc. leftcontrol = "overload(layer_alternative, leftcontrol)"; # Alternative layer for home, end etc.
rightcontrol = "layer(layer_control)"; # Media and other controls. rightcontrol = "layer(layer_control)"; # Media and other controls.
rightshift = "backspace"; # Backspace. rightshift = "backspace"; # Backspace.