So, I'm trying to change my theme from a light to a dark version in the evening, and vica versa in the morning. However, Gsettings doesn't work from Cron, and the solutions posted here and here don't seem to work, neither do those posted in the comments below them.
This is the script Cron is executing:
#!/bin/bash
#Export DBUS_SESSION_BUS_ADDRESS environment variable
PID=$(pgrep -o gnome-shell)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS/proc/$PID/environ|cut -d= -f2-)
#Change theme
gsettings set org.gnome.desktop.interface gtk-theme 'Arc-Dark'
gsettings set org.gnome.shell.extensions.user-theme name 'Arc-Dark'
And this is the error I'm getting in dead.letter (Crons' way of logging errors):
grep: /proc/1098/environ: Permission denied
(process:28536): dconf-WARNING **: failed to commit changes to dconf: The given address is empty
grep: /proc/1098/environ: Permission denied
(process:28811): dconf-WARNING **: failed to commit changes to dconf: The given address is empty
I know I can use sudo -u to run the script, but I'd rather not use the root cron.
gsettings
with what$(which gsettings)
resolves to ? (I doubt this will make a difference, but might be worth a try).