chore: add sway and waybar config

This commit is contained in:
Andrea
2024-01-27 13:45:42 +01:00
parent 1b4698d5c4
commit 711fbea929
4 changed files with 564 additions and 0 deletions

132
waybar/config.jsonc Normal file
View File

@@ -0,0 +1,132 @@
{
"layer": "bottom",
"position": "bottom",
"margin": "5 5 5 5",
"modules-left": ["sway/workspaces", "sway/mode", "custom/pacman"],
"modules-center": ["clock", "idle_inhibitor"],
"modules-right": [
"pulseaudio",
"backlight",
"battery",
"bluetooth",
"network"
],
"sway/workspaces": {
"disable-scroll": true,
"format": "{name}"
},
"custom/pacman": {
"format": "{} ",
"interval": 3600,
"exec": "checkupdates | wc -l",
"exec-if": "[[ $(checkupdates | wc -l) != 0 ]]",
"signal": 8,
"tooltip": false
},
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"clock": {
"timezone": "Europe/Rome",
"format": "{:%H:%M}",
"format-alt": "{:%Y-%m-%d}",
"tooltip-format": "<tt><small>{calendar}</small></tt>",
"calendar": {
"mode": "year",
"mode-mon-col": 3,
"weeks-pos": "right",
"on-scroll": 1,
"on-click-right": "mode",
"format": {
"months": "<span color='#ffead3'><b>{}</b></span>",
"days": "<span color='#ecc6d9'><b>{}</b></span>",
"weeks": "<span color='#99ffdd'><b>W{}</b></span>",
"weekdays": "<span color='#ffcc66'><b>{}</b></span>",
"today": "<span color='#ff6699'><b><u>{}</u></b></span>"
}
},
"actions": {
"on-click-right": "mode",
"on-click-forward": "tz_up",
"on-click-backward": "tz_down",
"on-scroll-up": "shift_up",
"on-scroll-down": "shift_down"
}
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"pulseaudio": {
"reverse-scrolling": 1,
"format": "{volume}% {icon} {format_source}",
"format-bluetooth": "{icon} {volume}% {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": "pavucontrol",
"min-length": 13
},
"backlight": {
"device": "intel_backlight",
"format": "{percent}% {icon}",
"format-icons": ["", "", "", "", "", "", ""],
"min-length": 7
},
"battery": {
"states": {
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-charging": "{capacity}% ",
"format-plugged": "{capacity}% ",
"format-alt": "{time} {icon}",
"format-icons": ["", "", "", "", "", "", "", "", "", ""],
"on-update": "$HOME/.config/waybar/scripts/check_battery.sh"
},
"bluetooth": {
"format": " {status}",
"format-connected": " {device_alias}",
"format-connected-battery": " {device_alias} {device_battery_percentage}%",
"tooltip-format": "{controller_alias}\t{controller_address}\n\n{num_connections} connected",
"tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}",
"tooltip-format-enumerate-connected": "{device_alias}\t{device_address}",
"tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t{device_battery_percentage}%",
"on-click": "blueman-manager"
},
"network": {
"format": "{ifname}",
"format-wifi": "{essid} ",
"format-ethernet": "{ipaddr}/{cidr} 󰊗",
"tooltip-format": "{ifname} via {gwaddr} 󰊗",
"tooltip-format-wifi": "{essid} ",
"tooltip-format-ethernet": "{ifname} ",
"tooltip-format-disconnected": "Disconnected",
"max-length": 50,
"on-click": "alacritty -e 'nmtui'"
}
}

18
waybar/scripts/check_battery.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/sh
bat=/sys/class/power_supply/BAT1
CRIT=${1:-15}
FILE=~/.config/waybar/scripts/notified
stat=$(cat $bat/status)
perc=$(cat $bat/capacity)
if [[ $perc -le $CRIT ]] && [[ $stat == "Discharging" ]]; then
if [[ ! -f "$FILE" ]]; then
notify-send --urgency=critical --icon=dialog-warning "Battery Low" "Current charge: $perc%"
touch $FILE
fi
elif [[ -f "$FILE" ]]; then
rm $FILE
fi

161
waybar/style.css Normal file
View File

@@ -0,0 +1,161 @@
* {
border: none;
border-radius: 0;
/* `otf-font-awesome` is required to be installed for icons */
font-family: Liberation Mono;
min-height: 20px;
}
window#waybar {
background: transparent;
}
window#waybar.hidden {
opacity: 0.2;
}
#workspaces {
border-radius: 10px;
transition: none;
background: #383c4a;
margin-right: 8px;
}
#workspaces button {
transition: none;
color: #7c818c;
background: transparent;
padding: 5px;
font-size: 18px;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
transition: none;
box-shadow: inherit;
text-shadow: inherit;
border-radius: inherit;
color: #383c4a;
background: #7c818c;
}
#workspaces button.focused {
color: white;
}
#custom-pacman,
#mode,
#clock,
#idle_inhibitor,
#battery,
#pulseaudio,
#bluetooth,
#network,
#backlight {
padding-left: 8px;
padding-right: 8px;
border-radius: 10px;
background: #383c4a;
}
#custom-pacman {
transition: none;
color: #ffffff;
}
#bluetooth {
margin-right: 8px;
}
#bluetooth.connected, #bluetooth.on {
background-color: #26a65b;
}
#bluetooth.disabled, #bluetooth.off {
background-color: #f53c3c;
}
#mode {
transition: none;
color: #ffffff;
}
#clock {
transition: none;
color: #ffffff;
margin-right: 8px;
}
#idle_inhibitor {
transition: none;
color: #ffffff;
}
#idle_inhibitor.activated {
background-color: #26a65b;
}
#pulseaudio {
margin-right: 8px;
transition: none;
color: #ffffff;
}
#pulseaudio.muted,
#pulseaudio.source-muted {
background-color: #90b1b1;
color: #2a5c45;
}
#backlight {
margin-right: 8px;
transition: none;
color: #ffffff;
}
#battery {
margin-right: 8px;
transition: none;
color: #ffffff;
}
#battery.charging {
color: #ffffff;
background-color: #26a65b;
}
#battery.warning:not(.charging) {
background-color: #ffbe61;
color: black;
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#network {
transition: none;
color: #ffffff;
background: #383c4a;
}
#network.wifi, #network.ethener {
background-color: #26a65b;
}
#network.disabled, #network.disconnected {
background-color: #f53c3c;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}