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.
dpiAware = mkOption {
default = false;
type = types.bool;
};
# The key used for system-related shortcuts.
sysctrl = mkOption {
default = "print";
type = types.str;
};
# Keyboard options.
keyboard = mkOption {
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 = mkOption {
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" = {
binding = "${config.setting.sysctrl}z";
binding = "printz";
command = "systemctl suspend -i";
name = "System Sleep";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2" = {
binding = "${config.setting.sysctrl}x";
binding = "printx";
command = "systemctl poweroff -i";
name = "System Poweroff";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3" = {
binding = "${config.setting.sysctrl}c";
binding = "printc";
command = "systemctl reboot -i";
name = "System Reboot";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4" = {
binding = "${config.setting.sysctrl}p";
binding = "printp";
command = "powersave toggle";
name = "Toggle Powersave";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5" = {
binding = "${config.setting.sysctrl}l";
binding = "printl";
command = "powerlimit toggle";
name = "Toggle Powerlimit";
};

View file

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

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: {
{ pkgs, ... }: {
file = (pkgs.formats.ini {}).generate "KeydDrgConfig" {
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)";
@ -26,7 +26,7 @@
"alt.w" = "macro(enter 10ms r enter)";
"alt.x" = "macro(enter 10ms > space H e r e space < 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" {
"jetbrains-*" = {
"alt./" = "C-/";
@ -16,7 +16,7 @@
"alt.q" = "A-left";
"alt.r" = "S-f10";
"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.w" = "C-S-A-t";
"alt.x" = "C-f4";

View file

@ -6,7 +6,7 @@ in {
anchor = "top-center";
background-color = "#${config.style.color.bg.dark}${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}";
height = 120;
icons = 0;

View file

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

View file

@ -38,7 +38,7 @@
}
# 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.
exec swaykbdd

View file

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

View file

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

View file

@ -1,6 +1,6 @@
{ config, ... }: {
{ ... }: {
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"
'';

View file

@ -55,7 +55,7 @@
shown_boxes = "cpu mem net proc"
#* 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",
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.

View file

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

View file

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

View file

@ -1,4 +1,4 @@
{ lib, ... }: {
{ ... }: {
imports = [
./Filesystem.nix
];
@ -24,4 +24,12 @@
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;
};
};
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;
};
};
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;
};
};
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.
capslock = "overload(control, esc)"; # Ctrl/esc combo.
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.
rightcontrol = "layer(layer_control)"; # Media and other controls.
rightshift = "backspace"; # Backspace.