Switch to waybar
Remove custom sway status.py script and use waybar instead.
This commit is contained in:
parent
3f5393758e
commit
c7a14964b0
@ -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
|
||||
|
@ -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/*
|
||||
|
@ -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()
|
70
dotfiles/config/waybar/config
Normal file
70
dotfiles/config/waybar/config
Normal file
@ -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": "<span style=\"italic\">{}</span>"
|
||||
},
|
||||
"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": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
|
||||
"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": ["", "", ""]
|
||||
},
|
||||
}
|
132
dotfiles/config/waybar/style.css
Normal file
132
dotfiles/config/waybar/style.css
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user