diff --git a/.config/sway/config b/.config/sway/config index 1805f48..a2d04f9 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -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" diff --git a/.config/systemd/user/sway-session.target b/.config/systemd/user/sway-session.target new file mode 100644 index 0000000..30151b3 --- /dev/null +++ b/.config/systemd/user/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 diff --git a/.config/systemd/user/sway-session.target.wants/waybar.service b/.config/systemd/user/sway-session.target.wants/waybar.service new file mode 120000 index 0000000..cc55342 --- /dev/null +++ b/.config/systemd/user/sway-session.target.wants/waybar.service @@ -0,0 +1 @@ +/home/vis/.config/systemd/user/waybar.service \ No newline at end of file diff --git a/.config/systemd/user/sway.service b/.config/systemd/user/sway.service new file mode 100644 index 0000000..ec25e3a --- /dev/null +++ b/.config/systemd/user/sway.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 \ No newline at end of file diff --git a/.config/systemd/user/waybar.service b/.config/systemd/user/waybar.service new file mode 100644 index 0000000..42b9d96 --- /dev/null +++ b/.config/systemd/user/waybar.service @@ -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 \ No newline at end of file diff --git a/.zprofile b/.zprofile index 9c0e91f..eaba1bd 100644 --- a/.zprofile +++ b/.zprofile @@ -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