waybar: move to systemd service, update clock

This commit is contained in:
Konstantin Koslowski 2024-01-22 07:51:29 +01:00
parent 650b741777
commit 2e9119018c
5 changed files with 44 additions and 24 deletions

View file

@ -1,16 +0,0 @@
#!/usr/bin/env sh
CONFIG_DIR=$HOME/.config/sway/waybar.d
CONFIG=$CONFIG_DIR/config
CONFIG_HOST=$CONFIG_DIR/config_$(hostname)
if [ -f $CONFIG_HOST ]; then
CONFIG=$CONFIG_HOST
fi
STYLE=$CONFIG_DIR/style.css
# Terminate already running bar instances
# pkill -SIGUSR2 -x waybar
pkill -x waybar
# execute new instance
waybar -c $CONFIG -s $STYLE

6
config
View file

@ -22,7 +22,6 @@ set $output_cmd $HOME/.local/bin/swayout
set $volume_cmd $HOME/.config/sway/bin/sway_volume set $volume_cmd $HOME/.config/sway/bin/sway_volume
set $media_cmd /usr/bin/playerctl set $media_cmd /usr/bin/playerctl
set $idle_cmd $HOME/.config/sway/bin/start_swayidle.sh set $idle_cmd $HOME/.config/sway/bin/start_swayidle.sh
set $waybar_cmd $HOME/.config/sway/bin/start_waybar.sh
set $sov_cmd $HOME/.config/sway/bin/start_sov.sh set $sov_cmd $HOME/.config/sway/bin/start_sov.sh
set $lock_cmd $HOME/.config/sway/bin/sway_lock lock set $lock_cmd $HOME/.config/sway/bin/sway_lock lock
set $move_cmd $HOME/.config/sway/bin/sway_move set $move_cmd $HOME/.config/sway/bin/sway_move
@ -364,11 +363,6 @@ for_window [class="Chromium" instance="crx_cifhbcnohmdccbgoicgdjpfamggdegmo" win
# matlab workaround # matlab workaround
no_focus [class="MATLAB R2021a" instance="sun-awt-X11-XDialogPeer"] no_focus [class="MATLAB R2021a" instance="sun-awt-X11-XDialogPeer"]
#
# Status Bar:
#
exec_always $waybar_cmd
# #
# Autostart # Autostart
# #

View file

@ -0,0 +1,6 @@
[Unit]
Description=Sway compositor session
Documentation=man:systemd.special
BindsTo=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target

View file

@ -0,0 +1,14 @@
[Unit]
Description=Highly customizable Wayland bar for Sway and Wlroots based compositors.
Documentation=https://github.com/Alexays/Waybar/wiki/
PartOf=graphical-session.target
After=graphical-session.target
Requisite=graphical-session.target
[Service]
ExecStart=env LC_TIME=de_DE.UTF-8 /usr/bin/waybar
ExecReload=kill -SIGUSR2 $MAINPID
Restart=on-failure
[Install]
WantedBy=graphical-session.target

View file

@ -83,8 +83,30 @@
"exec": "$HOME/.config/sway/bin/waybar_mediaplayer.py 2> /dev/null" "exec": "$HOME/.config/sway/bin/waybar_mediaplayer.py 2> /dev/null"
}, },
"clock": { "clock": {
"format": "<span foreground='#ebdbb2'></span>{: %H:%M, %b %d }", "format": "<span foreground='#ebdbb2'> </span>{:%H:%M, %b %d}",
// "on-click": "foot -T float khal interactive" "format-alt": "<span foreground='#ebdbb2'> </span>{:%A, %B %d, %Y (%R)}",
"tooltip-format": "\n<span size='9pt'>{calendar}</span>",
"calendar": {
"mode" : "year",
"mode-mon-col" : 3,
"weeks-pos" : "right",
"on-scroll" : 1,
"on-click-right": "mode",
"format": {
"months": "<span color='#ebdbb2'><b>{}</b></span>",
"days": "<span color='#ebdbb2'><b>{}</b></span>",
"weeks": "<span color='#268bd2'><b>W{}</b></span>",
"weekdays": "<span color='#b8bb26'><b>{}</b></span>",
"today": "<span color='#fb4934'><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"
}
}, },
"cpu": { "cpu": {
"format": "<span foreground='#ebdbb2'></span>{usage:3}%", "format": "<span foreground='#ebdbb2'></span>{usage:3}%",