...
 
Commits (2)
  • Gigadoc 2's avatar
    migrate autostart to systemd services · 67438552
    Gigadoc 2 authored
    For kdeconnect I also added a dbus service, even though I don't
    bus-activate it (I want it to start in any case, so the phone can also
    initiate a connection). This is only done because KDE ships it with a
    dbus service that does _not_ launch a systemd service, but does it the
    old way. Even though unlikely, I don't want to race a dbus-activation.
    67438552
  • Gigadoc 2's avatar
    have sway wait on launched applications before exiting · ea9f4831
    Gigadoc 2 authored
    By ordering all the graphical apps After=graphical-session.target and
    explicitly calling systemctl stop graphical-session.target from sway,
    sway succesfully waits for all graphical apps to have terminated. Note
    that for terminals (maybe some other apps as well) the result may not be
    what you expect: Since the terminal emulator itself (or maybe the shell,
    not sure here) does not wait for its children to finish, programs
    launched from the terminal will be apruptly killed in any case.
    However, launch a signal-ignoring app from wofi and you'll see that your
    desktop hangs for precisely 1m30s on logout! Well, if you have a lot of
    programs than hang on exit, maybe decrease the systemd stop timeout ;)
    ea9f4831
exec /usr/bin/nextcloud
exec /usr/bin/kdeconnect-indicator
......@@ -33,18 +33,21 @@ set $right l
# Your preferred terminal emulator
set $term /usr/bin/systemd-run --user --scope -q \
-p PartOf=graphical-session.target \
-p After=graphical-session.target \
--unit="konsole-$(systemd-id128 new).scope" \
--description="sway-launched terminal" \
-- /usr/bin/konsole
# Launch applications through wofi, in a transient systemd scope.
set $menu /usr/bin/systemd-run --user --scope -q \
-p PartOf=graphical-session.target \
-p After=graphical-session.target \
--unit="wofi-app-$(systemd-id128 new).scope" \
--description="sway-wofi-launched application" \
-- /usr/bin/wofi -G -S drun -i -t /usr/bin/konsole
# Same thing but for shell commands
set $run /usr/bin/systemd-run --user --scope -q \
-p PartOf=graphical-session.target \
-p After=graphical-session.target \
--unit="wofi-sh-$(systemd-id128 new).scope" \
--description="sway-wofi-launched command" \
-- /usr/bin/wofi -G -S run -i
......@@ -191,9 +194,12 @@ font SF Pro Display 9
bindsym $mod+Shift+c reload
# exit sway (logs you out of your Wayland session)
# sway-session.target and graphical-session.target are bound together, but
# we stop the latter here explicitly to block on it, so all applications
# get shut down before sway exits.
# Note that this only unsets variables for systemd, dbus does not support
# unsetting them. So I guess try to avoid launching stuff with dbus?
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'systemctl --user stop sway-session.target && systemctl --user unset-environment DISPLAY I3SOCK SWAYSOCK WAYLAND_DISPLAY XCURSOR_SIZE XCURSOR_THEME XDG_CURRENT_DESKTOP && swaymsg exit'
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'systemctl --user stop sway-session.target graphical-session.target && systemctl --user unset-environment DISPLAY I3SOCK SWAYSOCK WAYLAND_DISPLAY XCURSOR_SIZE XCURSOR_THEME XDG_CURRENT_DESKTOP && swaymsg exit'
#
# Moving around:
#
......@@ -354,4 +360,3 @@ exec xrdb ~/.Xresources
include ~/.config/sway/autostart_early
exec dbus-update-activation-environment --systemd DISPLAY I3SOCK SWAYSOCK WAYLAND_DISPLAY XCURSOR_SIZE XCURSOR_THEME XDG_CURRENT_DESKTOP=sway
exec systemctl --user start sway-session.target
include ~/.config/sway/autostart
[Unit]
Description=KDE connect user daemon
PartOf=graphical-session.target
[Service]
Type=dbus
BusName=org.kde.kdeconnect
ExecStart=/usr/lib/kdeconnectd
# I left out the [Install] section on purpose, as this unit is not suitable for
# just any graphical-session.target. You should enable it only for those
# sessions where you know it works, e.g. not GNOME which has it's own kdeconnect
# implementation. In any case, kdeconnect-cli will dbus-activate this if used
# explicitly.
[Unit]
Description=Nextcloud client application
PartOf=graphical-session.target
# Shut down the app before the compositor is gone
After=graphical-session.target
[Service]
Type=dbus
BusName=com.nextcloudgmbh.Nextcloud
ExecStart=/usr/bin/nextcloud --background
[Install]
WantedBy=graphical-session.target
[D-BUS Service]
Name=org.kde.kdeconnect
Exec=/usr/bin/false
SystemdService=kdeconnectd.service