migrate to waybar
This commit is contained in:
parent
3712da4322
commit
5176aac39d
@ -13,7 +13,7 @@ git:.config/git .local/bin/ga
|
|||||||
ranger:.config/ranger
|
ranger:.config/ranger
|
||||||
yazi:.config/yazi
|
yazi:.config/yazi
|
||||||
gpg:
|
gpg:
|
||||||
sway:.config/sway .config/i3blocks .config/mako .config/mimeapps.list .config/rofi .local/bin/screenshot .config/swaylock .Xresources .config/kanshi .local/bin/firefox_media %copypasta %pomodoro
|
sway:.config/sway .config/waybar .config/mako .config/mimeapps.list .config/rofi .local/bin/screenshot .config/swaylock .Xresources .config/kanshi .local/bin/firefox_media %copypasta %pomodoro
|
||||||
pomodoro:
|
pomodoro:
|
||||||
bat:.config/bat
|
bat:.config/bat
|
||||||
font:
|
font:
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
bar {
|
bar {
|
||||||
mode dock
|
mode dock
|
||||||
position bottom
|
position bottom
|
||||||
status_command i3blocks
|
status_command waybar
|
||||||
wrap_scroll no
|
wrap_scroll no
|
||||||
bindsym button4 nop
|
bindsym button4 nop
|
||||||
bindsym button5 nop
|
bindsym button5 nop
|
||||||
@ -16,4 +16,4 @@ bar {
|
|||||||
modifier $mod
|
modifier $mod
|
||||||
}
|
}
|
||||||
|
|
||||||
exec ~/.config/i3blocks/scripts/layout_change_handler.sh
|
exec ~/.config/waybar/scripts/layout_change_handler.sh
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
# vim: ft=swayconfig
|
# vim: ft=swayconfig
|
||||||
# Sway bindings
|
# Sway bindings
|
||||||
|
|
||||||
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% && pkill -RTMIN+1 i3blocks
|
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% && pkill -RTMIN+1 waybar
|
||||||
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% && pkill -RTMIN+1 i3blocks
|
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% && pkill -RTMIN+1 waybar
|
||||||
bindsym --locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -RTMIN+1 i3blocks
|
bindsym --locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -RTMIN+1 waybar
|
||||||
|
|
||||||
bindsym --locked XF86AudioPlay exec playerctl play-pause
|
bindsym --locked XF86AudioPlay exec playerctl play-pause
|
||||||
bindsym --locked XF86AudioPause exec playerctl play-pause
|
bindsym --locked XF86AudioPause exec playerctl play-pause
|
||||||
@ -14,7 +14,7 @@ bindsym --locked XF86Tools exec pavucontrol
|
|||||||
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
|
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
|
||||||
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
|
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
|
||||||
|
|
||||||
bindsym --to-code $mod+p exec pomodoro toggle && pkill -RTMIN+2 i3blocks
|
bindsym --to-code $mod+p exec pomodoro toggle && pkill -RTMIN+2 waybar
|
||||||
|
|
||||||
bindsym $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk
|
bindsym $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk
|
||||||
bindsym --release $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute
|
bindsym --release $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute
|
||||||
|
|||||||
@ -78,5 +78,5 @@ layer_effects "waybar" {
|
|||||||
blur_xray enable;
|
blur_xray enable;
|
||||||
blur_ignore_transparent enable;
|
blur_ignore_transparent enable;
|
||||||
shadows enable;
|
shadows enable;
|
||||||
corner_radius 20;
|
corner_radius 10;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,42 +1,95 @@
|
|||||||
{
|
{
|
||||||
"layer": "bottom",
|
"layer": "bottom",
|
||||||
"position": "bottom",
|
"position": "bottom",
|
||||||
|
"height": 30,
|
||||||
|
"spacing": 4,
|
||||||
|
|
||||||
"modules-left": [
|
"modules-left": [
|
||||||
"sway/workspaces",
|
"sway/workspaces",
|
||||||
"sway/mode",
|
"sway/mode"
|
||||||
],
|
],
|
||||||
"modules-center": [],
|
|
||||||
"modules-right": [
|
"modules-right": [
|
||||||
"sway/language",
|
"custom/wireless",
|
||||||
"clock",
|
"custom/bluetooth",
|
||||||
|
"custom/volume",
|
||||||
|
"custom/diskroot",
|
||||||
|
"custom/diskhome",
|
||||||
|
"custom/memory",
|
||||||
|
"custom/cpu_usage",
|
||||||
|
"custom/cpu_temp",
|
||||||
|
"custom/battery",
|
||||||
|
"custom/language",
|
||||||
|
"custom/pomodoro",
|
||||||
|
"custom/userhost",
|
||||||
|
"custom/time",
|
||||||
"tray"
|
"tray"
|
||||||
],
|
],
|
||||||
"sway/workspaces": {
|
|
||||||
"disable-scroll": true
|
"custom/wireless": {
|
||||||
|
"exec": "~/.config/waybar/scripts/builder.sh wireless",
|
||||||
|
"interval": 10,
|
||||||
|
"return-type": "text"
|
||||||
},
|
},
|
||||||
"clock": {
|
"custom/diskroot": {
|
||||||
"format": " {:%F %a %H:%M}",
|
"exec": "~/.config/waybar/scripts/builder.sh disk_root",
|
||||||
"format-alt": " {:%A, %B %d, %Y (%R)}",
|
"interval": 30,
|
||||||
"tooltip-format": "<tt><small>{calendar}</small></tt>",
|
"return-type": "text"
|
||||||
"calendar": {
|
|
||||||
"mode" : "year",
|
|
||||||
"mode-mon-col" : 3,
|
|
||||||
"weeks-pos" : "right",
|
|
||||||
"on-scroll" : 1,
|
|
||||||
"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": {
|
"custom/diskhome": {
|
||||||
"on-click-right": "mode",
|
"exec": "~/.config/waybar/scripts/builder.sh disk_home",
|
||||||
"on-scroll-up": "tz_up",
|
"interval": 30,
|
||||||
"on-scroll-down": "tz_down",
|
"return-type": "text"
|
||||||
"on-scroll-up": "shift_up",
|
|
||||||
"on-scroll-down": "shift_down"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
"custom/memory": {
|
||||||
|
"exec": "~/.config/waybar/scripts/builder.sh memory",
|
||||||
|
"interval": 5,
|
||||||
|
"return-type": "text"
|
||||||
|
},
|
||||||
|
"custom/cpu_usage": {
|
||||||
|
"exec": "~/.config/waybar/scripts/builder.sh cpu_usage",
|
||||||
|
"interval": 5,
|
||||||
|
"return-type": "text"
|
||||||
|
},
|
||||||
|
"custom/cpu_temp": {
|
||||||
|
"exec": "~/.config/waybar/scripts/builder.sh cpu_temp",
|
||||||
|
"interval": 5,
|
||||||
|
"return-type": "text"
|
||||||
|
},
|
||||||
|
"custom/bluetooth": {
|
||||||
|
"exec": "~/.config/waybar/scripts/builder.sh bluetooth_battery",
|
||||||
|
"interval": 5,
|
||||||
|
"return-type": "text"
|
||||||
|
},
|
||||||
|
"custom/volume": {
|
||||||
|
"exec": "~/.config/waybar/scripts/builder.sh volume",
|
||||||
|
"interval": 1,
|
||||||
|
"return-type": "text",
|
||||||
|
"signal": 1
|
||||||
|
},
|
||||||
|
"custom/pomodoro": {
|
||||||
|
"exec": "~/.config/waybar/scripts/builder.sh pomodoro",
|
||||||
|
"interval": 1,
|
||||||
|
"return-type": "text",
|
||||||
|
"signal": 2
|
||||||
|
},
|
||||||
|
"custom/language": {
|
||||||
|
"exec": "~/.config/waybar/scripts/builder.sh language",
|
||||||
|
"return-type": "text",
|
||||||
|
"signal": 3
|
||||||
|
},
|
||||||
|
"custom/userhost": {
|
||||||
|
"exec": "~/.config/waybar/scripts/builder.sh userhost",
|
||||||
|
"return-type": "text",
|
||||||
|
},
|
||||||
|
"custom/battery": {
|
||||||
|
"exec": "~/.config/waybar/scripts/builder.sh battery",
|
||||||
|
"interval": 30,
|
||||||
|
"return-type": "text"
|
||||||
|
},
|
||||||
|
"custom/time": {
|
||||||
|
"exec": "~/.config/waybar/scripts/builder.sh time",
|
||||||
|
"interval": 30,
|
||||||
|
"return-type": "text"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
125
home/user/.config/waybar/scripts/builder.sh
Executable file
125
home/user/.config/waybar/scripts/builder.sh
Executable file
@ -0,0 +1,125 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ue
|
||||||
|
|
||||||
|
|
||||||
|
readonly EXIT_SUCCESS=0
|
||||||
|
readonly EXIT_FAILURE=1
|
||||||
|
|
||||||
|
|
||||||
|
cmd_wireless() {
|
||||||
|
wifiname="$(LANG=C nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d: -f2)"
|
||||||
|
wifi_ip=$(ip -o -4 addr show | grep wlp | awk '{print $4}' | cut -d/ -f1 | head -1)
|
||||||
|
|
||||||
|
if [ -z "${wifiname}" ] || [ -z "${wifi_ip}" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf ' %s %s\n' "${wifiname}" "${wifi_ip}"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_battery() {
|
||||||
|
charging_status="$(cat /sys/class/power_supply/BAT0/status)"
|
||||||
|
percent="$(cat /sys/class/power_supply/BAT0/capacity)"
|
||||||
|
|
||||||
|
if [ "${percent}" -lt 35 ]; then
|
||||||
|
emoji_status="🪫"
|
||||||
|
else
|
||||||
|
emoji_status="🔋"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${charging_status}" = "Charging" ]; then
|
||||||
|
emoji_status="🔌"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "%s %s%%\n" "${emoji_status}" "${percent}"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_disk_root() {
|
||||||
|
df -h / | awk '/\// {print "/ "$3"/"$2}'
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_disk_home() {
|
||||||
|
res="$(df -h /home)"
|
||||||
|
if [ "$(echo "${res}" | awk '/\// {print $6}')" = "/" ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
df -h /home | awk '/\// {print " "$3"/"$2}'
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_memory() {
|
||||||
|
free -h | awk '/^Mem/ {print "🎟 "$3"/"$2}' | sed 's/i//g'
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_cpu_usage() {
|
||||||
|
top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print " "100 - $1"%"}'
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_cpu_temp() {
|
||||||
|
temp_mC="$(cat /sys/class/thermal/thermal_zone0/temp)"
|
||||||
|
temp_C="$((temp_mC / 1000))"
|
||||||
|
|
||||||
|
if [ "${temp_C}" -gt 80 ]; then
|
||||||
|
printf '<span foreground="red"> %s°C</span>\n' "${temp_C}"
|
||||||
|
else
|
||||||
|
printf ' %s°C\n' "${temp_C}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_time() {
|
||||||
|
LC_ALL=C date '+ %d.%m.%y %a %H:%M'
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_volume() {
|
||||||
|
value="$(pactl --format=json get-sink-volume @DEFAULT_SINK@ | jq --raw-output '.volume."front-left".value_percent')"
|
||||||
|
printf ' %s\n' "${value}"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_pomodoro() {
|
||||||
|
pomodoro get
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_bluetooth_battery() {
|
||||||
|
device="$(upower -e | grep headset | head -1)"
|
||||||
|
upower -i "${device}" | grep percentage | awk '{ print "🎧"$2"" }'
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_language() {
|
||||||
|
layout="$(swaymsg -t get_inputs | jq -r '.[] | select(.type == "keyboard") | .xkb_active_layout_name' | head -1)"
|
||||||
|
|
||||||
|
case "${layout}" in
|
||||||
|
"English (US)")
|
||||||
|
printf '🇬🇧 En\n'
|
||||||
|
;;
|
||||||
|
Russian)
|
||||||
|
printf '🇷🇺 Ru\n'
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf '🌐 %s\n' "${layout}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_userhost() {
|
||||||
|
printf "%s@%s\n" "${USER}" "${HOST:-${HOSTNAME:-}}"
|
||||||
|
}
|
||||||
|
|
||||||
|
case "${1}" in
|
||||||
|
wireless) shift; cmd_wireless "$@" ;;
|
||||||
|
ethernet) shift; cmd_ethernet "$@" ;;
|
||||||
|
battery) shift; cmd_battery "$@" ;;
|
||||||
|
disk_root) shift; cmd_disk_root "$@" ;;
|
||||||
|
disk_home) shift; cmd_disk_home "$@" ;;
|
||||||
|
memory) shift; cmd_memory "$@" ;;
|
||||||
|
cpu_usage) shift; cmd_cpu_usage "$@" ;;
|
||||||
|
cpu_temp) shift; cmd_cpu_temp "$@" ;;
|
||||||
|
time) shift; cmd_time "$@" ;;
|
||||||
|
volume) shift; cmd_volume "$@" ;;
|
||||||
|
pomodoro) shift; cmd_pomodoro "$@" ;;
|
||||||
|
bluetooth_battery) shift; cmd_bluetooth_battery "$@" ;;
|
||||||
|
language) shift; cmd_language "$@" ;;
|
||||||
|
userhost) shift; cmd_userhost "$@" ;;
|
||||||
|
|
||||||
|
*) exit "${EXIT_FAILURE}" ;;
|
||||||
|
esac
|
||||||
|
exit "${EXIT_SUCCESS}"
|
||||||
8
home/user/.config/waybar/scripts/layout_change_handler.sh
Executable file
8
home/user/.config/waybar/scripts/layout_change_handler.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
swaymsg -m -t SUBSCRIBE "['input']" | \
|
||||||
|
jq --unbuffered -r '.change' | while read -r line; do
|
||||||
|
if echo "${line}" | grep -q "xkb_layout"; then
|
||||||
|
pkill -RTMIN+3 waybar
|
||||||
|
fi
|
||||||
|
done
|
||||||
Loading…
x
Reference in New Issue
Block a user