summaryrefslogtreecommitdiff
path: root/.config/waybar
diff options
context:
space:
mode:
authorseraphim <18ycm9tx@anonaddy.me>2026-08-23 18:07:29 +0700
committerseraphim <18ycm9tx@anonaddy.me>2026-08-23 18:07:29 +0700
commited3e8f6ec6929327ab19e512ffb0d8ece12ed5a8 (patch)
treef1a783af87d29b8d78ce20df5a485f92b8c32d5d /.config/waybar
parent3c71645d355910b6998e97a1efca6f5a7c7608bc (diff)
reorganize directories, so everything in .config
Diffstat (limited to '.config/waybar')
-rw-r--r--.config/waybar/config.jsonc112
-rwxr-xr-x.config/waybar/kbd-layout.sh42
-rw-r--r--.config/waybar/style.css166
-rw-r--r--.config/waybar/theme-dark.css2
-rw-r--r--.config/waybar/theme-light.css2
l---------.config/waybar/theme.css1
6 files changed, 325 insertions, 0 deletions
diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc
new file mode 100644
index 0000000..c20a95c
--- /dev/null
+++ b/.config/waybar/config.jsonc
@@ -0,0 +1,112 @@
+{
+ "exclusive": true,
+ "reload_style_on_change": true,
+ "position": "top",
+ "margin-top": 0,
+ "spacing": 0,
+ "height": 0,
+ "margin-bottom": 0,
+ "modules-left": [
+ "niri/workspaces",
+ "custom/separator",
+ "tray",
+ "custom/separator2",
+ "custom/separator5",
+ "custom/media",
+ "custom/separator6"
+ ],
+ "modules-center": ["custom/separator", "custom/clock", "custom/separator2"],
+ "modules-right": [
+ "custom/separator",
+ "custom/separator3",
+ "custom/kbd",
+ "custom/separator3",
+ "pulseaudio",
+ "custom/separator3",
+ "memory",
+ "custom/separator2"
+ ],
+ "niri/workspaces": {
+ "disable-scroll": true,
+ "format": "{index}"
+ },
+ "custom/separator": {
+ "format": "[",
+ "tooltip": false
+ },
+ "custom/separator2": {
+ "format": "]",
+ "tooltip": false
+ },
+ "custom/separator3": {
+ "format": "󰿟",
+ "tooltip": false
+ },
+ "custom/separator5": {
+ "exec": "sh -c 'if pgrep -x cliamp >/dev/null || playerctl status 2>/dev/null | grep -qE \"Playing|Paused\"; then echo \"{\\\"text\\\":\\\"[\\\",\\\"class\\\":\\\"show\\\"}\"; else echo \"{\\\"text\\\":\\\"\\\",\\\"class\\\":\\\"hide\\\"}\"; fi'",
+ "return-type": "json",
+ "interval": 2,
+ "format": "{}"
+ },
+ "custom/separator6": {
+ "exec": "sh -c 'if pgrep -x cliamp >/dev/null || playerctl status 2>/dev/null | grep -qE \"Playing|Paused\"; then echo \"{\\\"text\\\":\\\"]\\\",\\\"class\\\":\\\"show\\\"}\"; else echo \"{\\\"text\\\":\\\"\\\",\\\"class\\\":\\\"hide\\\"}\"; fi'",
+ "return-type": "json",
+ "interval": 2,
+ "format": "{}"
+ },
+
+ "memory": {
+ "interval": 2,
+ "format": "RAM {percentage:02}%",
+ "on-click": "foot btop",
+ "states": {
+ "warning": 50,
+ "critical": 80
+ }
+ },
+ "custom/kbd": {
+ "exec": "/home/seraphim/dotfiles-gentoo/waybar/.config/waybar/kbd-layout.sh",
+ "tooltip": false
+ },
+ "custom/clock": {
+ "exec": "date +'%H:%M %p - %A, %b %d' | tr '[:upper:]' '[:lower:]'",
+ "interval": 1,
+ "tooltip": false
+ },
+ "pulseaudio": {
+ "justify": "center",
+ "format": "vol {volume}%",
+ "on-click": "foot wiremix",
+ "on-click-right": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle",
+ "tooltip-format": "Playing at {volume}%",
+ "scroll-step": 5,
+ "format-muted": "vol <span style='italic' weight='900' color='#999999'>muted</span>",
+ "format-icons": {
+ "headphone": "",
+ "default": ["", "", ""]
+ },
+ "states": {
+ "warning": 50,
+ "critical": 10
+ }
+ },
+ "custom/media": {
+ "format": "{}",
+ "max-length": 30,
+ "interval": 2,
+ "exec": "playerctl metadata --format '{{ artist }} - {{ title }}' 2>/dev/null || echo \"\"",
+ "on-click": "playerctl play-pause"
+ },
+"tray": {
+ "icon-size": 14,
+ "spacing": 3
+ },
+ "custom/analyze-theme": {
+ "exec": "node /home/seraphim/dotfiles-gentoo/waybar/.config/waybar/custom/analyze-theme.js",
+ "interval": 5,
+ "tooltip": true,
+ "format": "{}",
+ "return-type": "json",
+ "on-click": "sh -c '~/.config/niri/apply-colors.sh \"$(find ~/Pictures/wallpapers -type f | shuf -n 1)\"'"
+ }
+}
diff --git a/.config/waybar/kbd-layout.sh b/.config/waybar/kbd-layout.sh
new file mode 100755
index 0000000..e81462a
--- /dev/null
+++ b/.config/waybar/kbd-layout.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Kill any leftover instances so reloads don't pile up.
+for p in $(pgrep -f "kbd-layout.sh"); do
+ [ "$p" != "$$" ] && kill "$p" 2>/dev/null
+done
+
+STATE="${XDG_RUNTIME_DIR:-/tmp}/waybar-kbd.state"
+rm -f "$STATE"
+
+# Index of the Russian layout (from configured layouts), so we don't hardcode order.
+RUS_IDX=$(niri msg keyboard-layouts 2>/dev/null | grep -i russian | grep -oE '^[ *]*[0-9]+' | tr -d ' *' | head -1)
+
+kbd_query() {
+ niri msg keyboard-layouts 2>/dev/null | grep -Fm1 '*' | grep -qi russian && echo Ru || echo En
+}
+
+# Parse a "Keyboard layout switched: N" or "...current_idx: N" event line.
+kbd_event() {
+ idx=$(printf '%s' "$1" | grep -oE '[0-9]+' | tail -1)
+ [ "$idx" = "$RUS_IDX" ] && echo Ru || echo En
+}
+
+emit() {
+ v="$1"; src="$2"
+ echo "$v"
+ echo "$v" > "$STATE"
+}
+
+# Instant path: react to niri's layout-change events.
+niri msg event-stream 2>/dev/null | {
+ while true; do
+ if IFS= read -r -t 0.2 line; then
+ case "$line" in
+ *"Keyboard layout switched"*|*"Keyboard layouts changed"*) emit "$(kbd_event "$line")" event ;;
+ esac
+ else
+ v=$(kbd_query)
+ [ "$(cat "$STATE" 2>/dev/null)" != "$v" ] && emit "$v" poll
+ fi
+ done
+}
diff --git a/.config/waybar/style.css b/.config/waybar/style.css
new file mode 100644
index 0000000..cf8dbee
--- /dev/null
+++ b/.config/waybar/style.css
@@ -0,0 +1,166 @@
+@import "/home/seraphim/dotfiles-gentoo/waybar/.config/waybar/theme.css";
+@define-color bg @background;
+@define-color fg @foreground;
+
+* {
+ border: none;
+ padding: 0px;
+ font-family: "JetBrains Mono Nerd Font";
+ transition: background-color .3s ease-out;
+ font-weight: bold;
+ font-size: 12px;
+}
+
+window#waybar {
+ background-color: transparent;
+}
+
+#waybar > box {
+ border-radius: 0px;
+ border-bottom: 1.5px solid alpha(@foreground, 0.12);
+ margin: 0px 0px 2px 0px;
+ background-color: @background;
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 1);
+ min-height: 25px;
+ transition-property: background-color;
+ transition-duration: .5s;
+}
+
+.modules-left {
+ margin-left: 4px;
+}
+
+.modules-right {
+ margin-right: 4px;
+}
+
+#workspaces {
+ margin: 0px 0px;
+ transition: 0.1s ease-in-out;
+ padding: 0px 0px;
+}
+
+#workspaces button {
+ all: initial;
+ padding: 0px 4px;
+ margin: 4px 2px;
+ min-width: 10px;
+ color: @foreground;
+ opacity: 1;
+ font-weight: 900;
+}
+
+#workspaces button.active {
+ color: @background;
+ background-color: @foreground;
+ padding: 0px 4px;
+ margin: 4px 2px;
+ opacity: 1.0;
+}
+
+#workspaces button.empty:hover,
+#workspaces button:hover {
+ background: transparent;
+ color: alpha(@foreground, 1);
+ transition: all 150ms ease;
+ opacity: 0.75;
+}
+
+#workspaces button.empty {
+ opacity: 0.4;
+ padding: 0px 4px;
+ margin: 4px 2px;
+ color: alpha(@foreground, 0.45);
+}
+
+#workspaces button.empty.active {
+ opacity: 1;
+ background-color: @foreground;
+ color: @background;
+}
+
+#memory,
+#custom-media,
+#custom-kbd,
+#tray,
+#cpu,
+#custom-clock,
+#bluetooth,
+#pulseaudio {
+ min-width: 12px;
+ padding: 0 4px;
+ margin: 1px 3px 1px 3px;
+ opacity: 1;
+ color: @foreground;
+}
+
+#tray {
+ opacity: 1;
+ padding-top: 2px;
+}
+
+#custom-separator6,
+#custom-separator5,
+#custom-separator4,
+#custom-separator3,
+#custom-separator2,
+#custom-separator {
+ opacity: 0.2;
+ padding-top: 2px;
+ padding-left: 2px;
+ padding-right: 2px;
+ font-size: 14px;
+}
+
+tooltip {
+ padding: 2px;
+}
+
+.hidden {
+ opacity: 0;
+}
+
+tooltip {
+ padding: 4px;
+ background: @background;
+ font-size: 10px;
+ border: 1.5px solid alpha(@foreground, 0.6);
+ border-radius: 8px;
+}
+
+tooltip label {
+ color: alpha(@foreground, 0.65);
+ font-weight: normal;
+}
+
+#custom-media {
+ opacity: 1;
+ color: @foreground;
+ animation: repeat;
+ animation-name: blink;
+ animation-duration: 3s;
+ animation-timing-function: linear;
+ animation-iteration-count: infinite;
+ animation-direction: alternate;
+}
+
+@keyframes blink {
+ to {
+ color: #999999;
+ }
+}
+
+#pulseaudio.warning,
+#memory.warning,
+#cpu.warning {
+ color: alpha(@foreground, 0.65);
+ background-color: @background;
+}
+
+#pulseaudio.critical,
+#memory.critical,
+#cpu.critical {
+ color: @foreground;
+ background-color: @background;
+ font-weight: 900;
+}
diff --git a/.config/waybar/theme-dark.css b/.config/waybar/theme-dark.css
new file mode 100644
index 0000000..d88a91d
--- /dev/null
+++ b/.config/waybar/theme-dark.css
@@ -0,0 +1,2 @@
+@define-color background #111111;
+@define-color foreground #fafafa;
diff --git a/.config/waybar/theme-light.css b/.config/waybar/theme-light.css
new file mode 100644
index 0000000..b757ab6
--- /dev/null
+++ b/.config/waybar/theme-light.css
@@ -0,0 +1,2 @@
+@define-color background #fafafa;
+@define-color foreground #111111;
diff --git a/.config/waybar/theme.css b/.config/waybar/theme.css
new file mode 120000
index 0000000..aea3c67
--- /dev/null
+++ b/.config/waybar/theme.css
@@ -0,0 +1 @@
+theme-dark.css \ No newline at end of file