You are not logged in.
I want to set my nvidia driver's setting on performance. Unfortunately, there doesn't seem to be a permanent config setting for that, so I made a user systemd unit:
[Unit]
Description=Force nvidia settings to performance
[Service]
Type=oneshot
ExecStart=/usr/bin/nvidia-settings -a [gpu:0]/GpuPowerMizerMode=1
Environment=DISPLAY=:1
[Install]
WantedBy=default.targetUnfortunately, this fails most of the time because it is run before the display becomes available (I use GNOME with gdm). Is there a way to tell systemd to run the job after this display becomes available?
Last edited by lardon (2015-09-01 10:04:22)
Offline
Perhaps, under [Unit] you want something like
After=graphical.targetOffline
Perhaps, under [Unit] you want something like
After=graphical.target
I thought about that, but I believe graphical.target refers to gdm and not the final desktop session. Anyways, I'll have to try and report back.
Offline
Well if it doesn't, here's a rather hacky solution that occurred to me:
ExecStart=until [ $(pgrep -f gnome-session) ]; do sleep 1; done && /usr/bin/nvidia-settings -a [gpu:0]/GpuPowerMizerMode=1Edit: by the way, have you considered using GNOME's autostart facility instead of a systemd service? https://wiki.archlinux.org/index.php/GN … plications
Edit2: whoops! Added missed semi-colon after square bracket.
Last edited by Chazza (2015-07-22 10:18:37)
Offline
I can confirm "After=graphical.target" does not work per se. So I went with your last solution, but I had to tweak it a little bit more to get it to work. Here's my working solution:
[Unit]
Description=Force nvidia settings to performance
After=graphical.target
[Service]
Type=simple
ExecStart=/usr/bin/bash -c 'until /usr/bin/nvidia-settings -a [gpu:0]/GpuPowerMizerMode=1; do echo "waiting for desktop..."; sleep 1; done'
Environment=DISPLAY=:1
[Install]
WantedBy=default.targetOffline