diff --git a/config.yaml b/config.yaml index 965e7cd..b83724c 100644 --- a/config.yaml +++ b/config.yaml @@ -66,6 +66,9 @@ dotfiles: f_ssh-agent.service: src: config/systemd/user/ssh-agent.service dst: ~/.config/systemd/user/ssh-agent.service + d_waybar: + src: config/waybar + dst: ~/.config/waybar profiles: everywhere: dotfiles: @@ -93,6 +96,7 @@ profiles: - f_xdg_desktop_portal_wlr_config - d_local_bin - f_ssh-agent.service + - d_waybar knafeh: dotfiles: - d_vim @@ -114,3 +118,4 @@ profiles: - f_geoclue-agent.service - d_local_bin - f_ssh-agent.service + - d_waybar diff --git a/dotfiles/config/sway/config b/dotfiles/config/sway/config index a82e30e..743ec6e 100644 --- a/dotfiles/config/sway/config +++ b/dotfiles/config/sway/config @@ -265,17 +265,7 @@ bindsym $mod+r mode "resize" # # Read `man 5 sway-bar` for more information about this section. 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 ~/.config/sway/status.py; do sleep 1; done - - colors { - statusline #ffffff - background #323232 - inactive_workspace #32323200 #32323200 #5c5c5c - } + swaybar_command waybar } include /etc/sway/config.d/* diff --git a/dotfiles/config/sway/status.py b/dotfiles/config/sway/status.py deleted file mode 100755 index f26011a..0000000 --- a/dotfiles/config/sway/status.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python3 -# -# Requires the following packages on Arch Linux: -# - ttf-twemoji (and make sure there are no other emoji fonts like noto-fonts-emoji -# - iwd (iwctl) -# - pulsemixer -# - python-psutil - -from datetime import datetime -from subprocess import check_output -from sys import stdout - -from psutil import sensors_battery - - -def write(data): - stdout.write("%s\n" % data) - stdout.flush() - - -def refresh(): - try: - ssid = ( - check_output( - "iwctl station wlan0 show | grep -o 'Connected network.*$' | sed 's/^Connected network\s\+//'", - shell=True, - ) - .strip() - .decode("utf-8") - ) - except Exception: - ssid = "None" - - wifi_status = f"{ssid} 📶" - - battery_percent = int(sensors_battery().percent) - battery_icon = "🔋" - battery_status = f"{battery_percent} {battery_icon}" - power_status = "🔌" if sensors_battery().power_plugged else "" - - try: - # pulsemixer returns "10 10" so we need to split the output to get "10" - volume_level = ( - check_output("pulsemixer --get-volume", shell=True).strip().decode("utf-8") - ) - volume_level = int(volume_level.split(" ")[0]) - - if volume_level >= 70: - volume_icon = "🔊" - elif volume_level >= 30 and volume_level < 70: - volume_icon = "🔉" - elif volume_level < 30 and volume_level >= 1: - volume_icon = "🔈" - else: - volume_icon = "🔇" - except Exception: - volume_level = "" - volume_icon = "" - - volume_status = f"{volume_level} {volume_icon}" - - date = datetime.now().strftime("%Y-%m-%d %l:%M:%S %p") - - write(f"{wifi_status} {volume_status} {battery_status} {power_status} {date}") - - -refresh() diff --git a/dotfiles/config/waybar/config b/dotfiles/config/waybar/config new file mode 100644 index 0000000..e402ac4 --- /dev/null +++ b/dotfiles/config/waybar/config @@ -0,0 +1,70 @@ +{ + "position": "bottom", // Waybar position (top|bottom|left|right) + "height": 25, // Waybar height (to be removed for auto height) + "spacing": 2, // Gaps between modules (4px) + // Choose the order of the modules + "modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad"], + "modules-center": ["sway/window"], + "modules-right": ["idle_inhibitor", "wireplumber", "network", "sway/language", "battery", "clock", "tray"], + // Modules configuration + "sway/workspaces": { + "disable-scroll": true, + }, + "sway/mode": { + "format": "{}" + }, + "sway/scratchpad": { + "format": "{icon} {count}", + "show-empty": false, + "format-icons": ["", ""], + "tooltip": true, + "tooltip-format": "{app}: {title}" + }, + "sway/window": { + "format": "{title}", + "max-length": 50, + }, + "sway/language": { + "format": "{short} {variant}", + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + "tray": { + "spacing": 10 + }, + "clock": { + "tooltip-format": "{:%Y %B}\n{calendar}", + "format": "{:%Y-%m-%d %H:%M %p}" + }, + "battery": { + "states": { + "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{time} {icon}", + "format-icons": ["", "", "", "", ""] + }, + "network": { + "format-wifi": "{essid} ({signalStrength}%) ", + "format-ethernet": "{ipaddr}/{cidr} ", + "tooltip-format": "{ifname} via {gwaddr} ", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": "Disconnected ⚠", + "format-alt": "{ifname}: {ipaddr}/{cidr}" + }, + "wireplumber": { + "format": "{volume}% {icon}", + "format-muted": "", + "on-click": "helvum", + "format-icons": ["", "", ""] + }, +} diff --git a/dotfiles/config/waybar/style.css b/dotfiles/config/waybar/style.css new file mode 100644 index 0000000..3409f43 --- /dev/null +++ b/dotfiles/config/waybar/style.css @@ -0,0 +1,132 @@ +/* List of colors */ + +/* { + --base03: #002b36; + --base02: #073642; + --base01: #586e75; + --base00: #657b83; + --base0: #839496; + --base1: #93a1a1; + --base2: #eee8d5; + --base3: #fdf6e3; + --yellow: #b58900; + --orange: #cb4b16; + --red: #dc322f; + --magenta: #d33682; + --violet: #6c71c4; + --blue: #268bd2; + --cyan: #2aa198; + --green: #859900; +} */ + +* { + border: none; + border-radius: 0; + font-family: Source Sans Pro Semibold, sans-serif; + font-size: 13px; + min-height: 0; +} + +window#waybar { + background-color: #002b36; + color: #d33682; + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + opacity: 0.2; +} + +#workspaces { + border-bottom: 1px solid #586e75; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +#workspaces button { + padding: 0 5px; + background-color: transparent; + color: #657b83; + border-bottom: 3px solid transparent; +} + +#workspaces button.focused { + background-color: #073642; + border-bottom: 1px solid #ff0; +} + +#workspaces button.urgent { + background-color: #d33682; +} + +#clock, #battery, #network, #wireplumber, #tray, #mode, #language, #idle_inhibitor, #window { + padding: 0 10px; + margin: 0 2px; + color: #657b83; +} + +#clock { + background-color: #073642; +} + +#battery { + background-color: #073642; +} + +#battery.charging { + color: #eee8d5; + background-color: #859900; +} + +#language { + background-color: #073642; +} + +@keyframes blink { + to { + background-color: #d33682; + color: #93a1a1; + } +} + +#battery.critical:not(.charging) { + background-color: #dc322f; + color: #93a1a1; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +label:focus { + background-color: #073642; +} + +#network { + background-color: #073642; +} + +#network.disconnected { + background-color: #002b36; +} + +#wireplumber { + background-color: #073642; +} + +#wireplumber.muted { + background-color: #002b36; +} + +#tray { + background-color: #002b36; +} + +#idle_inhibitor { + background-color: #002b36; +} + +#idle_inhibitor.activated { + background-color: #073642; +}