pub / sway-config

Configuration for the Sway Wayland Compositor
git clone src.jayvii.de/pub/sway-config.git
Home | Log | Files | Exports | Refs | RSS

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:
Awaybar/config | 137+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Awaybar/modules/audio-output.sh | 11+++++++++++
Awaybar/modules/audio-volume.sh | 4++++
Awaybar/modules/audio.sh | 15+++++++++++++++
Awaybar/modules/donotdisturb_status.sh | 12++++++++++++
Awaybar/modules/donotdisturb_toggle.sh | 8++++++++
Awaybar/modules/get-volume.sh | 10++++++++++
Awaybar/modules/sway-idle-inhibitor.sh | 9+++++++++
Awaybar/style.css | 306+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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); +}