waybar redo

This commit is contained in:
Noa Aarts 2025-03-23 22:46:00 +01:00
parent 0b21647b2b
commit f5a8935507
Signed by: noa
GPG key ID: 1850932741EFF672
14 changed files with 223 additions and 72 deletions

View file

@ -37,6 +37,7 @@
base16 = "#d6acff"; # bright blue base16 = "#d6acff"; # bright blue
base17 = "#ff92df"; # bright purple base17 = "#ff92df"; # bright purple
taskbarText = base04; taskbarText = base04;
taskbarBackground = base10;
background_paper = "#000000"; background_paper = "#000000";
foreground_paper = "#26052e"; foreground_paper = "#26052e";
}; };

View file

@ -194,12 +194,13 @@ in
"custom/spotify" "custom/spotify"
]; ];
right = [ right = [
"custom/vpn" "custom/bluetooth"
"wireplumber" "battery"
"network" "network"
"wireplumber"
"cpu" "cpu"
"memory" "memory"
"custom/poweroff" "temperature"
]; ];
}; };
enable = lib.mkDefault enableGraphical; enable = lib.mkDefault enableGraphical;

View file

@ -0,0 +1,79 @@
{
lib,
config,
...
}:
let
name = "battery";
in
{
options.modules.waybar.modules = import ./addname.nix lib name;
options.modules.waybar.enabled.${name} = {
enable = lib.mkEnableOption "enable ${name} waybar module";
};
config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar = {
settings.mainBar.${name} = {
states = {
full = 100;
good = 99;
warning = 30;
critical = 15;
};
format = "{capacity}% {icon}";
format-charging = "{capacity}% {icon}";
format-plugged = "{capacity}% {icon}";
format-alt = "{time} {icon}";
interval = 1;
format-full = "";
format-icons = [
"󰂎"
"󰁻"
"󰁾"
"󰂀"
"󰁹"
];
};
style = ''
#battery {
color: #${config.colorScheme.palette.taskbarText};
margin: 5px 2px;
padding: 0 12px;
border-radius: 999px;
min-width: 40px;
transition: all 0.3s;
background-color: #${config.colorScheme.palette.taskbarBackground};
}
#battery.charging,
#battery.plugged,
#battery.full {
color: #${config.colorScheme.palette.taskbarText};
background-color: #${config.colorScheme.palette.taskbarBackground};
box-shadow: none;
}
#battery.critical:not(.charging) {
background-color: transparent;
animation: batteryCritical 1.2s linear 0s infinite normal forwards;
}
@keyframes batteryCritical {
0% {
background-color: #${config.colorScheme.palette.base08};
color: #${config.colorScheme.palette.base06};
}
50% {
background-color: #${config.colorScheme.palette.base02};
color: #${config.colorScheme.palette.base08};
}
100% {
background-color: #${config.colorScheme.palette.base08};
color: #${config.colorScheme.palette.base06};
}
}
'';
};
};
}

View file

@ -0,0 +1,34 @@
{
lib,
config,
pkgs,
...
}:
let
name = "custom/bluetooth";
in
{
options.modules.waybar = {
modules = import ./addname.nix lib name;
enabled.${name} = {
enable = lib.mkEnableOption "enable ${name} waybar module";
};
};
config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar = {
settings.mainBar."${name}" = {
format = "";
on-click = lib.meta.getExe' pkgs.blueberry "blueberry";
};
style = ''
#custom-bluetooth {
color: #${config.colorScheme.palette.taskbarText};
margin: 5px 0px;
padding: 0 8px;
background-color: #${config.colorScheme.palette.taskbarBackground};
border-radius: 999px 0 0 999px;
}
'';
};
};
}

View file

@ -19,25 +19,23 @@ in
interval = 1; interval = 1;
format = "{:%H:%M:%S}"; format = "{:%H:%M:%S}";
format-alt = "{:%Y-%m-%d %H:%M:%S}"; format-alt = "{:%Y-%m-%d %H:%M:%S}";
on-click-middle = "gnome-clocks"; on-click-middle = lib.meta.getExe' pkgs.gnome-clocks "gnome-clocks";
calendar = { calendar = {
weeks-pos = "left"; weeks-pos = "left";
format = { format = {
today = "<span color='#FF6666'><u>{}</u></span>"; # TODO: use nix-colors today = "<span color='#${config.colorScheme.palette.base17}'><u>{}</u></span>"; # TODO: use nix-colors
weeks = "<span color='#707A8C'>{}</span>"; # TODO: use nix-colors weeks = "<span color='#${config.colorScheme.palette.base17}'>{}</span>"; # TODO: use nix-colors
}; };
}; };
home.packages = [
pkgs.gnome-clocks
];
}; };
style = '' style = ''
#clock { #clock {
color: #${config.colorScheme.palette.taskbarText}; color: #${config.colorScheme.palette.taskbarText};
margin: 0px 2px; background-color: #${config.colorScheme.palette.taskbarBackground};
padding: 0 15px; margin: 5px 0px;
margin-right: 2px;
border-radius: 999px; padding: 0 12px;
border-radius: 999px 0 0 999px;
box-shadow: none; box-shadow: none;
} }
''; '';

View file

@ -12,17 +12,15 @@ in
config = lib.mkIf config.modules.waybar.enabled.${name}.enable { config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar = { programs.waybar = {
settings.mainBar."${name}" = { settings.mainBar."${name}" = {
format = "cpu: {usage}%"; format = " {usage}%";
tooltip = false; tooltip = false;
}; };
style = '' style = ''
#cpu { #cpu {
color: #${config.colorScheme.palette.taskbarText}; color: #${config.colorScheme.palette.taskbarText};
margin: 0px 0px; margin: 5px 0px;
padding: 0 15px; padding: 0 8px;
background-color: #${config.colorScheme.palette.taskbarBackground};
border-radius: 999px 0px 0px 999px;
box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.base01};
} }
''; '';
}; };

View file

@ -48,6 +48,8 @@ in
./temperature.nix ./temperature.nix
./wireplumber.nix ./wireplumber.nix
./spotify.nix ./spotify.nix
./battery.nix
./bluetooth.nix
../../common/colors.nix ../../common/colors.nix
]; ];
@ -94,7 +96,25 @@ in
style = '' style = ''
* { * {
font-family: "Maple Mono NF"; font-family: "Maple Mono NF";
font-size: 14px; font-size: 12px;
}
window#waybar {
background-color: transparent;
color: #${config.colorScheme.palette.taskbarText};
transition-property: background-color;
transition-duration: 0.5s;
}
window#waybar.hidden {
opacity: 0.2;
}
window#waybar.termite {
background-color: transparent;
}
window#waybar.chromium {
background-color: transparent;
} }
button { button {

View file

@ -12,17 +12,15 @@ in
config = lib.mkIf config.modules.waybar.enabled.${name}.enable { config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar = { programs.waybar = {
settings.mainBar."${name}" = { settings.mainBar."${name}" = {
format = "mem: {}%"; format = " {}%";
tooltip = false; tooltip = false;
}; };
style = '' style = ''
#memory { #memory {
border-radius: 0px 999px 999px 0px;
padding: 0 10px;
color: #${config.colorScheme.palette.taskbarText}; color: #${config.colorScheme.palette.taskbarText};
margin: 0px; margin: 5px 0px;
box-shadow: inset 0px 2px 0 -1px #${config.colorScheme.palette.base01}, padding: 0 8px;
inset 0px -2px 0 -1px #${config.colorScheme.palette.base01}; background-color: #${config.colorScheme.palette.taskbarBackground};
} }
''; '';
}; };

View file

@ -12,23 +12,25 @@ in
config = lib.mkIf config.modules.waybar.enabled.${name}.enable { config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar = { programs.waybar = {
settings.mainBar."${name}" = { settings.mainBar."${name}" = {
format-wifi = "{essid} ({signalStrength}%) 󰖩"; format-wifi = "󰖩";
format-ethernet = "{ipaddr}/{cidr} 󰛳"; format-ethernet = "󰲝";
tooltip-format = "{ifname} via {gwaddr} 󰛳"; tooltip-format = "ssid : {essid}\naddr : {ipaddr}/{cidr}\ngate : {gwaddr}\ndev : {ifname}";
format-linked = "{ifname} (No IP) 󰛳"; format-linked = "󰲝";
format-disconnected = "Disconnected "; format-disconnected = "";
format-alt = "{ifname}: {ipaddr}/{cidr}"; format-alt = "{ipaddr}/{cidr}";
}; };
style = '' style = ''
#network { #network {
color: #${config.colorScheme.palette.taskbarText}; color: #${config.colorScheme.palette.taskbarText};
margin: 0px 2px; margin: 5px 0px;
padding: 0 15px; padding: 0 8px;
border-radius: 999px; background-color: #${config.colorScheme.palette.taskbarBackground};
box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.base01};
} }
#network.disconnected, #network.disconnected {
transition: all 0.2s;
color: #${config.colorScheme.palette.base02};
}
''; '';
}; };
}; };

View file

@ -17,16 +17,20 @@ in
config = lib.mkIf config.modules.waybar.enabled.${name}.enable { config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar = { programs.waybar = {
settings.mainBar.${name} = { settings.mainBar.${name} = {
exec = ''${pkgs.playerctl}/bin/playerctl metadata --player=spotify -F -f "{{ status }}: {{ artist }} - {{ title }}"''; exec = ''${lib.meta.getExe pkgs.playerctl} metadata --player=spotify -F -f "{{ status }}: {{ artist }} - {{ title }}"'';
format = "{}"; format = "{}";
on-click = "${pkgs.playerctl}/bin/playerctl --player=spotify play-pause"; on-click = "${lib.meta.getExe pkgs.playerctl} --player=spotify play-pause";
on-scroll-up = "${pkgs.playerctl}/bin/playerctl --player=spotify volume 0.01+"; on-click-middle = lib.meta.getExe' pkgs.spotify "spotify";
on-scroll-down = "${pkgs.playerctl}/bin/playerctl --player=spotify volume 0.01-"; on-scroll-up = "${lib.meta.getExe pkgs.playerctl} --player=spotify volume 0.01+";
on-scroll-down = "${lib.meta.getExe pkgs.playerctl} --player=spotify volume 0.01-";
}; };
style = '' style = ''
#custom-spotify { #custom-spotify {
color: #${config.colorScheme.palette.base14}; color: #${config.colorScheme.palette.base14};
margin-right: 10px; margin: 5px 0px;
padding: 0 8px;
background-color: #${config.colorScheme.palette.taskbarBackground};
border-radius: 0 999px 999px 0;
} }
''; '';
}; };

View file

@ -10,16 +10,31 @@ in
}; };
}; };
config = lib.mkIf config.modules.waybar.enabled.${name}.enable { config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar.settings.mainBar."${name}" = { programs.waybar = {
thermal-zone = 2; settings.mainBar."${name}" = {
hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input"; thermal-zone = 2;
critical-threshold = 80; hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input";
format = "{temperatureC}°C {icon}"; critical-threshold = 80;
format-icons = [ format = "{icon} {temperatureC}°C";
"" format-icons = [
"" ""
"" ""
]; ""
];
};
style = ''
#temperature {
color: #${config.colorScheme.palette.taskbarText};
margin: 5px 0px;
padding: 0 8px;
background-color: #${config.colorScheme.palette.taskbarBackground};
border-radius: 0 999px 999px 0;
}
#temperature.critcal {
color: #${config.colorScheme.palette.base08};
}
'';
}; };
}; };
} }

View file

@ -17,17 +17,16 @@ in
style = '' style = ''
#tray { #tray {
color: #${config.colorScheme.palette.taskbarText}; color: #${config.colorScheme.palette.taskbarText};
margin: 0px 2px; margin: 5px 0px;
padding: 4px 10px; padding: 4px 10px;
border-radius: 999px 999px 999px 999px; border-radius: 999px;
box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.base01}; background-color: #${config.colorScheme.palette.taskbarBackground};
} }
#tray { #tray > * {
background-color: transparent; padding: 0 20px;
} }
#tray > .passive { #tray > .passive {
-gtk-icon-effect: dim; -gtk-icon-effect: dim;
} }

View file

@ -1,4 +1,9 @@
{ lib, config, ... }: {
lib,
config,
pkgs,
...
}:
let let
name = "wireplumber"; name = "wireplumber";
in in
@ -12,22 +17,21 @@ in
config = lib.mkIf config.modules.waybar.enabled.${name}.enable { config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar = { programs.waybar = {
settings.mainBar."${name}" = { settings.mainBar."${name}" = {
format = "{volume}% {icon}"; format = "{icon} {volume}%";
format-muted = ""; format-muted = "󰝟";
on-click = "helvum";
format-icons = [ format-icons = [
"" ""
"" ""
"" ""
]; ];
on-click = lib.meta.getExe' pkgs.helvum "helvum";
}; };
style = '' style = ''
#wireplumber { #wireplumber {
color: #${config.colorScheme.palette.taskbarText}; color: #${config.colorScheme.palette.taskbarText};
margin: 0px 2px; margin: 5px 0px;
padding: 0 15px; padding: 0 8px;
border-radius: 999px; background-color: #${config.colorScheme.palette.taskbarBackground};
box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.base01};
} }
''; '';
}; };

View file

@ -19,7 +19,7 @@ in
style = '' style = ''
#workspaces button { #workspaces button {
transition: all 0.2s; transition: all 0.2s;
padding: 3px 3px 3px 5px; padding: 4px 4px 4px 5px;
margin: 3px; margin: 3px;
min-width: 15px; min-width: 15px;
min-height: 15px; min-height: 15px;
@ -42,10 +42,8 @@ in
} }
#workspaces { #workspaces {
margin: 0 4px;
padding: 4px 4px; padding: 4px 4px;
border-radius: 999px; border-radius: 999px;
box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.base01};
} }
''; '';
}; };