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
base17 = "#ff92df"; # bright purple
taskbarText = base04;
taskbarBackground = base10;
background_paper = "#000000";
foreground_paper = "#26052e";
};

View file

@ -194,12 +194,13 @@ in
"custom/spotify"
];
right = [
"custom/vpn"
"wireplumber"
"custom/bluetooth"
"battery"
"network"
"wireplumber"
"cpu"
"memory"
"custom/poweroff"
"temperature"
];
};
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;
format = "{:%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 = {
weeks-pos = "left";
format = {
today = "<span color='#FF6666'><u>{}</u></span>"; # TODO: use nix-colors
weeks = "<span color='#707A8C'>{}</span>"; # TODO: use nix-colors
today = "<span color='#${config.colorScheme.palette.base17}'><u>{}</u></span>"; # TODO: use nix-colors
weeks = "<span color='#${config.colorScheme.palette.base17}'>{}</span>"; # TODO: use nix-colors
};
};
home.packages = [
pkgs.gnome-clocks
];
};
style = ''
#clock {
color: #${config.colorScheme.palette.taskbarText};
margin: 0px 2px;
padding: 0 15px;
border-radius: 999px;
background-color: #${config.colorScheme.palette.taskbarBackground};
margin: 5px 0px;
margin-right: 2px;
padding: 0 12px;
border-radius: 999px 0 0 999px;
box-shadow: none;
}
'';

View file

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

View file

@ -48,6 +48,8 @@ in
./temperature.nix
./wireplumber.nix
./spotify.nix
./battery.nix
./bluetooth.nix
../../common/colors.nix
];
@ -94,7 +96,25 @@ in
style = ''
* {
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 {

View file

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

View file

@ -12,23 +12,25 @@ in
config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar = {
settings.mainBar."${name}" = {
format-wifi = "{essid} ({signalStrength}%) 󰖩";
format-ethernet = "{ipaddr}/{cidr} 󰛳";
tooltip-format = "{ifname} via {gwaddr} 󰛳";
format-linked = "{ifname} (No IP) 󰛳";
format-disconnected = "Disconnected ";
format-alt = "{ifname}: {ipaddr}/{cidr}";
format-wifi = "󰖩";
format-ethernet = "󰲝";
tooltip-format = "ssid : {essid}\naddr : {ipaddr}/{cidr}\ngate : {gwaddr}\ndev : {ifname}";
format-linked = "󰲝";
format-disconnected = "";
format-alt = "{ipaddr}/{cidr}";
};
style = ''
#network {
color: #${config.colorScheme.palette.taskbarText};
margin: 0px 2px;
padding: 0 15px;
border-radius: 999px;
box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.base01};
margin: 5px 0px;
padding: 0 8px;
background-color: #${config.colorScheme.palette.taskbarBackground};
}
#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 {
programs.waybar = {
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 = "{}";
on-click = "${pkgs.playerctl}/bin/playerctl --player=spotify play-pause";
on-scroll-up = "${pkgs.playerctl}/bin/playerctl --player=spotify volume 0.01+";
on-scroll-down = "${pkgs.playerctl}/bin/playerctl --player=spotify volume 0.01-";
on-click = "${lib.meta.getExe pkgs.playerctl} --player=spotify play-pause";
on-click-middle = lib.meta.getExe' pkgs.spotify "spotify";
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 = ''
#custom-spotify {
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 {
programs.waybar.settings.mainBar."${name}" = {
thermal-zone = 2;
hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input";
critical-threshold = 80;
format = "{temperatureC}°C {icon}";
format-icons = [
""
""
""
];
programs.waybar = {
settings.mainBar."${name}" = {
thermal-zone = 2;
hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input";
critical-threshold = 80;
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 = ''
#tray {
color: #${config.colorScheme.palette.taskbarText};
margin: 0px 2px;
margin: 5px 0px;
padding: 4px 10px;
border-radius: 999px 999px 999px 999px;
box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.base01};
border-radius: 999px;
background-color: #${config.colorScheme.palette.taskbarBackground};
}
#tray {
background-color: transparent;
#tray > * {
padding: 0 20px;
}
#tray > .passive {
-gtk-icon-effect: dim;
}

View file

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

View file

@ -17,9 +17,9 @@ in
sort-by = "id";
};
style = ''
#workspaces button {
#workspaces button {
transition: all 0.2s;
padding: 3px 3px 3px 5px;
padding: 4px 4px 4px 5px;
margin: 3px;
min-width: 15px;
min-height: 15px;
@ -41,11 +41,9 @@ in
background-color: #${config.colorScheme.palette.base08};
}
#workspaces {
margin: 0 4px;
padding: 4px 4px;
#workspaces {
padding: 4px 4px;
border-radius: 999px;
box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.base01};
}
'';
};