better swaybar

This commit is contained in:
RingOfStorms (Joshua Bell) 2025-09-15 00:00:34 -05:00
parent b363f169ce
commit 221b1f0379
5 changed files with 567 additions and 62 deletions

View file

@ -79,6 +79,7 @@ with lib;
slurp slurp
wf-recorder wf-recorder
btop btop
pavucontrol
]; ];
services.blueman.enable = config.hardware.bluetooth.enable; services.blueman.enable = config.hardware.bluetooth.enable;

View file

@ -60,11 +60,34 @@ in
# Bitwarden chrome popup as floating example from Hyprland rules # Bitwarden chrome popup as floating example from Hyprland rules
{ {
criteria = { criteria = {
class = "chrome-nngceckbapebfimnlniiiahkandclblb-Default"; app_id = "chrome-nngceckbapebfimnlniiiahkandclblb-Default";
title = "_crx_nngceckbapebfimnlniiiahkandclblb";
instance = ".*";
}; };
command = "floating enable, move position center, resize set 720 600"; command = "floating enable";
}
{
criteria = {
app_id = "pavucontrol";
};
command = "floating enable, move position center, resize set 620 1200";
}
{
criteria = {
class = "Google-chrome";
window_role = "pop-up";
};
command = "floating enable, move position center, resize set 720 480";
}
{
criteria = {
window_role = "pop-up";
};
command = "floating enable, move position center, resize set 640 420";
}
{
criteria = {
window_role = "About";
};
command = "floating enable, move position center, resize set 640 420";
} }
]; ];
}; };

View file

@ -1,11 +1,17 @@
{ lib, osConfig, ... }: { lib, osConfig, ... }:
let let
ccfg = import ../../../config.nix; ccfg = import ../../../config.nix;
cfg_path = [ ccfg.custom_config_key "desktopEnvironment" "sway" "waybar" ]; cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"sway"
"waybar"
];
cfg = lib.attrsets.getAttrFromPath cfg_path osConfig; cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
in in
{ {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.waybar = { programs.waybar = {
enable = true; enable = true;
systemd.enable = true; systemd.enable = true;
@ -13,28 +19,125 @@ in
mainBar = { mainBar = {
layer = "top"; layer = "top";
position = "top"; position = "top";
height = 30; height = 28;
spacing = 6; spacing = 6;
margin-top = 0; margin-top = 0;
margin-bottom = 0; margin-bottom = 0;
margin-left = 10; margin-left = 10;
margin-right = 10; margin-right = 10;
modules-left = [ "sway/workspaces" ]; modules-left = [
modules-center = [ "clock" "temperature" "cpu" "memory" "disk" ]; "sway/workspaces"
modules-right = [ "pulseaudio" "network" "bluetooth" "custom/notifications" "sway/language" ]; "sway/mode"
"sway/scratchpad"
];
modules-center = [
"clock"
"temperature"
"cpu"
"memory"
"disk"
];
modules-right = [
"battery"
"battery#bat2"
"pulseaudio"
"network"
"bluetooth"
"power-profiles-daemon"
"backlight"
"custom/notifications"
"sway/language"
"tray"
"custom/power"
];
# LEFT
"sway/workspaces" = { "sway/workspaces" = {
format = "{icon}"; format = "{icon}";
format-icons = { format-icons = {
"1" = ""; "2" = ""; "3" = ""; "4" = ""; "5" = ""; "1" = "";
"6" = ""; "7" = ""; "8" = ""; "9" = ""; "10" = ""; "2" = "";
"11" = ""; "12" = ""; "13" = ""; "14" = ""; "15" = ""; "3" = "";
"16" = ""; "17" = ""; "18" = ""; "19" = ""; "20" = ""; "4" = "";
"5" = "";
"6" = "";
"7" = "";
"8" = "";
"9" = "";
"10" = "";
"11" = "";
"12" = "";
"13" = "";
"14" = "";
"15" = "";
"16" = "";
"17" = "";
"18" = "";
"19" = "";
"20" = "";
}; };
disable-scroll = false; disable-scroll = false;
}; };
# CENTER
clock = {
format = "{:%b %d, %H:%M}";
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
};
temperature = {
thermal-zone = 2;
hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input";
critical-threshold = 80;
format-critical = "󰔏 {temperatureC}°C";
format = "󰔏 {temperatureC}°C";
};
cpu = {
format = "󰻠 {usage}%";
tooltip = true;
on-click = "btop";
};
memory = {
format = "󰍛 {}%";
on-click = "btop";
};
disk = {
interval = 30;
format = "󰋊 {percentage_used}%";
path = "/";
on-click = "btop";
};
# RIGHT
"battery" = {
"states" = {
# "good"= 95;
"warning" = 30;
"critical" = 15;
};
"format" = "{capacity}% {icon}";
"format-full" = "{capacity}% {icon}";
"format-charging" = "{capacity}% ";
"format-plugged" = "{capacity}% ";
"format-alt" = "{time} {icon}";
# "format-good"= ""; // An empty format will hide the module
# "format-full"= "";
"format-icons" = [
""
""
""
""
""
];
};
"battery#bat2" = {
"bat" = "BAT2";
};
pulseaudio = { pulseaudio = {
format = "{icon} {volume}%"; format = "{icon} {volume}%";
format-bluetooth = "󰂰 {volume}%"; format-bluetooth = "󰂰 {volume}%";
@ -49,44 +152,17 @@ in
phone = "󰏲"; phone = "󰏲";
portable = "󰦧"; portable = "󰦧";
car = "󰄋"; car = "󰄋";
default = [ "󰕿" "󰖀" "󰕾" ]; default = [
"󰕿"
"󰖀"
"󰕾"
];
}; };
scroll-step = 5; scroll-step = 5;
on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; on-click = "pavucontrol";
on-click-right = "swaync-client -t -sw"; on-click-right = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
}; };
"custom/notifications" = {
format = "{icon} {}";
format-icons = {
notification = ""; none = "";
dnd-notification = "󰂛"; dnd-none = "󰂛";
inhibited-notification = ""; inhibited-none = "";
dnd-inhibited-notification = "󰂛"; dnd-inhibited-none = "󰂛";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "swaync-client -t -sw";
on-click-right = "swaync-client -d -sw";
escape = true;
tooltip = false;
};
clock = { format = "{:%b %d, %H:%M}"; };
temperature = {
thermal-zone = 2;
hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input";
critical-threshold = 80;
format-critical = "󰔏 {temperatureC}°C";
format = "󰔏 {temperatureC}°C";
};
cpu = { format = "󰻠 {usage}%"; tooltip = false; on-click = "btop"; };
memory = { format = "󰍛 {}%"; on-click = "btop"; };
disk = { interval = 30; format = "󰋊 {percentage_used}%"; path = "/"; on-click = "btop"; };
network = { network = {
format-wifi = "󰤨 {essid} ({signalStrength}%)"; format-wifi = "󰤨 {essid} ({signalStrength}%)";
format-ethernet = "󰈀 {ipaddr}/{cidr}"; format-ethernet = "󰈀 {ipaddr}/{cidr}";
@ -109,24 +185,77 @@ in
# on-click-right = "bluetoothctl power toggle"; # on-click-right = "bluetoothctl power toggle";
}; };
"sway/language" = { format = "{}"; }; # simplified "power-profiles-daemon" = {
format = "{icon}";
"tooltip-format" = "Power profile: {profile}\nDriver: {driver}";
tooltip = true;
"format-icons" = {
default = "";
performance = "";
balanced = "";
"power-saver" = "";
};
};
backlight = {
format = "{percent}% {icon}";
"format-icons" = [
""
""
""
""
""
""
""
""
""
];
};
"custom/notifications" = {
format = "{icon} {}";
format-icons = {
notification = "";
none = "";
dnd-notification = "󰂛";
dnd-none = "󰂛";
inhibited-notification = "";
inhibited-none = "";
dnd-inhibited-notification = "󰂛";
dnd-inhibited-none = "󰂛";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "swaync-client -t -sw";
on-click-right = "swaync-client -d -sw";
escape = true;
tooltip = false;
};
"sway/language" = {
format = "{}";
};
"tray" = {
"spacing" = 10;
};
"custom/power" = {
format = " ";
tooltip = false;
menu = "on-click";
"menu-file" = ./waybar/power_menu.xml;
"menu-actions" = {
shutdown = "shutdown 0";
reboot = "reboot";
};
};
}; };
}; };
style = '' style = builtins.readFile ./waybar/waybar.css;
* { font-family: "JetBrainsMonoNL Nerd Font"; font-size: 12px; border: none; border-radius: 0; min-height: 0; }
window#waybar { background: transparent; border-radius: 10px; margin: 0px; }
.modules-left,.modules-center,.modules-right { background: rgba(26,27,38,.8); border-radius: 10px; margin: 4px; padding: 0 10px; }
#workspaces { padding: 0 5px; }
#workspaces button { padding: 0 8px; background: transparent; color: #c0caf5; border-radius: 5px; margin: 2px; }
#workspaces button:hover { background: rgba(125,196,228,.2); color: #7dcae4; }
#workspaces button.active { background: #7dcae4; color: #1a1b26; }
#pulseaudio,#custom-notifications,#clock,#temperature,#cpu,#memory,#disk,#network,#bluetooth,#language { padding: 0 8px; color: #c0caf5; margin: 2px; }
#temperature.critical { color: #f7768e; }
#network.disconnected { color: #f7768e; }
#bluetooth.disabled { color: #565f89; }
#pulseaudio.muted { color: #565f89; }
'';
}; };
}; };
} }

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkMenu" id="menu">
<child>
<object class="GtkMenuItem" id="reboot">
<property name="label">Reboot</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="delimiter1" />
</child>
<child>
<object class="GtkMenuItem" id="shutdown">
<property name="label">Shutdown</property>
</object>
</child>
</object>
</interface>

View file

@ -0,0 +1,334 @@
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: "JetBrainsMonoNL Nerd Font", FontAwesome, Roboto, Helvetica, Arial, sans-serif;
font-size: 12px;
border: none;
border-radius: 0;
min-height: 0;
}
window#waybar {
/* background-color: rgba(43, 48, 59, 0.5); */
/* border-bottom: 3px solid rgba(100, 114, 125, 0.5); */
color: #ffffff;
/* transition-property: background-color; */
/* transition-duration: .5s; */
background: transparent;
border-radius: 10px;
margin: 0px;
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover {
background: inherit;
box-shadow: inset 0 -3px #ffffff;
}
/* you can set a style on hover for any module like this */
#pulseaudio:hover {
background-color: #a37800;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
}
#workspaces button.focused {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#wireplumber,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#scratchpad,
#power-profiles-daemon,
#mpd {
padding: 0 10px;
color: #ffffff;
}
#window,
#workspaces {
margin: 0 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left>widget:first-child>#workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right>widget:last-child>#workspaces {
margin-right: 0;
}
#clock {
background-color: #64727D;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging,
#battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
/* Using steps() instead of linear as a timing function to limit cpu usage */
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: steps(12);
animation-iteration-count: infinite;
animation-direction: alternate;
}
#power-profiles-daemon {
padding-right: 15px;
}
#power-profiles-daemon.performance {
background-color: #f53c3c;
color: #ffffff;
}
#power-profiles-daemon.balanced {
background-color: #2980b9;
color: #ffffff;
}
#power-profiles-daemon.power-saver {
background-color: #2ecc71;
color: #000000;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#disk {
background-color: #964B00;
}
#backlight {
background-color: #90b1b1;
}
#network {
background-color: #2980b9;
}
#network.disconnected {
background-color: #f53c3c;
}
#pulseaudio {
background-color: #f1c40f;
color: #000000;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#wireplumber {
background-color: #fff0f5;
color: #000000;
}
#wireplumber.muted {
background-color: #f53c3c;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #2980b9;
}
#tray>.passive {
-gtk-icon-effect: dim;
}
#tray>.needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
#language {
background: #00b093;
color: #740864;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
padding: 0 0px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state>label {
padding: 0 5px;
}
#keyboard-state>label.locked {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad.empty {
background-color: transparent;
}
#privacy {
padding: 0;
}
#privacy-item {
padding: 0 5px;
color: white;
}
#privacy-item.screenshare {
background-color: #cf5700;
}
#privacy-item.audio-in {
background-color: #1ca000;
}
#privacy-item.audio-out {
background-color: #0069d4;
}