I followed that article on the arch linux wiki to have my configuration of my cintiq wacom tablet be permanent.
According to the article, I created the udev rule which calls a “wacom.service” that runs a script wacom-config.sh
The script works and I can
systemctl --user start wacom.service
My wacom (the area) is then configured correctly.
But I still have to do that everytime I start a session !
It just doesn’t autostart and if I try to enable it with :
systemctl --user enable wacom.service
I get :
Failed to enable unit: Unit file /home/greg/.config/systemd/user/graphical-session.target.wants/wacom.service does not exist.
I don’t understand why it’s looking into a “graphical-session.target.wants” folder and if I create that folder and put my wacom.service into it I get :
Failed to enable unit: File /home/greg/.config/systemd/user/graphical-session.target.wants/wacom.service already exists.
I just restarted my computer and the wacom-config.sh did not run… I still have to manually start the service. And when I try to enable the service I still get the same message as per my 1st post
@GregDurr , those After= and PartOf= lines need to be removed or commented out because they are not mentioned in your output of list-dependencies…
Anytime you make changes to a user unit’s config file, you need to let systemd know about it like you would for system units by performing:
systemctl --user daemon-reload
Only after that you can try to start it again with the changes made…
If you had done that, you could not have gotten the same error message as in first post…
Edit:
Uhmmm wait maybe you could have… due to default.target
PS:
Next time post code as code bewteen code-blocks instead of images, so ppl can quote the part if needed or copy to try self…
PPS:
I would also suggest you to place your script at /home/greg/bin/wacom-config.sh and use that path instead, because it is a program and not a config file
Thanks @TriMoon and @dmt for your reply and advice.
It still does not run the script when I start my computer/session
systemctl --user enable wacom.service
returns
Failed to enable unit: Unit file /home/greg/.config/systemd/user/default.target.wants/wacom.service does not exist.
Wow… was not expecting it to be that difficult to run a simple script on logon !
my files :
wacom-config.sh
#!/bin/sh
for i in $(seq 10); do
if xsetwacom list devices | grep -q Wacom; then
break
fi
sleep 10
done
list=$(xsetwacom list devices)
pad=$(echo "${list}" | awk '/pad/{print $7}')
stylus=$(echo "${list}" | xsetwacom list devices | awk '/stylus/{print $7}')
if [ -z "${pad}" ]; then
exit 0
fi
# configure the buttons on ${stylus} with your xsetwacom commands...
#xsetwacom set "${stylus}" Button 2 11
#...
xsetwacom set "${stylus}" Area 200 300 86400 65300
xsetwacom set "${stylus}" MapToOutput HEAD-0
[Unit]
Description=Configure my Wacom tablet
Documentation=https://wiki.archlinux.org/title/Systemd/User#Writing_user_units
Documentation=man:systemd.special(7)"#Units managed by the user service manage"
Documentation=man:systemd.unit(5)"#Specifiers"
ConditionEnvironment=DISPLAY
ConditionEnvironment=XAUTHORITY
BindsTo=graphical-session.target
[Service]
Type=oneshot
ExecStart=%h/bin/%N-config.sh
[Install]
WantedBy=xdg-desktop-autostart.target
Created symlink /home/myusername/.config/systemd/user/xdg-desktop-autostart.target.wants/wacom.service → /home/myusername/.config/systemd/user/wacom.service.
systemctl --user status wacom
○ wacom.service - Configure my Wacom tablet
Loaded: loaded (/home/myusername/.config/systemd/user/wacom.service; enabled; preset: enabled)
Active: inactive (dead) since Sat 2023-01-14 12:04:27 +03; 1min 42s ago
Docs: https://wiki.archlinux.org/title/Systemd/User#Writing_user_units
man:systemd.special(7)#Units managed by the user service manage
man:systemd.unit(5)#Specifiers
Process: 3927 ExecStart=/home/myusername/bin/wacom-config.sh (code=exited, status=0/SUCCESS)
Main PID: 3927 (code=exited, status=0/SUCCESS)
CPU: 2ms
Jan 14 12:04:27 kubuntu systemd[1358]: Starting Configure my Wacom tablet...
Jan 14 12:04:27 kubuntu wacom-config.sh[3927]: Hello from wacom config.
Jan 14 12:04:27 kubuntu wacom-config.sh[3927]: DISPLAY=:0
Jan 14 12:04:27 kubuntu wacom-config.sh[3927]: XAUTHORITY=/home/myusername/.Xauthority
Jan 14 12:04:27 kubuntu systemd[1358]: Finished Configure my Wacom tablet.
Logging out and back into the GUI and checking the status again shows it was started again, which you can check by the timestamp.
PS: I didn’t use any udev config like you posted, because i don’t actually have a wacom device…
But it should be doable to add a dependency on the device path, that gets created when you insert the device, to automatically start the service without an udev config… (Hint: under the Install section)
I think I just found another way …
I start “Session and startup” → Application Autostart and I add the wacom-setting.sh to the list to start on login. I just tried and it works.
What do you think ? Is that a valid answer to what I asked since I mentionned “udev” and “service” ?
Which should fix possible other dirs/files under it also… (It will output the ones it changes)
Maybe followed by this, but i doubt this is really needed:
sudo chmod --changes --recursive g+rX ~/.config
Isn’t XFCE using systemd and XDG specs?
Maybe it will fix itself after the above command(s)…
man systemd.special
xdg-desktop-autostart.target
The XDG specification defines a way to autostart applications using XDG desktop files. systemd ships systemd-xdg-autostart-generator(8) for the XDG desktop files in autostart
directories. Desktop Environments can opt-in to use this service by adding a Wants= dependency on xdg-desktop-autostart.target.
No idea how to check if XFCE has indeed “opt-in” into this feature or not, as i don’t use XFCE…
But maybe this could shed a light:
This means your home dir can only be accessed by your user account and nothing else… systemd needs to be able to walk into your home dir before it can find, to read and react to, the config for it self…
That should also be fixed i think… (but I’m not sure) (Check my previous reply first to make sure everything is in order that way, before trying to fix this…)
But if that is a concern you could, especially with this service which any user on your system might benefit from, place the service and script in the global space instead.
/etc/systemd/user
For the service itself.
/usr/local/bin
For the script…
Ofcourse with accompaning changes in the ExecStart line in the service
At least now the file/dir permissions are correct.
I’ve been searching on the internet for quite some time since yesterday, but i didn’t find any info on how to “opt-in” as mentioned for XFCE… (I don’t know either as i dont use XFCE, else i might find a way myself)
There are plenty of pages using autostart via XDG specs, that use “*.desktop” files, but not for using systemd-user-services.
Well seems on your setup xdg-desktop-autostart.target is not mentioned
For comparison with mine using KDE and my-user-test.service instead of your wacom.service:
But in your case graphical-session.target is still mentioned so mybe try to disable your service first, then change the service to have:
[Install]
WantedBy=graphical-session.target
Then do a daemon-reload followed by an enable again, and try if it does work this time…
There is nothing more i could help with, because theres only so much i can do while using a totally different system as yours (KDE vs XFCE and Kubuntu vs Manjaro)
PS:
It looks to me like XFCE is lacking proper integration with systemd…
PPS:
Oh by the way now that all file/dir permissions are correct you might also try what i said at start of thread