lamyer
(Lamy Geier)
March 24, 2024, 11:22am
1
Installed kernel: 6.7.6-200.fc39.x86_64
Fedora release 39
Desktop: GNOME 45.4
Display Server: wayland
Followings works as expected (when executed from terminal) and color scheme changes:
$ gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
$ gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'
Followings does not works (i.e. nothing happens) (when executed from inside a bash script) and color scheme does not change:
$ cat Theme.sh
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
gsettings get org.gnome.desktop.interface color-scheme
bash ./Theme.sh
'prefer-dark'
gsettings get org.gnome.desktop.interface color-scheme
'prefer-light'
jakfrost
(Stephen Douglas Snow)
March 24, 2024, 11:38am
2
You could try using back ticks for the external command so …
`gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'`
As example for dark theme setting.
You could also make two aliases one “dark-mode” and another “light-mode” that run the appropriate command from the terminal.
lamyer
(Lamy Geier)
March 24, 2024, 11:39am
3
You want me to add backticks inside the bash script? Why does the bash script does not work?
vgaetera
(Vladislav Grigoryev)
March 24, 2024, 11:52am
4
This normally works.
Something must be wrong in your case.
Check the output:
id
echo ${DBUS_SESSION_BUS_ADDRESS}
ls -a -l ~/.config/dconf
cat -A Theme.sh
lamyer
(Lamy Geier)
March 24, 2024, 12:15pm
5
$ id
echo ${DBUS_SESSION_BUS_ADDRESS}
ls -a -l ~/.config/dconf
\cat -A Theme.sh
uid=1000(lamy) gid=1000(lamy) groups=1000(lamy),10(wheel),975(docker) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
unix:path=/run/user/1000/bus
lrwxrwxrwx. 1 lamy 23 May 13 2023 /home/lamy/.config/dconf -> /mnt/Data/.config/dconf/
#!/usr/bin/env bash$
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'$
gsettings get org.gnome.desktop.interface color-scheme$
vgaetera
(Vladislav Grigoryev)
March 25, 2024, 1:25pm
6
I’m guessing the problem is related to the the fact that your dconf is stored on a separate partition which breaks interaction with dbus possibly due to incorrect target file ownership or insufficient permissions.
lamyer
(Lamy Geier)
March 26, 2024, 12:21pm
7
Permission and ownership can be seen as below
$ \ls -la ${HOME}/.config/dconf
lrwxrwxrwx. 1 lamy lamy 23 May 13 2023 /home/lamy/.config/dconf -> /mnt/Data/.config/dconf
$ \ls -la /mnt/Data/.config/dconf
total 80
drwxr-xr-x. 2 lamy lamy 4096 Mar 26 13:15 .
drwxr-xr-x. 126 lamy lamy 4096 Mar 26 01:16 ..
-rw-r--r--. 1 lamy lamy 73459 Mar 26 13:15 user
What should I do?
vgaetera
(Vladislav Grigoryev)
April 1, 2024, 9:13pm
8
Try different ways to isolate the issue:
Return the dconf to its default location in your home directory.
Create a test user with default profile settings.
If the issue persists, it might be related to the method used to invoke the script.