You are not logged in.
I am using KDE Plasma in my system. I want to configure autostart in a conditional way.
Say: If the laptop is charging, start A,B,C apps; If it is not charging, do not startup any of these.
How can I achieve that? Of course I can remove those from startup and write my own script to run at login. But is there any better way to achieve so?
KDE Plasma Version: 5.27.4
Kernel Version: 6.2.13-arch1-1 (64-bit)
Last edited by infinitEplus (2023-05-03 05:23:19)
Offline
You can configure scripts to run on switching between plugged or unplugged in the powerdevil KCM:
kcmshell5 kcm_powerdevilprofilesconfigbut that would be tied to the profile switch, not the startup per se. It'd probably be easier to just write a script if this is strictly about startup/login
Last edited by V1del (2023-05-02 07:28:55)
Offline
You can configure scripts to run on switching between plugged or unplugged in the powerdevil KCM:
kcmshell5 kcm_powerdevilprofilesconfigbut that would be tied to the profile switch, not the startup per se. It'd probably be easier to just write a script if this is strictly about startup/login
Okay. Also, can I achieve conditonal running for systemd services as well?
Again for example, I have syncthing.service enabled in user mode. I only want to run it when power source is AC and not battery.
Offline
For systemd services you can use Condition* definitions in the unit services, e.g.: https://www.freedesktop.org/software/sy … onACPower=
Offline
Is it recommended to edit unit files managed by software itself?
Offline
Online
Thank you. Marking this a solved.
Offline