From 4a25d79feef0dd6e462abfb48173da7e470127a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 15 Apr 2024 23:34:35 +0200 Subject: Replace i3blocks with swaybar --- config/waybar/config.jsonc | 118 +++++++++++++++++++++ config/waybar/email.sh | 19 ++++ config/waybar/style.css | 254 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 391 insertions(+) create mode 100644 config/waybar/config.jsonc create mode 100755 config/waybar/email.sh create mode 100644 config/waybar/style.css (limited to 'config/waybar') diff --git a/config/waybar/config.jsonc b/config/waybar/config.jsonc new file mode 100644 index 0000000..0c2ad01 --- /dev/null +++ b/config/waybar/config.jsonc @@ -0,0 +1,118 @@ +{ + "ipc": true, + "reload_style_on_change": true, +"modules-left": ["sway/language", "sway/workspaces", "sway/mode", "privacy", "systemd-failed-units"], + "modules-center": ["group/clock", "custom/email","mpd"], + "modules-right": ["wireplumber", "cpu", "memory", "disk#root", "disk#home", "network", "group/hardware", "tray"], + "group/clock": { + "orientation": "horizontal", + "modules": [ + "clock", "idle_inhibitor" + ], + "drawer": { } + }, + "group/hardware": { + "orientation": "horizontal", + "modules": [ + /*"battery", "backlight", "bluetooth", */ + "temperature" + ], + "drawer": { } + }, + + + "cpu": { + "interval": 2, + "format": "{usage}% " + }, + "memory": { + "interval": 10, + "format": "{used}/{total}GiB " + }, + "disk#root": { + "format": "/ {free}", + "path": "/" + }, + "disk#home": { + "format": "/home2 {free}", + "path": "/home2" + }, + "clock": { + "tooltip-format": "{:%Y %B}\n{calendar}", + "format": "{:%F %T}", + "format-alt": "{:%F %T}", + "interval": 1 + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "󰔡", + "deactivated": "󰔢" + } + }, + "wireplumber": { + "format": "{volume}% {icon}", + "format-muted": "Muted 󰓄", + "format-icons": ["󰓃", "", ""], + "on-click": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + }, + + "network": { + "format": "󰈀 {ipaddr}/{cidr} ⇅{bandwidthTotalBytes}", + "format-wifi": " {essid}({signalStrength}%) {ipaddr}/{cidr} ⇅{bandwidthTotalBytes}", + "tooltip-format": "{ifname} via {gwaddr} ↑{bandwidthUpBytes} ↓{bandwidthDownBytes}", + "interval": 1 + }, + + "battery": { + "format": "{capacity}% {icon}", + "format-icons": ["", "", "", "", ""] + }, + "temperature": { + "hwmon-path": "/sys/class/hwmon/hwmon1/temp1_input", + "critical-threshold": 80, + "format-critical": "{temperatureC}°C ", + "format": "{temperatureC}°C " + }, + "bluetooth": { + "format": " {status}", + "format-disabled": "", // an empty format will hide the module + "format-connected": " {num_connections} connected", + "tooltip-format": "{controller_alias}\t{controller_address}", + "tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{device_enumerate}", + "tooltip-format-enumerate-connected": "{device_alias}\t{device_address}" + }, + + "mpd": { + "format-stopped": "", + "format-paused": "{album} - {artist} - {title}", + "on-click": "mpc toggle >/dev/null", + "on-click-right": "mpc stop >/dev/null", + "on-click-backward": "mpc prev >/dev/null", + "on-click-forward": "mpc next >/dev/null" + }, + "privacy": { + "icon-spacing": 4, + "icon-size": 12, + "transition-duration": 250, + "modules": [ + { + "type": "screenshare", + "tooltip": true, + "tooltip-icon-size": 24 + }, + { + "type": "audio-in", + "tooltip": true, + "tooltip-icon-size": 24 + } + ] + }, + + "custom/email": { + "exec": "~/.config/waybar/email.sh", + "interval": 30, + "signal": 13 + } +} +} diff --git a/config/waybar/email.sh b/config/waybar/email.sh new file mode 100755 index 0000000..437566f --- /dev/null +++ b/config/waybar/email.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +filter=("tag:unread" "and" "not" "tag:killed") + +if allsync enabled 2>/dev/null; then + sync="󰑤" +else + sync="" +fi + +part=() +for mail in email gmail elektroline fel; do + counts="$(notmuch count -- "${filter[@]}" and "tag:$mail")" + [ "$counts" = "0" ] || \ + part+=("$mail:$counts") +done + +echo "$sync" "${part[@]}" +echo +echo "#email" diff --git a/config/waybar/style.css b/config/waybar/style.css new file mode 100644 index 0000000..aeb1ce4 --- /dev/null +++ b/config/waybar/style.css @@ -0,0 +1,254 @@ +@keyframes blink-warning { + 70% { + color: @light; + } + + to { + color: @light; + background-color: @warning; + } +} + +@keyframes blink-critical { + 70% { + color: @light; + } + + to { + color: @light; + background-color: @critical; + } +} + + +/* ----------------------------------------------------------------------------- + * Styles + * -------------------------------------------------------------------------- */ + +/* COLORS */ + +/* Nord */ +@define-color bg #2E3440; +/*@define-color bg #353C4A;*/ +@define-color light #D8DEE9; +/*@define-color dark @nord_dark_font;*/ +@define-color warning #ebcb8b; +@define-color critical #BF616A; +@define-color mode #434C5E; +/*@define-color workspaces @bg;*/ +/*@define-color workspaces @nord_dark_font;*/ +/*@define-color workspacesfocused #434C5E;*/ +@define-color workspacesfocused #4C566A; +@define-color tray @workspacesfocused; +@define-color sound #EBCB8B; +@define-color network #5D7096; +@define-color memory #546484; +@define-color cpu #596A8D; +@define-color temp #4D5C78; +@define-color layout #5e81ac; +@define-color battery #88c0d0; +@define-color date #434C5E; +@define-color time #434C5E; +@define-color backlight #434C5E; +@define-color nord_bg #434C5E; +@define-color nord_bg_blue #546484; +@define-color nord_light #D8DEE9; +@define-color nord_light_font #D8DEE9; +@define-color nord_dark_font #434C5E; + +/* Reset all styles */ +* { + border: none; + border-radius: 3px; + min-height: 0; + margin: 0em 0.1em 0em 0.1em; +} + +/* The whole bar */ +#waybar { + background: @bg; + color: @light; + font-family: "Cantarell", "Font Awesome 5 Pro"; + font-size: 10px; + font-weight: bold; +} + +/* Each module */ +#battery, +#clock, +#cpu, +#memory, +#mode, +#network, +#pulseaudio, +#temperature, +#tray, +#backlight, +#language, +#mpd, +#custom-email, +#disk { + padding-left: 0.6em; + padding-right: 0.6em; +} + +/* Each module that should blink */ +#mode, +#memory, +#temperature, +#battery { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +/* Each critical module */ +#memory.critical, +#cpu.critical, +#temperature.critical, +#battery.critical { + color: @critical; +} + +/* Each critical that should blink */ +#mode, +#memory.critical, +#temperature.critical, +#battery.critical.discharging { + animation-name: blink-critical; + animation-duration: 2s; +} + +/* Each warning */ +#network.disconnected, +#memory.warning, +#cpu.warning, +#temperature.warning, +#battery.warning { + background: @warning; + color: @nord_dark_font; +} + +/* Each warning that should blink */ +#battery.warning.discharging { + animation-name: blink-warning; + animation-duration: 3s; +} + +/* And now modules themselves in their respective order */ + +#mode { /* Shown current Sway mode (resize etc.) */ + color: @light; + background: @mode; +} + +/* Workspaces stuff */ + +#workspaces { + margin-right: 10px; +} + +#workspaces button { + font-weight: bold; /* Somewhy the bar-wide setting is ignored*/ + padding: 0; + opacity: 0.3; + background: none; + font-size: 1em; +} + +#workspaces button.focused { + background: @workspacesfocused; + color: #D8DEE9; + opacity: 1; + padding: 0 0.4em; +} + +#workspaces button.urgent { + border-color: #c9545d; + color: #c9545d; + opacity: 1; +} + +#window { + margin-right: 40px; + margin-left: 40px; + font-weight: normal; +} +#bluetooth { + background: @nord_bg_blue; + font-size: 1.2em; + font-weight: bold; + padding: 0 0.6em; +} +#idle_inhibitor { + background: @mode; + font-size: 1.2em; + font-weight: bold; + padding: 0px 0.6em 0px 0.4em; +} + +#network { + background: @nord_bg_blue; +} +#memory { + background: @memory; +} +#cpu { + background: @nord_bg; + color: #D8DEE9; +} +#cpu.critical { + color: @nord_dark_font; +} +#disk { + background: @nord_bg; +} +#language { + background: @nord_bg_blue; + color: #D8DEE9; + padding: 0 0.4em; +} +#temperature { + background-color: @nord_bg; + color: #D8DEE9; +} +#temperature.critical { + background: @critical; +} + +#battery { + background: @battery; +} + +#backlight { + background: @backlight; +} + +#clock { + background: @nord_bg_blue; + color: #D8DEE9; +} +#clock.date { + background: @date; +} + +#clock.time { + background: @mode; +} + +#wireplumber { /* Unsused but kept for those who needs it */ + background: @nord_bg_blue; + color: #D8DEE9; + min-width: 1em; + padding: 0px 0.6em 0px 0.4em; +} +#mpd { + padding: 0px 0px 0px 1em; +} +#custom-email { + color: @warning; + padding: 0px 0.6em 0px 0.4em; +} +#tray { + background: #434C5E; +} -- cgit v1.2.3