summary refs log tree commit diff
path: root/.config/waybar
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.config/waybar/config.jsonc326
-rw-r--r--.config/waybar/menu-network.xml15
-rwxr-xr-x.config/waybar/module-calendar.sh29
-rwxr-xr-x.config/waybar/module-screenrec.sh13
-rwxr-xr-x.config/waybar/module-tailscale.sh33
-rwxr-xr-x.config/waybar/module-timew.sh11
-rw-r--r--.config/waybar/style-dark.css13
-rw-r--r--.config/waybar/style-light.css16
-rw-r--r--.config/waybar/style.css180
9 files changed, 636 insertions, 0 deletions
diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc
new file mode 100644
index 0000000..eac00c8
--- /dev/null
+++ b/.config/waybar/config.jsonc
@@ -0,0 +1,326 @@
+{
+  "position": "top",
+  "spacing": 0,
+  "reload_style_on_change": true,
+
+  // ------------------------------------------------------------------------ //
+
+  "modules-left": [
+    "custom/launcher",
+    "river/mode",
+    "river/tags",
+    "river/window",
+  ],
+
+  "custom/launcher": {
+    "format": "",
+    "tooltip": false,
+    "on-click": "riverctl spawn fuzzel",
+  },
+
+  "river/mode": {},
+
+  "river/tags": {
+    "format": ":{}",
+    "num-tags": 9,
+    "hide-vacant": true,
+  },
+
+  "river/window": {
+    "expand": true,
+    "max-length": 50,
+  },
+
+  // ------------------------------------------------------------------------ //
+
+  "modules-center": [
+    "privacy",
+    "custom/screenrec",
+    "clock#local",
+    "clock#utc",
+    "custom/calendar",
+    "custom/timew",
+  ],
+
+  "privacy": {
+    "icon-size": 9,
+    "modules": [
+      { "type": "screenshare" },
+      { "type": "audio-in" },
+    ],
+  },
+
+  "custom/screenrec": {
+    "format": "{icon}",
+    "format-icons": {
+      "running": "󰹑"
+    },
+    "exec": "~/.config/waybar/module-screenrec.sh",
+    "return-type": "json",
+    "interval": "once",
+    "signal": 1,
+  },
+
+  "clock#local": {
+    "format": "<i>{:%a</i> %d %b <b>%H:%M}</b>",
+    "tooltip-format": "TZ: {:%Z %z}\n\n<tt>{calendar}</tt>",
+    "locale": "",
+    "calendar": {
+      "mode": "year",
+      "mode-mon-col": 3,
+      "weeks-pos": "",
+      "on-scroll": 1,
+      "format": {
+        "today": "<span color='red'><b><u>{}</u></b></span>",
+      },
+    },
+    "actions": {
+      "on-click-right": "mode",
+    },
+  },
+
+  "clock#utc": {
+    "format": "<small>{:%Z</small> %H:%M}",
+    "format-alt": "<small>{:%Z %z</small> %a %b %d %H:%M}",
+    "tooltip-format": "{tz_list}",
+    "timezones": [
+      "Etc/UTC",
+
+      "America/Los_Angeles",
+      "Europe/Berlin",
+      "Europe/Istanbul",
+      "Asia/Kolkata",
+      "Asia/Tokyo",
+    ],
+    "actions": {
+      "on-scroll-up": "tz_up",
+      "on-scroll-down": "tz_down",
+    },
+  },
+
+  "custom/calendar": {
+    "exec": "~/.config/waybar/module-calendar.sh",
+    "return-type": "json",
+    "interval": 10800,
+    "on-click": "calm",
+  },
+
+  "custom/timew": {
+    "exec": "~/.config/waybar/module-timew.sh",
+    "return-type": "json",
+    "interval": 900,
+  },
+
+  // ------------------------------------------------------------------------ //
+
+  "modules-right": [
+    "mpris",
+    "tray",
+    "group/tailscale",
+    "group/net",
+    "bluetooth",
+    "group/sys",
+    "idle_inhibitor",
+    "backlight",
+    "pulseaudio",
+    "power-profiles-daemon",
+    "upower",
+  ],
+
+  "mpris": {
+    "max-length": 50,
+    "format": "{player_icon} {dynamic}",
+    "format-paused": "{status_icon} <i>{dynamic}</i>",
+    "dynamic-order": ["artist", "title", "length"],
+    "player-icons": {
+      "default": "󰲸",
+      "firefox": "",
+      "librewolf": "",
+      "spotify": "󰓇",
+      "mpv": "",
+    },
+    "status-icons": {
+      "paused": "",
+      "playing": "",
+      "stopped": "",
+    }
+  },
+
+  "tray": {
+    "icon-size": 13,
+    "spacing": 2
+  },
+
+  "group/net": {
+    "orientation": "inherit",
+    "drawer": {
+      "transition-duration": 0,
+      "click-to-reveal": true,
+    },
+    "modules": [
+      "network#primary",
+      "network#bandwidth",
+    ],
+  },
+
+  "network#primary": {
+    "format-wifi": "󰖩{signalStrength}%",
+    "format-ethernet": "󰈀",
+    "format-disconnected": "󰌙",
+    //  SSID:      {essid}
+    //             {bssid}
+    // 󱄙 Signal:    {signaldBm} dBm
+    //  Frequency: {frequency} MHz
+    //
+    // 󰛳 Interface: {ifname}
+    // 󰩟 IP:        {ipaddr}
+    // 󱂇 Gateway:   {gwaddr}/{cidr}
+    "tooltip-format-wifi": " SSID:      {essid}\n            {bssid}\n󱄙 Signal:    {signaldBm} dBm\n Frequency: {frequency} MHz\n\n󰛳 Interface: {ifname}\n󰩟 IP:        {ipaddr}\n󱂇 Gateway:   {gwaddr}/{cidr}",
+    "tooltip-format-ethernet": "󰛳 Interface: {ifname}\n󰩟 IP:        {ipaddr}\n󱂇 Gateway:   {gwaddr}/{cidr}",
+    "menu": "on-click-right",
+    "menu-file": "~/.config/waybar/menu-network.xml",
+    "menu-actions": {
+      "open-netm": "netm",
+      "airplane-mode": "fyi todo",
+    },
+    "on-click": "netm",
+  },
+
+  "network#bandwidth": {
+    "format": "󱦲{bandwidthUpBytes} 󱦳{bandwidthDownBytes}",
+  },
+
+  "group/tailscale": {
+    "orientation": "inherit",
+    "modules": [
+      "network#tailscale",
+      "custom/tailscale",
+    ],
+  },
+
+  "network#tailscale": {
+    "interface": "tailscale0",
+    "format": "󱗼",
+    "format-disconnected": "",
+    "format-disabled": "",
+    "format-linked": "",
+    "tooltip-format": "{ifname}: {bandwidthUpBits} {bandwidthDownBits}",
+    "tooltip-format-disconnected": "disconnected",
+    "on-click": "vpnm",
+  },
+
+  "custom/tailscale": {
+    "format": "{icon}",
+    "format-icons": {
+      "exit-node": "󰞀",
+      "work": "work",
+    },
+    "exec": "~/.config/waybar/module-tailscale.sh",
+    "return-type": "json",
+    "signal": 2,
+    "on-click": "vpnm",
+  },
+
+  "bluetooth": {
+    "format-on": "󰂯",
+    "format-off": "󰂲",
+    "format-disabled": "󰂲",
+    "format-no-controller": "󰂲",
+    "format-connected": "󰂱",
+    "format-connected-battery": "󰂱{icon}",
+    "format-icons": ["󰂎","󱊡","󱊢","󱊣"],
+    "tooltip-format": "{device_enumerate}",
+    "tooltip-format-enumerate-connected": "{device_alias} {device_address}",
+    "tooltip-format-enumerate-connected-battery": "{device_alias} {device_address} {device_battery_percentage}%",
+    "on-click": "blum"
+  },
+
+  "group/sys": {
+    "orientation": "inherit",
+    "drawer": {
+      "transition-duration": 0,
+      "click-to-reveal": true,
+    },
+    "modules": [
+      "load",
+      "cpu",
+      "memory",
+      "temperature",
+    ],
+  },
+
+  "load": {
+    "format": "{load1} {load5} {load15}",
+    "on-right-click": "foot -a foot-float -W 120x40 -- btop"
+  },
+
+  "cpu": {
+    "format": "cpu:{usage}%",
+    "format-icons": ["󰍛","󰍛","󰍛","󰍛","󰀦"],
+  },
+
+  "memory": {
+    "format": "mem:{percentage}%",
+    "format-icons": ["󰘚"],
+  },
+
+  "temperature": {
+    "critical-threshold": 100,
+    "format": "{icon}{temperatureC}℃",
+    "format-icons": ["󱃃", "󰔏", "󰸁", "󱜜"]
+  },
+
+  "idle_inhibitor": {
+    "format": "{icon}",
+    "format-icons": {
+      "activated": "󰅶",
+      "deactivated": "󰾪"
+    }
+  },
+
+  "backlight": {
+    "device": "auto",
+    "format": "󰃠{percent}%",
+    "actions": {
+      "on-scroll-up": "brightnessctl set 5%+",
+      "on-scroll-down": "brightnessctl set 5%-",
+    },
+    "reverse-scrolling": true,
+  },
+
+  "pulseaudio": {
+    "format": "{icon}{volume}%",
+    "format-muted": "󰖁{volume}%",
+    "format-icons": {
+      "headphones": "󰋋",
+      "headset": "󰋎",
+      "phone": "󰏲",
+      "portable": "󱀞",
+      "default": ["󰕿", "󰖀", "󰕾"]
+    },
+    "reverse-scrolling": true,
+    "on-click": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle",
+    "on-click-right": "audm",
+  },
+
+  "power-profiles-daemon": {
+    "format": "{icon}",
+    "tooltip-format": "Power profile: {profile}\nDriver: {driver}",
+    "tooltip": true,
+    "format-icons": {
+      "default": "",
+      "performance": "󰚌",
+      "balanced": "󰫕",
+      "power-saver": ""
+    }
+  },
+
+  "upower": {
+    "format": "{percentage} {time}",
+    "format-alt": "{percentage}",
+    "icon-size": 9,
+    "hide-if-empty": true,
+    "tooltip": true,
+  },
+}
+// vim: et sw=2
diff --git a/.config/waybar/menu-network.xml b/.config/waybar/menu-network.xml
new file mode 100644
index 0000000..11b78f7
--- /dev/null
+++ b/.config/waybar/menu-network.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+    <object class="GtkMenu" id="menu">
+        <child>
+            <object class="GtkMenuItem" id="open-netm">
+                <property name="label">Open netm</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkMenuItem" id="airplane-mode">
+                <property name="label">Toggle airplane mode</property>
+            </object>
+        </child>
+    </object>
+</interface>
diff --git a/.config/waybar/module-calendar.sh b/.config/waybar/module-calendar.sh
new file mode 100755
index 0000000..6b20e2f
--- /dev/null
+++ b/.config/waybar/module-calendar.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+set -eu
+[ -n "${DEBUG:-}" ] && set -x
+
+shopt -s extglob
+
+update() {
+	local today tn
+	local text
+
+	# get events
+	today=$(~/src/calsync/ics2calendartxt ~/calendars/**/**/* 2>/dev/null |
+		grep -I "$(date -I)")
+	[ -z "$today" ] && return
+
+	tn=$(wc -l <<<"$today")
+
+	# 	text="$today"
+	# 	text="${text##"$(date +'%Y-%m-%d w%V %a ')"}"
+	# 	text="${text##+([^ ]) }"
+
+	text="󰃭 $tn"
+
+	jq -nrc '{text:$text,tooltip:$tip}' \
+		--arg tip "$today" \
+		--arg text "$text"
+}
+
+update || echo '{}'
diff --git a/.config/waybar/module-screenrec.sh b/.config/waybar/module-screenrec.sh
new file mode 100755
index 0000000..b98733c
--- /dev/null
+++ b/.config/waybar/module-screenrec.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+set -eu
+[ -n "${DEBUG:-}" ] && set -x
+
+update() {
+	if ! pgrep -x wl-screenrec >/dev/null; then
+		echo '{}'
+	else
+		echo '{"class":"running","alt":"running"}'
+	fi
+}
+
+update
diff --git a/.config/waybar/module-tailscale.sh b/.config/waybar/module-tailscale.sh
new file mode 100755
index 0000000..53b0409
--- /dev/null
+++ b/.config/waybar/module-tailscale.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+set -eu
+[ -n "${DEBUG:-}" ] && set -x
+
+update() {
+	local ts_acct ts_ip
+	local class text alt
+
+	if tailscale status | grep -q stopped; then
+		return 1
+	fi
+
+	ts_ip=$(tailscale ip -1 || return 1)
+	ts_acct=$(tailscale switch --list 2>/dev/null | awk '/\*$/{ print gensub(/^.* ([^ ]+)\*$/, "\\1", "1") }')
+
+	alt="$ts_acct"
+	class="$ts_acct"
+	# only display account name when not "main"
+	[ "$ts_acct" = "main" ] || text=$ts_acct
+
+	if tailscale exit-node list | grep -q selected; then
+		alt="exit-node"
+		class="exit-node"
+	fi
+
+	jq -nrc '{text:$text,tooltip:$tip,class:$class,alt:$alt}' \
+		--arg tip "${ts_ip:?}" \
+		--arg class "${class:?}" \
+		--arg alt "${alt:?}" \
+		--arg text "${text:-}"
+}
+
+update || echo '{}'
diff --git a/.config/waybar/module-timew.sh b/.config/waybar/module-timew.sh
new file mode 100755
index 0000000..6b3df10
--- /dev/null
+++ b/.config/waybar/module-timew.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -eu
+[ -n "${DEBUG:-}" ] && set -x
+
+shopt -s extglob
+
+update() {
+	timew waybar
+}
+
+update || echo '{}'
diff --git a/.config/waybar/style-dark.css b/.config/waybar/style-dark.css
new file mode 100644
index 0000000..5fd324c
--- /dev/null
+++ b/.config/waybar/style-dark.css
@@ -0,0 +1,13 @@
+/* ::start style */
+@define-color bk #101010;
+@define-color wh #b0b0b0;
+@define-color ac #70649a;
+@define-color ur #ff5733;
+@define-color gr #86cd82;
+@define-color ye #d9ba73;
+@define-color bl #5abfb5;
+@define-color fg @wh;
+@define-color bg @bk;
+@define-color di shade(@fg, 0.5);
+/* ::end style */
+@import url("style.css");
diff --git a/.config/waybar/style-light.css b/.config/waybar/style-light.css
new file mode 100644
index 0000000..be6995d
--- /dev/null
+++ b/.config/waybar/style-light.css
@@ -0,0 +1,16 @@
+/* ::start style */
+@define-color bk #101010;
+@define-color wh #faf9f5;
+@define-color ac #70649a;
+@define-color ur #ca0043;
+@define-color gr #86cd82;
+@define-color ye #926200;
+@define-color bl #007d7d;
+@define-color fg @bk;
+@define-color bg @wh;
+@define-color di shade(@bg, 0.4);
+/* ::end style */
+@import url("style.css");
+#tags button.focused label {
+  color: @bg;
+}
diff --git a/.config/waybar/style.css b/.config/waybar/style.css
new file mode 100644
index 0000000..7e22eb3
--- /dev/null
+++ b/.config/waybar/style.css
@@ -0,0 +1,180 @@
+* {
+  font-family: DejaVu Sans Mono, Symbols Nerd Font Mono, monospace;
+}
+* {
+  border: none;
+  border-radius: 0;
+  font-size: 7pt;
+  min-height: 0;
+  border: none;
+  box-shadow: none;
+  margin: 0;
+  padding: 0;
+  background: transparent;
+  color: @fg;
+  transition: none;
+  text-shadow: none;
+  box-shadow: none;
+  border: none;
+  -gtk-icon-shadow: none;
+  -gtk-icon-effect: none;
+}
+
+window#waybar {
+  background: alpha(@bg, 0.99);
+}
+
+.module {
+  padding: 0 3px;
+  padding-bottom: 1px;
+}
+label.module {
+  color: @di;
+}
+
+tooltip, menu {
+  background: alpha(@bg, 0.99);
+  border: 1px solid shade(@fg, 0.8);
+}
+tooltip label {
+  color: shade(@fg, 0.8);
+}
+menuitem {
+  border: 1px solid shade(@fg, 0.8);
+  border-top: none;
+  border-bottom: none;
+  padding: 3px 0;
+}
+menuitem label {
+  color: @fg;
+}
+menuitem:hover {
+  background: @fg;
+  font-weight: bold;
+}
+menuitem:hover label {
+  color: @bg;
+}
+
+
+#custom-launcher {
+  margin-left: 5px;
+  color: @fg;
+}
+
+#mode {
+  background: @ac;
+  color: white;
+}
+#mode.normal {
+  font-size: 0;
+  min-height: 0;
+  min-width: 0;
+  padding: 0;
+  margin: 0;
+  border: 0;
+  opacity: 0;
+}
+
+#tags button {
+  min-width: unset;
+  padding: 0 3px;
+}
+#tags label {
+  color: @di;
+}
+#tags button:hover {
+  background: @ac;
+}
+#tags button.occupied label {
+  color: @fg;
+}
+#tags button.focused {
+  font-weight: bold;
+  background: @ac;
+}
+#tags button.focused:not(.occupied) {
+  background: shade(@ac, 0.75);
+}
+#tags button.focused:not(.occupied) label {
+  color: @bg;
+}
+#tags button.urgent {
+  background: @ur;
+}
+#tags button.urgent label {
+  color: @bg;
+}
+
+#privacy-item {
+  padding: 0 3px;
+}
+
+#privacy-item,
+#custom-screenrec.running,
+#custom-screenrec.running {
+  color: @bk;
+  background: @ye;
+}
+
+#clock.local {
+  color: @fg;
+}
+
+#mpris.paused {
+  color: shade(@di, 1.5);
+  font-style: italic;
+}
+
+#network.tailscale {
+  color: @fg;
+}
+#custom-tailscale.exit-node,
+#custom-tailscale.work {
+  color: @bl;
+  box-shadow: inset 0 -1px @bl;
+  /* color: @bk; */
+  /* background: @bl; */
+  font-weight: bold;
+}
+
+#bluetooth.connected {
+  box-shadow: inset 0 -1px @bl;
+  color: @bl;
+}
+
+#idle_inhibitor.activated {
+  background: @fg;
+  color: @bg;
+}
+
+#pulseaudio.bluetooth {
+  color: @bl;
+}
+#pulseaudio.muted {
+  color: @ur;
+  box-shadow: inset 0 -1px @ur;
+}
+
+#power-profiles-daemon.power-saver {
+  color: @gr;
+  box-shadow: inset 0 -1px @gr;
+}
+#power-profiles-daemon.performance {
+  color: @bk;
+  background: @ye;
+}
+
+#upower * {
+}
+#upower.charging {
+  box-shadow: inset 0 -1px @gr;
+  background: unset;
+}
+#upower.empty {
+  background: @ur;
+}
+
+/*
+vim: et sw=2:
+*/