sway: start a session with systemd
* bind waybar to sway.session * edit zprofile and sway config play nice with systemd
This commit is contained in:
parent
6647a8f096
commit
ef2e74ed8d
|
@ -58,7 +58,6 @@ exec_always --no-startup-id
|
|||
}
|
||||
|
||||
exec --no-startup-id {
|
||||
waybar
|
||||
nm-applet --indicator
|
||||
lxpolkit
|
||||
dbus-update-activation-environment DISPLAY XAUTHORITY
|
||||
|
@ -473,8 +472,7 @@ bindsym
|
|||
--locked XF86AudioPrev exec playerctl previous
|
||||
}
|
||||
|
||||
bar {
|
||||
swaybar_command waybar.sh
|
||||
}
|
||||
|
||||
include /etc/sway/config.d/*
|
||||
# Export environment to systemd and start services.
|
||||
exec "systemctl --user import-environment; systemctl --user start sway-session.target"
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
[Unit]
|
||||
Description=sway compositor session
|
||||
Documentation=man:systemd.special(7)
|
||||
BindsTo=graphical-session.target
|
||||
Wants=graphical-session-pre.target
|
||||
After=graphical-session-pre.target
|
|
@ -0,0 +1 @@
|
|||
/home/vis/.config/systemd/user/waybar.service
|
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=sway - SirCmpwn's Wayland window manager
|
||||
# as per https://github.com/swaywm/sway/wiki/Systemd-integration#running-sway-itself-as-a---user-service
|
||||
Documentation=man:sway(5)
|
||||
BindsTo=graphical-session.target
|
||||
Wants=graphical-session-pre.target
|
||||
After=graphical-session-pre.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
EnvironmentFile=-%h/.config/sway/env
|
||||
ExecStartPre=-source %h/.zprofile
|
||||
ExecStart=/usr/bin/sway
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
TimeoutStopSec=10
|
|
@ -0,0 +1,16 @@
|
|||
# ~/.config/systemd/user/waybar.service or /etc/systemd/user/waybar.service
|
||||
[Unit]
|
||||
Description=Highly customizable Wayland bar for Sway and Wlroots based compositors.
|
||||
Documentation=https://github.com/Alexays/Waybar/wiki/
|
||||
#PartOf=graphical-session.target
|
||||
PartOf=sway-session.target
|
||||
After=sway-session.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/waybar
|
||||
# Upstreamed in https://github.com/Alexays/Waybar/pull/1036
|
||||
ExecReload=kill -SIGUSR2 $MAINPID
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=sway-session.target
|
|
@ -58,11 +58,14 @@ if [[ -z $DISPLAY ]]; then
|
|||
export SDL_VIDEODRIVER=wayland
|
||||
export NO_AT_BRIDGE=1
|
||||
export TDESKTOP_USE_PORTAL=1
|
||||
export XDG_SESSION_TYPE=wayland
|
||||
|
||||
if [[ $(tty) == /dev/tty1 ]]; then
|
||||
export XDG_CURRENT_DESKTOP=sway
|
||||
exec sway
|
||||
elif [[ "$(tty)" == "/dev/tty2" ]] && ! ps -e | grep -qw sway
|
||||
MOZ_ENABLE_WAYLAND=1 QT_QPA_PLATFORM=wayland XDG_SESSION_TYPE=wayland exec dbus-run-session gnome-session
|
||||
exec systemd-cat --identifier=sway sway
|
||||
elif [[ $(tty) == /dev/tty2 ]]; then
|
||||
export MOZ_ENABLE_WAYLAND=1
|
||||
export XDG_SESSION_TYPE=wayland
|
||||
exec systemd-cat --identifier=gnome-session gnome
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue