From 75143c507d56b6eccb723532a68f68c0b760faa5 Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Sat, 30 Oct 2021 20:27:11 -0700 Subject: [PATCH] waybar --- desktop.conf.yaml | 1 + sway/config | 13 +---- waybar/config | 69 ++++++++++++++++++++++++++ waybar/style.css | 121 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 192 insertions(+), 12 deletions(-) create mode 100644 waybar/config create mode 100644 waybar/style.css diff --git a/desktop.conf.yaml b/desktop.conf.yaml index 322fb27..99a0ec9 100644 --- a/desktop.conf.yaml +++ b/desktop.conf.yaml @@ -7,6 +7,7 @@ ~/.config/qutebrowser: qutebrowser/ ~/.config/sway: sway/ ~/.config/tridactyl: tridactyl/ + ~/.config/waybar: waybar/ ~/.config/xsettingsd: xsettingsd/ ~/.local/share/qutebrowser/userscripts: qutebrowser/userscripts ~/.xinitrc: X/.xinitrc diff --git a/sway/config b/sway/config index 746c016..bf6f485 100644 --- a/sway/config +++ b/sway/config @@ -125,19 +125,8 @@ mode "resize" { } bindsym $super+r mode "resize" -# TODO: man 5 sway-bar bar { - position bottom - - # When the status_command prints a new line to stdout, swaybar updates. - # The default just shows the current date and time. - status_command while date +'%Y-%m-%d %l:%M:%S %p'; do sleep 1; done - - colors { - statusline #ffffff - background #323232 - inactive_workspace #32323200 #32323200 #5c5c5c - } + swaybar_command waybar } set $locker 'swaylock -f -e -F -k -l -c 000000 --indicator-idle-visible' diff --git a/waybar/config b/waybar/config new file mode 100644 index 0000000..0af52bb --- /dev/null +++ b/waybar/config @@ -0,0 +1,69 @@ +{ + "position": "bottom", + "height": 24, + + "modules-left": [ + "sway/workspaces", + "sway/mode", + "sway/window", + ], + "modules-center": [], + "modules-right": [ + "idle_inhibitor", + "network", + "pulseaudio", + "battery", + "clock", + ], + + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + }, + "tooltip": false, + }, + "clock": { + "interval": 1, + "format": "{:%Y-%m-%d %H:%M:%S}", + "tooltip-format": "{:%B %Y (W%U)}\n{calendar}", + }, + "battery": { + "states": { + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{time} {icon}", + "format-icons": ["", "", "", "", ""] + }, + "network": { + "format-wifi": "{essid} ", + "format-ethernet": "{ifname} ", + "format-linked": "{ifname} ", + "format-disconnected": "Disconnected ⚠", + "format-alt": "{ifname}", + "tooltip-format": "{ipaddr}/{cidr}" + }, + "pulseaudio": { + "scroll-step": 0, + "format": "{volume}% {icon} {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": "{volume}-  {format_source}", + "format-source": "{volume}% ", + "format-source-muted": "{volume}- ", + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] + }, + }, +} diff --git a/waybar/style.css b/waybar/style.css new file mode 100644 index 0000000..bfdcf23 --- /dev/null +++ b/waybar/style.css @@ -0,0 +1,121 @@ +* { + border: none; + border-radius: 0; + /* `otf-font-awesome` is required to be installed for icons */ + font-family: Roboto, Helvetica, Arial, sans-serif; + font-size: 12px; + min-height: 0; +} + +window#waybar { + background-color: #222222; + color: #dfdfdf; +} + +#workspaces button { + padding: 0 1px; + color: #ffffff; + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -1px transparent; +} + +#workspaces button:hover { + box-shadow: inherit; + text-shadow: inherit; +} + +#workspaces button.focused { + background-color: #444444; + color: #ffffff; + box-shadow: inset 0 -1px #ffb52a; +} + +#workspaces button.urgent { + background-color: #bd2c40; +} + +#mode { + background-color: #444444; + color: #ffb52a; +} + +#clock, +#battery, +#network, +#pulseaudio, +#mode, +#idle_inhibitor, +#mpd { + padding: 0; + margin: 0 4px; + color: #ffffff; +} + +#window, +#workspaces { + margin: 0 4px; +} + +/* If workspaces is the leftmost module, omit left margin */ +.modules-left > widget:first-child > #workspaces { + margin-left: 0; +} + +/* If workspaces is the rightmost module, omit right margin */ +.modules-right > widget:last-child > #workspaces { + margin-right: 0; +} + +#clock { + box-shadow: inset 0 -1px #0a6cf5; +} + +#battery { + box-shadow: inset 0 -1px #ffb52a; +} + +#battery.charging, #battery.plugged { + box-shadow: inset 0 -1px #2affb5; +} + +#battery.warning { + box-shadow: inset 0 -1px #f56c0a; +} + +#battery.critical { + box-shadow: inset 0 -1px #f50a0a; +} + +@keyframes blink { + to { + background-color: #f50a0a; + } +} + +#battery.critical:not(.plugged) { + animation-name: blink; + animation-duration: 1s; + animation-timing-function: ease-in-out; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +label:focus { + background-color: #000000; +} + +#network { + box-shadow: inset 0 -1px #9f78e1; +} + +#pulseaudio { + box-shadow: inset 0 -1px #e83c3a; +} + +#pulseaudio.muted { + box-shadow: inset 0 -1px transparent; +} + +#idle_inhibitor.activated { + box-shadow: inset 0 -1px #ffffff; +}