How to configure ScreenSaver by Command Line?
Solution 1:
Basics
This options are usually saved using two tools - gsettings
and dconf
:
- To get actual
gsettings
key names you need to rungsettings list-recursively > gs1
for first time and then change settings, then run it againgsettings list-recursively > gs2
; then compare gs-files usingmeld gs1 gs2
to get a diff. - To monitor configuration changes in realtime you can run
dconf watch /
and then change some GUI options. Comparison of two shots is possible by runningdconf dump / > dconf1
anddconf dump / > dconf2
and then usingmeld dconf1 dconf2
.
Per-user variant
Using gsettings
To set needed values for your current user permanently using gsettings
you have to use commands below:
gsettings set org.mate.session idle-delay 120
gsettings set org.mate.screensaver idle-activation-enabled false
gsettings set org.mate.screensaver lock-enabled false
and reverting to defaults is possible by
gsettings set org.mate.session idle-delay 30
gsettings set org.mate.screensaver idle-activation-enabled true
gsettings set org.mate.screensaver lock-enabled true
Using dconf
To set them using dconf
you can use
cat <<EOF | dconf load /
[org/mate/desktop/session]
idle-delay=120
[org/mate/screensaver]
idle-activation-enabled=false
lock-enabled=false
EOF
and reverting to defaults is possible by
cat <<EOF | dconf load /
[org/mate/desktop/session]
idle-delay=30
[org/mate/screensaver]
idle-activation-enabled=true
lock-enabled=true
EOF
System-wide dconf
-based method
To set this options as defaults on system-wide level you have to run the following commands:
sudo mkdir -p /etc/dconf/profile
cat <<EOF | sudo tee /etc/dconf/profile/user
user-db:user
system-db:local
EOF
sudo mkdir -p /etc/dconf/db/local.d
cat <<EOF | sudo tee /etc/dconf/db/local.d/00-my
[org/mate/desktop/session]
idle-delay=120
[org/mate/screensaver]
idle-activation-enabled=false
lock-enabled=false
EOF
sudo dconf update
Reverting to defaults is possible by
sudo rm /etc/dconf/profile/user /etc/dconf/db/local.d/00-my
sudo dconf update
Consult with the following RedHat documentation for details:
- "Chapter 3. GSettings and dconf"
- "9.4. What Are dconf Profiles?"
- "9.5. Configuring Custom Default Values".