commit f7ca58bbe49c7cb8a5a01ce5172aea6eec022871
parent 1fc51179cd529299680567073b77ef5e10a19be0
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Mon, 30 Mar 2026 19:46:45 +0200
feat: add waybar config
Diffstat:
9 files changed, 512 insertions(+), 0 deletions(-)
diff --git a/waybar/config b/waybar/config
@@ -0,0 +1,137 @@
+{
+ "layer": "top",
+ "position": "top",
+ "height": 24,
+ "spacing": 4,
+ "margin-top": 5,
+ "margin-bottom": 10,
+
+ // Choose the order of the modules
+
+ "modules-left":["custom/launcher", "custom/workspace", "wlr/taskbar"],
+ "modules-right":["custom/donotdisturb", "idle_inhibitor", "custom/snip", "pulseaudio", "cpu", "memory", "temperature", "backlight", "battery", "tray", "clock", "custom/power"],
+
+ // Modules configuration
+
+ "wlr/taskbar": {
+ "format": "{icon}",
+ "icon-size": 20,
+ "icon-theme": "Adwaita",
+ "tooltip-format": "{title}",
+ "on-click": "activate",
+ "on-click-middle": "",
+ "on-click-right": "minimize"
+ },
+ "sway/workspaces": {
+ "format": "{icon}",
+ "on-click": "activate",
+ "active-only": true,
+ "sort-by-number": true
+ },
+ "idle_inhibitor": {
+ "format": "{icon}",
+ "format-icons": {
+ "activated": "â",
+ "deactivated": "â°"
+ },
+ "on-click": "~/.config/waybar/modules/sway-idle-inhibitor.sh"
+ },
+ "tray": {
+ "icon-size": 20,
+ "spacing": 10
+ },
+ "clock": {
+ "timezone": "Europe/Berlin",
+ "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
+ "format": "{:%a %d %b %H:%M}",
+ "on-click": "thunderbird -calendar"
+ },
+ "cpu": {
+ "format": "{usage}% âĄ",
+ "on-click": "qps"
+ },
+ "memory": {
+ "format": "{}% đž",
+ "on-click": "qps"
+ },
+ "temperature": {
+ "thermal-zone": 2,
+ // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
+ "critical-threshold": 60,
+ // "format-critical": "{temperatureC}°C {icon}",
+ "format": "{temperatureC}°C đĨ",
+ },
+ "backlight": {
+ // "device": "acpi_video1",
+ "format": "{percent}% đĄ"
+ },
+ "battery": {
+ "states": {
+ "good": 75,
+ "warning": 20,
+ "critical": 10
+ },
+ "format": "{capacity}% đĒĢ",
+ "format-charging": "{capacity}% đ",
+ "format-plugged": "{capacity}% đ",
+ "tooltip-format": "{time}",
+ "format-good": "{capacity}% đ",
+ "format-full": "{capacity}% đ",
+ },
+ "battery#bat2": {
+ "bat": "BAT2"
+ },
+ "network": {
+ // "interface": "wlp2*", // (Optional) To force the use of this interface
+ "format-wifi": "{essid} ({signalStrength}%)",
+ "format-ethernet": "Connected đ§",
+ "tooltip-format": "{ifname} via {gwaddr} đ§",
+ "format-linked": "{ifname} (No IP) đ§",
+ "format-disconnected": "Disconnected â ",
+ "on-click": "nm-connection-editor"
+ },
+ "pulseaudio": {
+ // "scroll-step": 1, // %, can be a float
+ "format": "{volume}% đ",
+ "format-bluetooth": "{volume}% đī",
+ "format-bluetooth-muted": "{icon}ī {format_source}",
+ "format-muted": "{volume}% {format_source}",
+ "format-source": "đ",
+ "format-source-muted": "đ",
+ "format-icons": {
+ "headphone": "đ§",
+ "hands-free": "đ§",
+ "headset": "đ§",
+ "phone": "đ",
+ "portable": "đ",
+ "car": "đ",
+ "default": ["đ"]
+ },
+ "on-click": "pavucontrol"
+ },
+ "custom/launcher":{
+ "format": "đ§",
+ "tooltip-format": "Applications",
+ "on-click": "wofi",
+ "on-click-right": "killall wofi"
+ },
+ "custom/power":{
+ "format": "âģ ",
+ "on-click": "wlogout",
+ "on-click-right": "killall wlogout"
+ },
+ "custom/snip":{
+ "format": "â",
+ "on-click": "slurp | grim -g - ~/Bilder/Screenshots/$(date '+%Y_%m_%d_%H_%M_%S').png"
+ },
+ "custom/donotdisturb":{
+ "format": "{}",
+ "exec": "~/.config/waybar/modules/donotdisturb_status.sh",
+ "on-click": "~/.config/waybar/modules/donotdisturb_toggle.sh"
+ },
+ "custom/workspace":{
+ "format": "{}",
+ "exec": "while :; do cat /tmp/swayworkspace && sleep 1; done"
+ },
+
+}
diff --git a/waybar/modules/audio-output.sh b/waybar/modules/audio-output.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+CURRENT=$(wpctl status | sed -n '/^Audio$/,/Sink endpoints:$/p' | sed -n '/\[vol: .*\]/p' | grep '*')
+check_current () { if echo "$CURRENT" | grep -i "$1" &>/dev/null ; then echo true ; fi ; }
+
+case true in
+ "$(check_current "HDMI")") echo '{"text": "HDMI", "alt": "hdmi"}' | jq --unbuffered --compact-output ;;
+ "$(check_current "Wireless")") echo '{"text": "Headphone", "alt": "headphone"}' | jq --unbuffered --compact-output ;;
+ "$(check_current "Galaxy buds")") echo '{"text": "Galaxy Buds", "alt": "buds"}' | jq --unbuffered --compact-output ;;
+ *) echo '{"text": "??", "alt": "others"}' | jq --unbuffered --compact-output ;;
+esac
diff --git a/waybar/modules/audio-volume.sh b/waybar/modules/audio-volume.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+VOLUME=`echo "$(~/.config/waybar/modules/get-volume.sh)*100" | bc | cut -d'.' -f1`
+echo '{"percentage": '$VOLUME'}' | jq --unbuffered --compact-output
diff --git a/waybar/modules/audio.sh b/waybar/modules/audio.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+CURRENT=$(wpctl status | sed -n '/^Audio$/,/Sink endpoints:$/p' | sed -n '/\[vol: .*\]/p' | grep '*')
+VOLUME=`echo "$(~/.config/waybar/modules/get-volume.sh)*100" | bc | cut -d'.' -f1`
+
+if echo "$CURRENT" | grep -i "HDMI" &>/dev/null ; then
+ echo '{"text": "'$VOLUME'", "alt": "hdmi"}' | jq --unbuffered --compact-output
+elif echo "$CURRENT" | grep "Wireless" &>/dev/null ; then
+ echo '{"text": "'$VOLUME'", "alt": "headphone"}' | jq --unbuffered --compact-output
+elif echo "$CURRENT" | grep "Galaxy Buds" &>/dev/null ; then
+ # "percentage": '$(buds_battery.py A8:87:B3:01:80:07 | tr ',' '\n' | sort -n | head -n 1 || echo 1)'
+ echo '{"text": "'$VOLUME'", "alt": "buds"}' | jq --unbuffered --compact-output
+else
+ echo '{"text": "'$VOLUME'", "alt": "other"}' | jq --unbuffered --compact-output
+fi
diff --git a/waybar/modules/donotdisturb_status.sh b/waybar/modules/donotdisturb_status.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+TIMEOUT=1
+
+while [ ! -z $(pidof waybar) ]; do
+ if [ $(makoctl mode) != "default" ]; then
+ echo 'đ'
+ else
+ echo 'đ'
+ fi
+ sleep $TIMEOUT
+done
diff --git a/waybar/modules/donotdisturb_toggle.sh b/waybar/modules/donotdisturb_toggle.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+if [ $(makoctl mode) != "default" ]; then
+ makoctl mode -s default
+else
+ makoctl mode -s away
+fi
+
diff --git a/waybar/modules/get-volume.sh b/waybar/modules/get-volume.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# the metadata only contains the name of the default sink
+default_sink_name=$(pw-metadata 0 'default.audio.sink' | grep 'value' | sed "s/.* value:'//;s/' type:.*$//;" | jq .name)
+default_sink_id=$(pw-dump Node Device | jq '.[].info.props|select(."node.name" == '" $default_sink_name "') | ."object.id"')
+if pw-cli enum-params "$default_sink_id" 'Props' | grep -A 1 "Spa:Pod:Object:Param:Props:mute" | grep true &>/dev/null ; then
+ echo 0
+else
+ echo "$(pw-cli enum-params "$default_sink_id" 'Props' | grep -A 2 'Spa:Pod:Object:Param:Props:channelVolumes' | awk '/Float / {gsub(/.*Float\s/," "); print $1^(1/3) }')"
+fi
diff --git a/waybar/modules/sway-idle-inhibitor.sh b/waybar/modules/sway-idle-inhibitor.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+if [ ! -z $(pidof sway-audio-idle-inhibit) ]; then
+ echo "Turn off sway-audio-idle-inhibit"
+ killall sway-audio-idle-inhibit
+else
+ echo "turn on sway-audio-idle-inhibit"
+ sway-audio-idle-inhibit &
+fi
diff --git a/waybar/style.css b/waybar/style.css
@@ -0,0 +1,306 @@
+* {
+ border: none;
+ border-radius: 5px;
+ /* `otf-font-awesome` is required to be installed for icons */
+ font-family: Roboto, Helvetica, Arial, sans-serif;
+ font-size: 13px;
+ min-height: 0;
+}
+
+window#waybar {
+ background-color: transparent;
+ color: #ffffff;
+ transition-property: background-color;
+ transition-duration: .5s;
+}
+
+window#waybar.hidden {
+ opacity: 0.2;
+}
+
+
+#workspaces button {
+ background: #1f1f1f;
+ color: #ffffff;
+ border-radius: 20px;
+
+}
+
+/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
+#workspaces button:hover {
+ background: lightblue;
+ color: black;
+ border-bottom: 3px solid #ffffff;
+
+}
+
+#workspaces button.focused {
+ background: #1f1f1f;
+}
+
+#workspaces button.focused:hover {
+ background: lightblue;
+ color: black;
+ border-bottom: 3px solid #ffffff;
+
+}
+
+#workspaces button.urgent {
+ background-color: #eb4d4b;
+}
+
+#mode {
+ background-color: #64727D;
+ border-bottom: 3px solid #ffffff;
+}
+
+#clock,
+#battery,
+#cpu,
+#memory,
+#disk,
+#temperature,
+#backlight,
+#network,
+#pulseaudio,
+#custom-media,
+#custom-launcher,
+#custom-power,
+#custom-layout,
+#custom-updater,
+#custom-snip,
+#custom-donotdisturb,
+#custom-workspace,
+#taskbar,
+#tray,
+#mode,
+#idle_inhibitor,
+#mpd {
+ padding: 0 10px;
+ color: #ffffff;
+}
+
+#window,
+#workspaces {
+ margin: 0px 4px;
+}
+
+/* If workspaces is the leftmost module, omit left margin */
+.modules-left > widget:first-child > #workspaces {
+ margin-left: 0px;
+}
+
+/* If workspaces is the rightmost module, omit right margin */
+.modules-right > widget:last-child > #workspaces {
+ margin-right: 0px;
+}
+
+#clock {
+ background-color: #171717;
+ color: #ffffff;
+}
+
+#battery {
+ background-color: #ffffff;
+ color: #000000;
+}
+
+#battery.charging, #battery.plugged {
+ color: #ffffff;
+ background-color: #26A65B;
+}
+
+@keyframes blink {
+ to {
+ background-color: #ffffff;
+ color: #000000;
+ }
+}
+
+#battery.critical:not(.charging) {
+ background-color: #f53c3c;
+ color: #ffffff;
+ animation-name: blink;
+ animation-duration: 0.5s;
+ animation-timing-function: linear;
+ animation-iteration-count: infinite;
+ animation-direction: alternate;
+}
+
+label:focus {
+ background-color: #000000;
+}
+
+#cpu {
+ background-color: #171717;
+ color: #ffffff;
+}
+
+#memory {
+ background-color: #171717;
+ color: #ffffff;
+}
+
+#disk {
+ background-color: #171717;
+ color: #ffffff;
+}
+
+#backlight {
+ background-color: #171717;
+ color: #ffffff;
+}
+
+#network {
+ background-color: #171717;
+ color: #ffffff;
+}
+
+#network.disconnected {
+ background-color: #171717;
+ color: red;
+}
+
+#pulseaudio {
+ background-color: #171717;
+ color: #ffffff;
+}
+
+#pulseaudio.muted {
+ background-color: #171717;
+ color: red;
+}
+
+#custom-media {
+ background-color: #8EC5FC;
+ background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
+ color: black;
+ border-radius: 20px;
+ margin-right: 5px;
+ margin-left: 5px;
+}
+
+#custom-media.custom-spotify {
+ background-color: #8EC5FC;
+ background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
+ color: black;
+ border-radius: 20px;
+ margin-right: 5px;
+
+}
+
+#custom-media.custom-vlc {
+ background-color: #8EC5FC;
+ background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
+ color: black;
+ border-radius: 20px;
+ margin-right: 5px;
+}
+
+#custom-power{
+ background-color: #171717;
+ font-size: 18px;
+ border-radius: 0px 20px 20px 0px;
+ margin-right: 5px;
+}
+
+#custom-launcher{
+ background-color: #171717;
+ font-size: 20px;
+ border-radius: 20px 0px 0px 20px;
+ margin-left: 5px;
+
+}
+
+#custom-layout{
+ background-color: #171717;
+ color: white;
+ font-size:20px;
+}
+
+#custom-updater {
+ background-color: #171717;
+ color: white;
+}
+
+#custom-snip {
+ background-color: #171717;
+ color: skyblue;
+ font-size: 20px;
+}
+
+#custom-donotdisturb {
+ background-color: #171717;
+ color: skyblue;
+ border-radius: 20px 0px 0px 20px;
+}
+
+#custom-workspace {
+ background-color: #171717;
+ color: #fff;
+ font-size: 20px;
+}
+
+#taskbar{
+ background-color: #171717;
+ border-radius: 0px 20px 20px 0px;
+}
+
+#temperature {
+ background-color: #171717;
+ color: #ffffff;
+}
+
+#temperature.critical {
+ background-color: #eb4d4b;
+}
+
+#tray {
+ background-color: #171717;
+ color: #ffffff;
+}
+
+#tray > .passive {
+ -gtk-icon-effect: dim;
+ background-color: #171717;
+ color: #ffffff;
+}
+
+#tray > .needs-attention {
+ -gtk-icon-effect: highlight;
+ background-color: #171717;
+ color: #ffffff;
+}
+
+#idle_inhibitor {
+ background-color: #171717;
+ /* border-radius: 20px 0px 0px 20px; */
+
+}
+
+#idle_inhibitor.activated {
+ background-color: #171717;
+ color: #ffffff;
+ /* border-radius: 20px 0px 0px 20px; */
+
+}
+
+#language {
+ background-color: #171717;
+ color: #ffffff;
+ min-width: 16px;
+}
+
+#keyboard-state {
+ background: #97e1ad;
+ color: #000000;
+ min-width: 16px;
+}
+
+#keyboard-state > label {
+ padding: 0px 5px;
+}
+
+#keyboard-state > label.locked {
+ background: rgba(0, 0, 0, 0.2);
+}