chore(waybar): update config

This commit is contained in:
Andrea 2025-03-01 10:49:06 +01:00
parent 2197cd038f
commit 244b4808fa
Signed by: nullndr
GPG Key ID: 8DA8996EF89F33BB
3 changed files with 144 additions and 137 deletions

View File

@ -1,10 +1,9 @@
{ {
"layer": "bottom", // Waybar at top layer "mode": "dock",
"position": "bottom", // Waybar position (top|bottom|left|right) "reload_style_on_change": true,
// "height": 30, // Waybar height (to be removed for auto height) "layer": "bottom",
"position": "bottom",
"margin": "5 5 5 5", "margin": "5 5 5 5",
// "width": 1280, // Waybar width
// Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode"], "modules-left": ["sway/workspaces", "sway/mode"],
"modules-center": ["clock", "idle_inhibitor"], "modules-center": ["clock", "idle_inhibitor"],
"modules-right": [ "modules-right": [
@ -14,69 +13,27 @@
"pulseaudio", "pulseaudio",
"backlight", "backlight",
"battery", "battery",
"disk",
"memory",
"bluetooth", "bluetooth",
"network" "network"
], ],
//***************************
//* Modules configuration *
//***************************
"sway/workspaces": { "sway/workspaces": {
"disable-scroll": true, "format": "{name}",
"format": "{name}" "disable-scroll": true
},
"custom/recorder": {
"format": "",
"return-type": "json",
"interval": 1,
"exec": "echo '{\"class\": \"recording\"}'",
"exec-if": "pgrep wf-recorder"
},
"custom/pacman": {
"format": "{} ",
"interval": 3600, // every hour
"exec": "checkupdates | wc -l", // # of updates
"exec-if": "[[ $(checkupdates | wc -l) != 0 ]]", // always run; consider advanced run conditions
"on-click": "alacritty -e 'yay; echo Done - Press enter to exit; read'; pkill -SIGRTMIN+8 waybar", // update system
"signal": 8,
"tooltip": false
},
"privacy": {
"icon-spacing": 4,
"icon-size": 18,
"transition-duration": 250,
"modules": [
{
"type": "screenshare",
"tooltip": true,
"tooltip-icon-size": 24
},
{
"type": "audio-out",
"tooltip": true,
"tooltip-icon-size": 24
},
{
"type": "audio-in",
"tooltip": true,
"tooltip-icon-size": 24
}
]
}, },
"sway/mode": { "sway/mode": {
"format": "<span style=\"italic\">{}</span>" "format": "{}"
}, },
"clock": { "clock": {
"timezone": "Europe/Rome", "tooltip": true,
"timezones": ["Europe/Rome"],
"format": "{:%H:%M}", "format": "{:%H:%M}",
"format-alt": "{:%Y-%m-%d}", "format-alt": "{:%Y-%m-%d}",
"tooltip-format": "<tt><small>{calendar}</small></tt>", "tooltip-format": "{calendar}",
"calendar": { "calendar": {
"mode": "year", "mode": "year",
"mode-mon-col": 3, "mode-mon-col": 3,
@ -92,15 +49,12 @@
} }
}, },
"actions": { "actions": {
"on-click-right": "mode", "on-click-right": "mode"
"on-click-forward": "tz_up",
"on-click-backward": "tz_down",
"on-scroll-up": "shift_up",
"on-scroll-down": "shift_down"
} }
}, },
"idle_inhibitor": { "idle_inhibitor": {
"tooltip": true,
"format": "{icon}", "format": "{icon}",
"format-icons": { "format-icons": {
"activated": "", "activated": "",
@ -108,69 +62,122 @@
} }
}, },
"custom/pacman": {
"tooltip": false,
"format": "{} ",
"interval": 60,
"exec": "checkupdates | wc -l",
"exec-if": "[[ $(checkupdates | wc -l) != 0 ]]",
"signal": 8
},
"custom/recorder": {
"tooltip": true,
"format": "Recording screen",
"return-type": "json",
"interval": 1,
"exec": "echo '{\"class\": \"recording\"}'",
"exec-if": "pgrep wf-recorder"
},
"privacy": {
"icon-spacing": 4,
"icon-size": 18,
"transition-duration": 250,
"modules": [
{
"tooltip": true,
"type": "screenshare",
"tooltip-icon-size": 24
},
{
"tooltip": true,
"type": "audio-out",
"tooltip-icon-size": 24
},
{
"tooltip": true,
"type": "audio-in",
"tooltip-icon-size": 24
}
]
},
"pulseaudio": { "pulseaudio": {
// "scroll-step": 1, // %, can be a float "tooltip": true,
"reverse-scrolling": 1,
"format": "{volume}% {icon} {format_source}", "format": "{volume}% {icon} {format_source}",
"format-bluetooth": "{icon} {volume}% {format_source}", "format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}", "format-bluetooth-muted": "󰂲 {format_source}",
"format-muted": "婢 {format_source}", "format-muted": " {format_source}",
"format-source": "{volume}% ", "format-source": "{volume}% ",
"format-source-muted": "", "format-source-muted": "",
"format-icons": { "format-icons": {
"headphone": "", "headphone": "",
"hands-free": "", "hands-free": "󰋎",
"headset": "", "headset": "󰋎",
"phone": "", "default": ["", "", ""]
"portable": "",
"car": "",
"default": ["奄", "奔", "墳"]
}, },
"on-click": "pavucontrol", "on-click": "pavucontrol",
"min-length": 13 "min-length": 13
}, },
"backlight": { "backlight": {
"tooltip": true,
"device": "intel_backlight", "device": "intel_backlight",
"format": "{percent}% {icon}", "format": "{percent}% {icon}",
"format-icons": ["", "", "", "", "", "", ""], "format-icons": ["󰃚", "󰃛", "󰃜", "󰃝", "󰃞", "󰃟", "󰃠"],
"min-length": 7 "min-length": 7
}, },
"battery": { "battery": {
"interval": 3,
"tooltip": true,
"states": { "states": {
"warning": 30, "warning": 30,
"critical": 15 "critical": 15
}, },
"format": "{capacity}% {icon}", "format": "{capacity}% {icon}",
"format-charging": "{capacity}% ", "format-charging": "{capacity}% 󰂄",
"format-plugged": "{capacity}% ", "format-plugged": "{capacity}% ",
"format-alt": "{time} {icon}", "format-alt": "{time} {icon}",
"format-icons": ["", "", "", "", "", "", "", "", "", ""], "format-icons": ["󰁻", "󰁼", "󰁾", "󰂀", "󰂂", "󰁹"],
"tooltip-format": "{timeTo}\nCapacity: {capacity}\nPower: {power}w\nCycles: {cycles}\nHealth: {health}%",
"on-update": "$HOME/.config/waybar/scripts/check_battery.sh" "on-update": "$HOME/.config/waybar/scripts/check_battery.sh"
}, },
"disk": {
"interval": 3,
"tooltip": true,
"format": "{used} ",
"path": "/"
},
"memory": {
"interval": 3,
"tooltip": true,
"format": "{used}GiB ",
"max-length": 10
},
"bluetooth": { "bluetooth": {
"format": " {status}", "tooltip": true,
"format-connected": " {device_alias}", "format": "󰂯 {status}",
"format-connected-battery": " {device_alias} {device_battery_percentage}%", "format-connected": "󰂯 {device_alias}",
// "format-device-preference": [ "device1", "device2" ], // preference list deciding the displayed device "format-connected-battery": "󰂯 {device_alias} {device_battery_percentage}%",
"tooltip-format": "{controller_alias}\t{controller_address}\n\n{num_connections} connected", "tooltip-format": "{controller_alias}\t{controller_address}\n\n{num_connections} connected",
"tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}",
"tooltip-format-enumerate-connected": "{device_alias}\t{device_address}",
"tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t{device_battery_percentage}%",
"on-click": "blueman-manager" "on-click": "blueman-manager"
}, },
"network": { "network": {
"interval": 3,
"tooltip": true,
"format": "{ifname}", "format": "{ifname}",
"format-wifi": "{essid} ", "format-wifi": "{essid} 󰖩",
"format-ethernet": "{ipaddr}/{cidr} 󰊗", "format-ethernet": "{essid} 󰈀",
// "format-disconnected": "", //An empty format will hide the module. "tooltip-format": "{ifname} via {gwaddr} 󰈀",
"tooltip-format": "{ifname} via {gwaddr} 󰊗", "tooltip-format-wifi": "{ipaddr} on {ifname} via {essid} ",
"tooltip-format-wifi": "{essid} ", "tooltip-format-ethernet": "{ipaddr} on {ifname} via {essid} 󰈀",
"tooltip-format-ethernet": "{ifname} ", "tooltip-format-disconnected": "󰖪",
"tooltip-format-disconnected": "Disconnected",
"max-length": 50, "max-length": 50,
"on-click": "nm-connection-editor" "on-click": "nm-connection-editor"
} }

View File

@ -1,18 +1,17 @@
#!/bin/sh #! /usr/bin/env bash
bat=/sys/class/power_supply/BAT1 FILE=~/.config/waybar/scripts/.low_bat
CRIT=${1:-15}
FILE=~/.config/waybar/scripts/notified bat="/sys/class/power_supply/BAT1"
CRIT="${1:-15}"
stat="$(cat $bat/status)"
perc="$(cat $bat/capacity)"
stat=$(cat $bat/status) if [[ $perc -le $CRIT ]] && [[ "$stat" == "Discharging" ]] && [[ ! -f "$FILE" ]]; then
perc=$(cat $bat/capacity)
if [[ $perc -le $CRIT ]] && [[ $stat == "Discharging" ]]; then
if [[ ! -f "$FILE" ]]; then
notify-send --urgency=critical --icon=dialog-warning "Battery Low" "Current charge: $perc%" notify-send --urgency=critical --icon=dialog-warning "Battery Low" "Current charge: $perc%"
touch $FILE touch $FILE
fi fi
elif [[ -f "$FILE" ]]; then
if [[ -f "$FILE" ]] && [[ "$stat" == "Charging" ]]; then
rm $FILE rm $FILE
fi fi

View File

@ -1,9 +1,16 @@
* { * {
all: initial;
border: none; border: none;
border-radius: 0; border-radius: 0;
/* `otf-font-awesome` is required to be installed for icons */
font-family: Liberation Mono;
min-height: 20px; min-height: 20px;
font-family: "Symbols Nerd Font", monospace;
}
button {
padding-top: 4px;
padding-bottom: 4px;
padding-left: 14px;
padding-right: 14px;
} }
window#waybar { window#waybar {
@ -14,24 +21,29 @@ window#waybar.hidden {
opacity: 0.2; opacity: 0.2;
} }
tooltip {
background: #383c4a;
border-radius: 10px;
}
tooltip label {
color: white;
}
#workspaces { #workspaces {
border-radius: 10px; border-radius: 10px;
transition: none; transition: none;
background: #383c4a; background: #383c4a;
margin-right: 8px;
} }
#workspaces button { #workspaces button {
transition: none;
color: #7c818c; color: #7c818c;
background: transparent; background: transparent;
padding: 5px;
font-size: 18px; font-size: 18px;
min-width: 0;
} }
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover { #workspaces button:hover {
transition: none;
box-shadow: inherit; box-shadow: inherit;
text-shadow: inherit; text-shadow: inherit;
border-radius: inherit; border-radius: inherit;
@ -39,16 +51,17 @@ window#waybar.hidden {
background: #7c818c; background: #7c818c;
} }
#workspaces button.focused {
color: white;
}
#custom-pacman, #custom-pacman,
#custom-recorder,
#mode, #mode,
#clock, #clock,
#privacy,
#privacy-item,
#idle_inhibitor, #idle_inhibitor,
#battery, #battery,
#pulseaudio, #pulseaudio,
#disk,
#memory,
#bluetooth, #bluetooth,
#network, #network,
#backlight { #backlight {
@ -58,11 +71,6 @@ window#waybar.hidden {
background: #383c4a; background: #383c4a;
} }
#custom-pacman {
transition: none;
color: #ffffff;
}
#bluetooth { #bluetooth {
margin-right: 8px; margin-right: 8px;
} }
@ -82,10 +90,18 @@ window#waybar.hidden {
color: #ffffff; color: #ffffff;
} }
#clock { #custom-pacman,
#custom-recorder,
#clock,
#privacy,
#pulseaudio,
#backlight,
#disk,
#memory,
#battery {
margin-right: 8px;
transition: none; transition: none;
color: #ffffff; color: #ffffff;
margin-right: 8px;
} }
#idle_inhibitor { #idle_inhibitor {
@ -97,30 +113,12 @@ window#waybar.hidden {
background-color: #26a65b; background-color: #26a65b;
} }
#pulseaudio {
margin-right: 8px;
transition: none;
color: #ffffff;
}
#pulseaudio.muted, #pulseaudio.muted,
#pulseaudio.source-muted { #pulseaudio.source-muted {
background-color: #90b1b1; background-color: #90b1b1;
color: #2a5c45; color: #2a5c45;
} }
#backlight {
margin-right: 8px;
transition: none;
color: #ffffff;
}
#battery {
margin-right: 8px;
transition: none;
color: #ffffff;
}
#battery.charging { #battery.charging {
color: #ffffff; color: #ffffff;
background-color: #26a65b; background-color: #26a65b;
@ -163,3 +161,6 @@ window#waybar.hidden {
color: #000000; color: #000000;
} }
} }
/* #privacy-item {
} */