You are not logged in.

#1 2025-03-03 09:55:13

cw17
Member
Registered: 2025-03-03
Posts: 1

systemd service on boot (after plasma wayland session has started)

Setup: Arch, KDE Plasma 6.3.1 and Wayland.

I control Night Light with simple scripts.

disable_night_light.sh

#!/usr/bin/env bash

if [ $(qdbus6 org.kde.KWin.NightLight /org/kde/KWin/NightLight org.kde.KWin.NightLight.running) = true ]; then
qdbus6 org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Toggle Night Color"
fi

I wanted to make a systemd service that automatically runs the script above when I start my PC.
I have tried multiple (both simple and complicated) combinations of configurations, but the current .service is as follows.

cat /etc/systemd/user/disable_night_light.service

[Unit]
Description=Making sure night light is not on during startup
PartOf=graphical-session.target
After=graphical-session.target
Requires=graphical-session.target

[Service]
Type=exec
ExecStart=/home/user/scripts/disable_night_light.sh

[Install]
WantedBy=graphical-session.target

Manually running systemctl --user start disable_night_light has worked with a lot of different configurations, but none of them work on actual startup after enabling the service.

Output from the failed attempts

Mar 03 10:01:19 host disable_night_light.sh[1118]: Service 'org.kde.KWin.NightLight' does not exist.
Mar 03 10:01:19 host disable_night_light.sh[1114]: /home/user/scripts/disable_night_light.sh: line 7: [: =: unary operator expected

My understanding is that I need to get the service to wait until Service 'org.kde.KWin.NightLight' has started, but I'm unable to figure out a way to do so.
I can't find any systemd unit that looks like it has anything to do with org.kde.KWin*.

Offline

#2 2025-03-05 02:41:08

dichead
Member
Registered: 2003-05-29
Posts: 12

Re: systemd service on boot (after plasma wayland session has started)

https://userbase.kde.org/System_Settings/Autostart

Why not just use kde to start this? Why use systemd?

Offline

Board footer

Powered by FluxBB