summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2023-01-07 19:41:47 +0100
committerRobert Günzler <r@gnzler.io>2023-01-07 19:54:48 +0100
commitb9c14ef8bd5b0441c4ed6e544d7dbd5adb12e25a (patch)
tree972fa420b24a5ad4deb1776bf1bd8751fb3a3df2
parent927dbee46ea6818890c8d36b71c23f8058d29b42 (diff)
waybar: cleanup
Signed-off-by: Robert Günzler <r@gnzler.io>
-rw-r--r--.config/waybar/colors.css23
-rw-r--r--.config/waybar/config.jsonc63
-rwxr-xr-x.config/waybar/modules/timetracked.sh4
-rwxr-xr-x.config/waybar/modules/vpn.sh7
-rw-r--r--.config/waybar/style.css340
5 files changed, 241 insertions, 196 deletions
diff --git a/.config/waybar/colors.css b/.config/waybar/colors.css
new file mode 100644
index 0000000..6e5c85e
--- /dev/null
+++ b/.config/waybar/colors.css
@@ -0,0 +1,23 @@
+/*
+*
+* Base16 Karafuru Dark
+* Author: robertgzr
+*
+*/
+
+@define-color base00 #0c0c0c;
+@define-color base01 #86c166;
+@define-color base02 #f7d94c;
+@define-color base03 #1c1c1c;
+@define-color base04 #2ea9df;
+@define-color base05 #bdc0ba;
+@define-color base06 #8a6bbe;
+@define-color base07 #fffffb;
+@define-color base08 #db4d6d;
+@define-color base09 #cb1b45;
+@define-color base0A #fad689;
+@define-color base0B #5dac81;
+@define-color base0C #69b0ac;
+@define-color base0D #58b2dc;
+@define-color base0E #70649a;
+@define-color base0F #81c7d4;
diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc
index 050f3fe..70ab60f 100644
--- a/.config/waybar/config.jsonc
+++ b/.config/waybar/config.jsonc
@@ -1,5 +1,5 @@
 {
-  "modules-left": ["sway/mode", "sway/workspaces", "river/tags", "mpris"],
+  "modules-left": ["sway/mode", "sway/workspaces", "mpris"],
 
   "sway/workspaces": {
     "format": "{icon}",
@@ -23,25 +23,17 @@
     "max-width": 60,
     "format": "{player_icon} {dynamic}",
     "format-paused": "{status_icon} <i>{dynamic}</i>",
-    "format-icons": {
+    "player-icons": {
       "default": "󰲸",
-
+      // "firefox": "X",
+      // "mpv": "XX",
+    },
+    "status-icons": {
       "paused": "󰏤",
       "playing": "",
       "stopped": "",
     }
   },
-  // "custom/mpris": {
-  //   "max-width": 60,
-  //   "on-click": "playerctl play-pause",
-  //   "on-click-right": "playerctl next",
-  //   // "exec": "env YAEGI_SYSCALL=1 YAEGI_UNRESTRICTED=1 ${HOME}/.config/waybar/modules/mpris.go",
-  //   // "interval": "once",
-  //   "retart-interval": 1,
-  //   "exec": "${HOME}/.config/waybar/modules/mpris.sh",
-  //   "return-type": "json",
-  //   "signal": 4,
-  // },
 
   // ------------------------------------------------------------------------ //
 
@@ -119,8 +111,7 @@
   },
 
   // ------------------------------------------------------------------------ //
-  // "modules-right": ["tray", "cpu", "memory", "disk#root", "disk#home", "temperature", "idle_inhibitor", "backlight", "custom/gamma", "pulseaudio", "network#mullvad", "network#tailscale", "network", "battery"],
-  "modules-right": ["tray", "cpu", "memory", "disk#root", "disk#home", "temperature", "idle_inhibitor", "custom/gamma", "pulseaudio", "custom/vpn", "network#tailscale", "network", "battery"],
+  "modules-right": ["tray", "cpu", "memory", "disk#root", "disk#home", "temperature", "idle_inhibitor", "backlight", "pulseaudio", "custom/vpn", "network#tailscale", "network", "battery"],
 
   "tray": {
     "icon-size": 15,
@@ -156,20 +147,20 @@
 
   "cpu": {
     "format": "{icon} {usage}%",
-    "format-icons": ["󰊚"],
+    "format-icons": ["󰊚", "󰀦"],
     "on-click": "$HOME/bin/swx -t -- btop"
   },
 
   "memory": {
     "format": "{icon} {percentage}%",
-    "format-icons": ["󰍛"],
+    "format-icons": ["󰘚", "󰀦"], // 󰍛
     "on-click": "$HOME/bin/swx -t -- btop"
   },
 
   "temperature": {
     "critical-threshold": 100,
     "format": "{icon} {temperatureC}℃",
-    "format-icons": ["󱃃", "󰔏", "󱃂", "󰸁"]
+    "format-icons": ["󱃃", "󰔏", "󰸁", "󱜜"]
   },
 
   "idle_inhibitor": {
@@ -181,8 +172,9 @@
   },
 
   "backlight": {
+    "device": "auto",
     "format": "{icon}",
-    "format-icons": ["󰹐", "󰌶", "󰛩"],
+    "format-icons": ["󰹐", "󰌶", "󰛩", "󰖧"],
     "on-scroll-down": "light -A 5",
     "on-scroll-up": "light -U 5",
     // save current level
@@ -206,10 +198,8 @@
 
   "pulseaudio": {
     "format": "{icon} {volume}%",
-    "format-bluetooth": "{icon} {volume}%",
+    "format-bluetooth": "{icon}󰂯 {volume}%",
     "format-muted": "󰝟 {volume}%",
-    "format-source": "󰍬 {volume}%",
-    "format-source-muted": " {volume}%",
     "format-icons": {
       "easyeffects_sink": "󰺢",
       "headphones": "󰋋",
@@ -228,49 +218,40 @@
   "custom/vpn": {
     "exec": "${HOME}/.config/waybar/modules/vpn.sh",
     "interval": 600,
-    "return-type": "json"
+    "return-type": "json",
+    "on-click": "${HOME}/.config/waybar/modules/vpn.sh toggle",
   },
 
-  // "network#mullvad": {
-  //   "interface": "mlvd*",
-  //   "format": "󰒃",
-  //   "format-disconnected": "",
-  //   "tooltip-format": "{ifname}: {bandwidthUpBits} {bandwidthDownBits}",
-  //   "tooltip-format-disconnected": "disconnected",
-  // },
-
   "network#tailscale": {
     "interface": "tailscale0",
     "format": "󰌆",
-    "format-disconnected": "",
+    "format-disconnected": "󰌊",
     "tooltip-format": "{ifname}: {bandwidthUpBits} {bandwidthDownBits}",
     "tooltip-format-disconnected": "disconnected",
-    "on-click": "doas rc-service tailscale start",
-    "on-click-right": "doas rc-service tailscale stop"
+    "on-click": "${HOME}/.config/waybar/modules/tailscale.sh toggle",
   },
 
   "network": {
-    "format-wifi": "{icon} ({signalStrength}%)",
+    "format-wifi": "{icon} {signalStrength}%",
     "format-icons": ["󰤫", "󰤟", "󰤢", "󰤥", "󰤨"],
     "format-ethernet": "󰌗",
     "format-linked": "󰈀 {ifname}",
     "format-disconnected": "󰌙 ",
     "tooltip-format": "{ifname}: {ipaddr}/{cidr}\ngateway: {gwaddr}\nssid: {essid}\nsignal: {signaldBm} dbm\ndown: {bandwidthDownBits}\nup: {bandwidthUpBits}",
     "tooltip-format-disconnected": "disconnected",
-    "on-click": "notify-send 'Connecting...' && doas rc-service iwd start && swx -t -f iwctl",
+    // cycles through wifi/ethernet/off
+    // "on-click": "${HOME}/.config/waybar/modules/network.sh toggle",
   },
 
   "battery": {
     "states": {
-      "good": 95,
+      "good": 90,
       "warning": 30,
       "critical": 15
     },
     "format": "{icon} {capacity}%",
     "format-charging": "󰗱 {capacity}%",
-    "format-plugged": "󰚥 {capacity}%",
-    "format-alt": "{icon} {time}",
-    "format-full": "󱊦",
+    "format-full-charging": "󱊦",
     "format-icons": ["󱃍", "󱊡", "󱊢", "󱊣"]
   },
 }
diff --git a/.config/waybar/modules/timetracked.sh b/.config/waybar/modules/timetracked.sh
index 52611a3..4e384bf 100755
--- a/.config/waybar/modules/timetracked.sh
+++ b/.config/waybar/modules/timetracked.sh
@@ -3,6 +3,10 @@
 set -e
 [ -n "$DEBUG" ] && set -x
 
+if ! command -v timetrace >/dev/null 2>&1; then
+	exit 0
+fi
+
 case "$1" in
 on-click)
 	timetrace status >/dev/null && timetrace stop
diff --git a/.config/waybar/modules/vpn.sh b/.config/waybar/modules/vpn.sh
index 4fc5bdd..c4d50fa 100755
--- a/.config/waybar/modules/vpn.sh
+++ b/.config/waybar/modules/vpn.sh
@@ -3,6 +3,10 @@
 set -e
 [ -n "$DEBUG" ] && set -x
 
+case "$1" in
+toggle) exit 1 ;;
+esac
+
 extern_ip=$(curl -SsfL http://api.ipify.org/?format=text)
 
 vpn_is_up() {
@@ -13,7 +17,8 @@ vpn_is_up() {
 }
 
 if vpn_is_up; then
-	printf '{"text": "󰒃 ", "tooltip": "external ip is %s"}\n' "$extern_ip"
+	printf '{"text": "󰒃", "tooltip": "external ip is %s"}\n' "$extern_ip"
 else
+	# printf '{"text": "󰦜", "tooltip": "disconnected"}\n'
 	printf '{}\n'
 fi
diff --git a/.config/waybar/style.css b/.config/waybar/style.css
index 02b6893..af8cdc5 100644
--- a/.config/waybar/style.css
+++ b/.config/waybar/style.css
@@ -1,43 +1,28 @@
-@define-color color00 #1c1c1c;
-@define-color color01 #db4d6d;
-@define-color color02 #5dac81;
-@define-color color03 #fad689;
-@define-color color04 #58b2dc;
-@define-color color05 #70649a;
-@define-color color06 #69b0ac;
-@define-color color07 #bdc0ba;
-@define-color color08 #0c0c0c;
-@define-color color09 #cb1b45;
-@define-color color10 #86c166;
-@define-color color11 #f7d94c;
-@define-color color12 #2ea9df;
-@define-color color13 #8a6bbe;
-@define-color color14 #81c7d4;
-@define-color color15 #fffffb;
-
-@define-color accent #8a6bbe;
-@define-color accentdarker #70649a;
-
-@define-color foreground @color07;
+@import "colors.css";
+
+@define-color accent @base06;
+@define-color accentdarker @base0E;
+@define-color foreground @base07;
 @define-color background rgba(12, 12, 12, 0.96);
 @define-color dimmed #5e5e5e;
 @define-color dimmeddarker #434343;
-@define-color urgent #9f353a;
+@define-color urgent @base09;
 
 * {
-  border: none;
-  border-radius: 0;
-  font-family: Iosevka Aile, Sarasa Fixed J, Material Design Icons, Font Awesome;
-  font-size: 10pt;
+    border: none;
+    border-radius: 0;
+    font-family: Iosevka Aile, Sarasa Fixed J, Material Design Icons, Font Awesome;
+    font-size: 10pt;
 }
 
 window#waybar {
-  background: @background;
-  color: @foreground;
-  /* padding: 0 0.3rem; */
+    background: @background;
+    color: @foreground;
+    /* padding: 0 0.3rem; */
 }
+
 window#waybar.hidden {
-  opacity: 0;
+    opacity: 0;
 }
 
 
@@ -53,6 +38,7 @@ window#waybar.hidden {
 #idle_inhibitor,
 #network,
 #pulseaudio,
+#wireplumber,
 #custom-toggl,
 #custom-gammastep,
 #custom-weather,
@@ -61,10 +47,10 @@ window#waybar.hidden {
 #custom-covid,
 #custom-timetracked,
 #tray {
-  /* border-top: 1px solid @dimmeddarker; */
-  padding: 0 0.1rem;
-  margin: 0 0.2rem;
-  color: @dimmed;
+    /* border-top: 1px solid @dimmeddarker; */
+    padding: 0 0.1rem;
+    margin: 0 0.2rem;
+    color: @dimmed;
 }
 
 #cpu:hover,
@@ -74,260 +60,306 @@ window#waybar.hidden {
 #network:hover,
 #network.tailscale:hover,
 #pulseaudio:hover,
+#wireplumber:hover,
 #custom-mpris:hover,
 #custom-gammastep:hover,
 #custom-todo:hover {
-  color: @foreground;
-  transition-property: background;
-  transition-duration: 0.1s;
+    color: @foreground;
+    transition-property: background;
+    transition-duration: 0.1s;
 }
 
 #tags button,
 #workspaces button {
-  padding: 0 5px;
-  background: transparent;
-  color: @dimmed;
-  /* border-bottom: 3px solid transparent; */
+    padding: 0 5px;
+    background: transparent;
+    color: @dimmed;
+    /* border-bottom: 3px solid transparent; */
 }
+
 #tags button {
-  color: @dimmeddarker;
+    color: @dimmeddarker;
 }
+
 #tags button.occupied {
-  color: @dimmed;
+    color: @dimmed;
 }
+
 #workspaces button.visible {
-  color: @dimmeddarker;
-  background: @accentdarker;
+    color: @dimmeddarker;
+    background: @accentdarker;
 }
+
 #tags button.focused,
 #workspaces button.focused {
-  font-weight: bold;
-  color: @foreground;
-  background: @accentdarker;
-  transition-property: background;
-  transition-duration: 0.01s;
+    font-weight: bold;
+    color: @foreground;
+    background: @accent;
+    transition-property: background;
+    transition-duration: 0.01s;
 }
+
 #tags button.urgent,
 #workspaces button.urgent {
-  color: @background;
-  background: @urgent;
+    color: @background;
+    background: @urgent;
 }
+
 #tags button:hover,
 #tags button.focused:hover,
 #workspaces button:hover,
 #workspaces button.focused:hover {
-  background: @accent;
-  color: @foreground;
-  transition-property: background, color;
-  transition-duration: 0.01s;
+    background: @accent;
+    color: @foreground;
+    transition-property: background, color;
+    transition-duration: 0.01s;
 
-  /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
-  box-shadow: inherit;
-  text-shadow: inherit;
+    /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
+    box-shadow: inherit;
+    text-shadow: inherit;
 }
+
 #tags button.urgent:hover,
 #workspaces button.urgent:hover {
-  background: @foreground;
-  transition-property: background;
-  transition-duration: 0.01s;
+    background: @foreground;
+    transition-property: background;
+    transition-duration: 0.01s;
 }
 
 #mode {
-  /* font-style: italic; */
-  color: @background;
-  background: @color03;
-  margin: 3px 6px;
-  border-radius: 2px;
+    /* font-style: italic; */
+    color: @background;
+    background: @base03;
+    margin: 3px 6px;
+    border-radius: 2px;
 }
 
 #clock {}
+
 #clock.local {
-  color: @foreground;
-}
-#clock.utc {
+    color: @foreground;
 }
 
+#clock.utc {}
+
 #disk.root {}
+
 #disk.home {
-  /* margin-left: 0; */
-  /* padding-left: 0; */
+    /* margin-left: 0; */
+    /* padding-left: 0; */
 }
 
 #battery {}
+
 #battery.charging {
-  color: @background;
-  background: @color10;
+    color: @background;
+    background: @base0A;
 }
+
 @keyframes blink {
-  to {
-    background: @foreground;
-    color: @background;
-  }
+    to {
+        background: @foreground;
+        color: @background;
+    }
 }
+
 #battery.critical:not(.charging) {
-  color: @foreground;
-  background: @urgent;
-  animation-name: blink;
-  animation-duration: 0.5s;
-  animation-timing-function: linear;
-  animation-iteration-count: infinite;
-  animation-direction: alternate;
+    color: @foreground;
+    background: @urgent;
+    animation-name: blink;
+    animation-duration: 0.5s;
+    animation-timing-function: linear;
+    animation-iteration-count: infinite;
+    animation-direction: alternate;
 }
 
 label:focus {
-  background: @background;
+    background: @background;
 }
 
 #cpu {}
+
 #memory {}
+
 #backlight {}
+
 #backlight.off {
-  color: @dimmed;
+    color: @dimmed;
 }
+
 #network {}
+
 #network.disconnected {
-  border-top: 1px solid @urgent;
-  color: @dimmed;
+    border-top: 1px solid @urgent;
+    color: @dimmed;
 }
+
 #network.tailscale.disabled,
 #network.tailscale.disconnected,
 #network.mullvad.disabled,
 #network.mullvad.disconnected {
-  border-top: 1px solid @dimmeddarker;
+    border-top: 1px solid @dimmeddarker;
 }
 
 #network.tailscale.ethernet,
 #network.tailscale.linked,
 #network.mullvad.ethernet,
 #network.mullvad.linked {
-  color: @foreground;
-  border-top: 1px solid @color14;
+    color: @foreground;
+    border-top: 1px solid @base0E;
 }
+
 #pulseaudio {}
+
 #pulseaudio.muted {
-  border-top: 1px solid @urgent;
-  color: @dimmed;
+    border-top: 1px solid @urgent;
+    color: @dimmed;
 }
+
 #pulseaudio.bluetooth {
-  border-top: 1px solid @color04;
+    border-top: 1px solid @base04;
+}
+
+#wireplumber {}
+
+#wireplumber.muted {
+    border-top: 1px solid @urgent;
+    color: @dimmed;
+}
+
+#wireplumber.bluetooth {
+    border-top: 1px solid @base04;
 }
 
 #temperature {}
+
 #temperature.critical {
-  color: @foreground;
-  background: @urgent;
-  border-top: none;
+    color: @foreground;
+    background: @urgent;
+    border-top: none;
 }
 
 #tray {}
 
 #idle_inhibitor {}
+
 #idle_inhibitor.activated {
-  color: @foreground;
-  border-top: 1px solid @color02;
+    color: @foreground;
+    border-top: 1px solid @base02;
 }
 
-#custom-mpris {
-  color: @foreground;
-}
-#custom-mpris.playing,
-#custom-mpris.paused {
-  border-top: 1px solid @color04;
-}
-#custom-mpris.paused {
-  font-style: italic;
-}
 #mpris {
-  color: @foreground;
+    color: @foreground;
 }
+
 #mpris.playing,
 #mpris.paused {
-  border-top: 1px solid @color04;
+    border-top: 1px solid @base04;
 }
+
 #mpris.paused {
-  font-style: italic;
+    font-style: italic;
+}
+
+#mpris.spotify {
+    border-top: 1px solid #1db954;
+}
+
+#mpris.mpv {
+    border-top: 1px solid #8f008f;
 }
 
 #custom-toggl {
-  color: @foreground;
-  border-top: 1px solid @urgent;
+    color: @foreground;
+    border-top: 1px solid @urgent;
 }
 
 #custom-todo.off {
-  color: @dimmed;
-  border-top: 1px solid @dimmeddarker;
-  padding: 0 0 0 0.4rem;
+    color: @dimmed;
+    border-top: 1px solid @dimmeddarker;
+    padding: 0 0 0 0.4rem;
 }
+
 #custom-todo.on {
-  color: @foreground;
-  border-top: 1px solid @urgent;
-  font-weight: bold;
-  padding: 0 0.6rem 0 0.4rem;
+    color: @foreground;
+    border-top: 1px solid @urgent;
+    font-weight: bold;
+    padding: 0 0.6rem 0 0.4rem;
 }
+
 #custom-todo.work {
-  background: @urgent;
+    background: @urgent;
 }
 
 #custom-timetracked {
-  color: @urgent;
-  border-top: 1px solid @urgent;
+    color: @urgent;
+    border-top: 1px solid @urgent;
 }
 
 @keyframes flash {
-  50% {
-    background: rgba(255,174,66, 0.7);
-    color: @background;
-  }
+    50% {
+        background: rgba(255, 174, 66, 0.7);
+        color: @background;
+    }
 }
+
 #custom-gamma.night {
-  border-top: 1px solid @color12;
-  color: @foreground;
-  animation-name: flash;
-  animation-duration: 0.3s;
-  animation-timing-function: linear;
-  animation-iteration-count: 1;
+    border-top: 1px solid @base0C;
+    color: @foreground;
+    animation-name: flash;
+    animation-duration: 0.3s;
+    animation-timing-function: linear;
+    animation-iteration-count: 1;
 }
+
 #custom-gamma.day {
-  color: @dimmed;
+    color: @dimmed;
 }
+
 #custom-gamma.off {
-  border-top: 1px solid @urgent;
-  color: @dimmed;
+    border-top: 1px solid @urgent;
+    color: @dimmed;
 }
 
 #custom-weather {
-  color: @dimmed;
+    color: @dimmed;
 }
 
 #custom-covid.green {
-  /* border-top: 1px solid #00cc00; */
-  /* color: #00cc00; */
+    /* border-top: 1px solid #00cc00; */
+    /* color: #00cc00; */
 }
+
 #custom-covid.yellow {
-  /* border-top: 1px solid #f7dd31; */
-  /* color: #f7dd31; */
+    /* border-top: 1px solid #f7dd31; */
+    /* color: #f7dd31; */
 }
+
 #custom-covid.orange {
-  /* border-top: 1px solid #faa31b; */
-  /* color: #faa31b; */
+    /* border-top: 1px solid #faa31b; */
+    /* color: #faa31b; */
 }
+
 #custom-covid.red {
-  /* border-top: 1px solid #f92206; */
-  /* color: #f92206; */
+    /* border-top: 1px solid #f92206; */
+    /* color: #f92206; */
 }
+
 #custom-covid.darkred {
-  /* border-top: 1px solid #c01a00; */
-  /* color: #c01a00; */
+    /* border-top: 1px solid #c01a00; */
+    /* color: #c01a00; */
 }
+
 #custom-covid.darkdarkred {
-  /* border-top: 1px solid #941100; */
-  /* color: #941100; */
+    /* border-top: 1px solid #941100; */
+    /* color: #941100; */
 }
 
 #custom-hotspots {
-  border-top: 1px solid @urgent;
-  color: @dimmed;
+    border-top: 1px solid @urgent;
+    color: @dimmed;
 }
+
 #custom-hotspots.soon {
-  color: @urgent;
+    color: @urgent;
 }