From 4812b349b5f18d824c6e58441d27d430f279577c Mon Sep 17 00:00:00 2001 From: Christian Colglazier Date: Fri, 22 Oct 2021 16:37:11 -0400 Subject: [PATCH] Initial support for sway and waybar --- i3/shared.conf | 4 +- scripts/desktop/waybar-start.sh | 7 ++ scripts/setup.sh | 3 +- waybar/config | 104 +++++++++++++++++ waybar/style.css | 193 ++++++++++++++++++++++++++++++++ 5 files changed, 309 insertions(+), 2 deletions(-) create mode 100755 scripts/desktop/waybar-start.sh create mode 100644 waybar/config create mode 100644 waybar/style.css diff --git a/i3/shared.conf b/i3/shared.conf index 29a437c..a07e0fe 100644 --- a/i3/shared.conf +++ b/i3/shared.conf @@ -173,6 +173,7 @@ exec_always --no-startup-id setxkbmap -option 'caps:super' # Startup scripts exec --no-startup-id sh ~/.config/scripts/connect-nas.sh exec --no-startup-id systemctl --user start polybar +exec --no-startup-id waybar & # class border backgr. text indicator child_border client.focused $pink $pink $pink $pink $pink @@ -186,7 +187,8 @@ client.background $blue # Removes border and title bar for_window [class="^.*"] border pixel 4 #new_window 1pixel -new_float normal 4 +#new_float normal 4 +default_floating_border normal 4 #new_window normal 0 px # Screenshots diff --git a/scripts/desktop/waybar-start.sh b/scripts/desktop/waybar-start.sh new file mode 100755 index 0000000..d2e5796 --- /dev/null +++ b/scripts/desktop/waybar-start.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Stop all waybar instances +killall -q waybar +while pgrep -x waybar >/dev/null; do sleep 0.1; done + +waybar & diff --git a/scripts/setup.sh b/scripts/setup.sh index 5d5cbcc..ca5eea6 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -18,7 +18,8 @@ files=($dotdir/.zprofile ~/ 'n' $dotdir/polybar ~/.config/ 'n' $dotdir/rofi ~/.config/ 'n' $dotdir/scripts ~/.config/ 'n' - $dotdir/systemd ~/.config/ 'n') + $dotdir/systemd ~/.config/ 'n' + $dotdir/waybar ~/.config/ 'n') # arg parser for arg in "$@" diff --git a/waybar/config b/waybar/config new file mode 100644 index 0000000..bf1402c --- /dev/null +++ b/waybar/config @@ -0,0 +1,104 @@ +{ + "layer": "top", + "output": ["DVI-D-0", "LVDS-1"], + "position": "top", + "height": 35, // Waybar height (to be removed for auto height) + "modules-left": ["sway/workspaces", "sway/mode", "custom/media"], + "modules-center": ["sway/window"], + "modules-right": ["pulseaudio", "network", "backlight", "battery", "tray", "clock"], + // Modules configuration + "sway/workspaces": { + "disable-scroll": true, + "all-outputs": true, + "format": "{icon}", + "format-icons": { + "1": "1", + "2": "", + "3": "3", + "4": "4", + "5": "5", + "urgent": "", + "focused": "", + "default": "" + } + }, + "keyboard-state": { + "numlock": true, + "capslock": true, + "format": "{icon} {name}", + "format-icons": { + "locked": "", + "unlocked": "" + } + }, + "sway/mode": { + "format": "{}" + }, + "tray": { + // "icon-size": 21, + "spacing": 10 + }, + "clock": { + "interval": 1, + "format": "{:%I:%M}", + "format-alt": "{:%Y-%m-%d %I:%M:%S}", + "tooltip": false + }, + "temperature": { + // "thermal-zone": 2, + // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", + "critical-threshold": 80, + "format-critical": "{icon} {temperatureC}°C", + "format": "{icon} {temperatureC}°C", + "format-icons": ["", "", ""] + }, + "backlight": { + // "device": "acpi_video1", + "format": "{icon} {percent}%", + "format-icons": [""] + }, + "battery": { + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{icon} {capacity}%", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{icon} {time}", + "format-good": "", // An empty format will hide the module + "format-full": "", + "format-icons": ["", "", "", "", ""] + }, + "network": { + // "interface": "wlp2*", // (Optional) To force the use of this interface + "format-wifi": "{icon} {essid}", + "format-ethernet": "{ipaddr}/{cidr} ", + "tooltip-format": "{ifname} via {gwaddr} ", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": "Disconnected ⚠", + "format-alt": "{ifname}: {ipaddr}/{cidr}", + "format-icons": [""] + }, + "pulseaudio": { + // "scroll-step": 1, // %, can be a float + "format": "{icon} {volume}% {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": "{format_source}", + "format-source": " {volume}%", + "format-source-muted": "", + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] + }, + "on-click": "qjackctl" + } +} + diff --git a/waybar/style.css b/waybar/style.css new file mode 100644 index 0000000..82f7e38 --- /dev/null +++ b/waybar/style.css @@ -0,0 +1,193 @@ +* { + border: none; + border-radius: 0; + /* `otf-font-awesome` is required to be installed for icons */ + font-family: SF Pro Display, Helvetica, Arial, sans-serif; + font-size: 18px; + min-height: 0; +} + +window#waybar { + background-color: rgba(0, 0, 0, 0.5); + border-bottom: 3px solid rgba(0, 0, 0, 0.5); + color: #ffffff; + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + background-color: #000000; +} + +window#waybar.empty { + background-color: #000000; +} +window#waybar.solo { + background-color: #000000; +} + +/* Empyty Space */ +window#waybar.termite { + background-color: #000000; + border-bottom: 3px solid rgba(0, 0, 0, 0.5); +} + +window#waybar.chromium { + background-color: #000000; + border: none; +} + +#workspaces button { + padding: 0 5px; + background-color: transparent; + color: #ffffff; + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -3px transparent; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +#workspaces button:hover { + background: rgba(0, 0, 0, 0.2); + box-shadow: inset 0 -3px #B3E5FC; +} + +#workspaces button.focused { + background-color: #0288D1; + box-shadow: inset 0 -3px #B3E5FC; +} + +#workspaces button.urgent { + background-color: #E91E63; +} + +#mode { + background-color: #000000; + border-bottom: 3px solid #B3E5FC; +} + +#clock, +#battery, +#cpu, +#memory, +#disk, +#temperature, +#backlight, +#network, +#pulseaudio, +#custom-media, +#tray, +#mode, +#idle_inhibitor, +#mpd { + padding: 0 10px; + margin: 0 4px; + color: #FFFFFF; + background-color: #0288D1; +} + +#window, +#workspaces { + margin: 0 4px; +} + +/* If workspaces is the leftmost module, omit left margin */ +.modules-left > widget:first-child > #workspaces { + margin-left: 0px; +} + +/* If workspaces is the rightmost module, omit right margin */ +.modules-right > widget:last-child > #workspaces { + margin-right: 5px; +} + +#clock { + background-color: #0288D1; +} + +#battery { + background-color: #ffffff; + color: #000000; +} + +#battery.charging, #battery.plugged { + color: #ffffff; + background-color: #2980b9; +} + +@keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } +} + +#battery.critical:not(.charging) { + background-color: #E91E63; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +label:focus { + background-color: #000000; +} + +#cpu { + background-color: #2980b9; + color: #000000; +} + +#memory { + background-color: #2980b9; +} + +#disk { + background-color: #2980b9; +} + +#backlight { + background-color: #2980b9; +} + +#network { + background-color: #2980b9; +} + +#network.disconnected { + background-color: #E91E63; +} + +#pulseaudio { + background-color: #0288D1; + color: #FFFFFF; +} + +#pulseaudio.muted { + background-color: #FFFFFF; + color: #000000; +} + +#tray { + background-color: #0288D1; +} + +#tray > .passive { + -gtk-icon-effect: dim; +} + +#tray > .needs-attention { + -gtk-icon-effect: highlight; + background-color: #E91E63; +} + +#idle_inhibitor { + background-color: #000000; +} + +#idle_inhibitor.activated { + background-color: #FFFFFF; + color: #000000; +}