Chapter 9. Customizing GNOME desktop features
9.1. Changing the language by using desktop GUI
You can change the system language using the desktop GUI.
Prerequisites
- Required language packages are installed on your system
Procedure
Open the Settings application from the system menu by clicking on its icon.
- In Settings, choose Region & Language from the left vertical bar.
Click the Language menu.
Select the required region and language from the menu.
If your region and language are not listed, scroll down, and click More to select from available regions and languages.
- Click Done.
Click Restart for changes to take effect.
Some applications do not support certain languages. The text of an application that cannot be translated into the selected language remains in US English.
Additional resources
9.2. Enabling the Ctrl+Alt+Backspace shortcut
The Ctrl+Alt+Backspace shortcut key combination is used for terminating the X.Org display server.
You might want to terminate X.Org especially when:
- A program caused X.Org to stop working.
- You need to switch from your logged-in session quickly.
- You have launched a program that failed.
- You cannot operate in the current session.
- Your screen freezes.
Procedure
Create a local database for machine-wide settings in
/etc/dconf/db/local.d/00-input-sources
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow [org/gnome/desktop/input-sources] # Enable Ctrl-Alt-Backspace for all users xkb-options=['terminate:ctrl_alt_bksp']
[org/gnome/desktop/input-sources] # Enable Ctrl-Alt-Backspace for all users xkb-options=['terminate:ctrl_alt_bksp']
Override the user’s setting, and prevent the user from changing it in
/etc/dconf/db/local.d/locks/input-sources
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Lock the list of enabled XKB options
# Lock the list of enabled XKB options /org/gnome/desktop/input-sources/xkb-options
Update the system databases for the changes to take effect:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow dconf update
# dconf update
- Users must log out and back in again before the system-wide settings take effect.
If the Ctrl+Alt+Backspace key combination is enabled, all users can terminate X.Org , which brings them back to the login prompt.
9.3. Disabling command-line access
To disable command-line access for a desktop user, you need to make configuration changes in a number of different contexts:
- Section 9.3.1, “Setting the org.gnome.desktop.lockdown.disable-command-line Key”
- Section 9.3.2, “Disabling virtual terminal switching on X.Org”
- Remove Terminal and any other application that provides access to the terminal from the Applications menu and the Activities Overview in GNOME Shell. This is done by removing menu items for those applications.
The following steps do not remove the desktop user’s permissions to access a command line, but rather remove the ways that the desktop user could access command line.
9.3.1. Setting the org.gnome.desktop.lockdown.disable-command-line Key
This approach prevents the user from:
- Accessing the terminal
- Specifying a command line to be executed by using the Alt+F2 command prompt
Procedure
Create a local database for machine-wide settings in
/etc/dconf/db/local.d/00-lockdown
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow [org/gnome/desktop/lockdown] # Disable command-line access disable-command-line=true
[org/gnome/desktop/lockdown] # Disable command-line access disable-command-line=true
Override the user’s setting and prevent the user from changing it in
/etc/dconf/db/local.d/locks/lockdown
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Lock the disabled command-line access
# Lock the disabled command-line access /org/gnome/desktop/lockdown/disable-command-line
Update the system databases:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow dconf update
# dconf update
- Users must log out and back in again before the system-wide settings take effect.
9.3.2. Disabling virtual terminal switching on X.Org
With the X.Org display server, users can normally use the Ctrl+Alt+function key shortcuts to switch from the GNOME Desktop and X.Org to a virtual terminal. You can disable access to all virtual terminals by modifying the X.Org configuration.
You cannot apply the procedure if GNOME Shell on Wayland is used as the display server.
Procedure
Create or edit an X configuration file in the
/etc/X11/xorg.conf.d/
directory:NoteBy convention, these host-specific configuration file names start with two digits and a hyphen and always have the
.conf
extension. Thus, the following file name can be/etc/X11/xorg.conf.d/10-xorg.conf
.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Section "Serverflags" Option "DontVTSwitch" "yes" EndSection
Section "Serverflags" Option "DontVTSwitch" "yes" EndSection
- Restart the X.Org display server for the changes to take effect.
9.4. Preventing the computer from suspending when closing the lid
When closing the lid of your laptop, the computer by default suspends in order to save power. You can prevent the computer from suspending when closing the lid by changing the setting for that behavior.
Some laptops can overheat if they are left running with the lid closed, especially if they are in a confined place. Therefore, consider whether changing the default setting from suspend to an other option is beneficial in your case.
Procedure
-
Open the
/etc/systemd/logind.conf
file for editing. Find the
HandleLidSwitch=suspend
line in the file.If it is quoted out with the
#
character at the start, unquote it by removing#
.If the line is not present in the file, add it.
Replace the default
suspend
parameter with:-
lock
for the screen to lock -
ignore
for nothing to happen -
poweroff
for the computer to switch off
For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow [Login] HandleLidSwitch=lock
[Login] HandleLidSwitch=lock
-
- Save your changes, and close the editor.
Run the following command so that your changes preserve the next restart of the system:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow systemctl restart systemd-logind.service
# systemctl restart systemd-logind.service
WarningRestarting the service forcibly interrupts any currently running GNOME session of any desktop user who is logged in. This can result in users losing unsaved data.
For more information about the /etc/systemd/logind.conf
file, see the logind.conf
man page on your system.
9.5. Changing the power button behavior
When you press the power button on your computer, it suspends or shuts down the system by default. You can customize this behavior according to your preferences.
9.5.1. Changing the behavior of the power button when pressing the button and GNOME is not running
When you press the power button in a non-graphical systemd
target, it shuts down the system by default. You can customize this behavior according to your preferences.
Prerequisites
- Administrative access.
Procedure
Edit the
/etc/systemd/logind.conf
configuration file and set theHandlePowerKey=poweroff
variable to one of the following options:poweroff
- Shut down the computer.
reboot
- Reboot the system.
halt
- Initiate a system halt.
kexec
-
Initiate a
kexec
reboot. suspend
- Suspend the system.
hibernate
- Initiate system hibernation.
ignore
- Do nothing.
For example, to reboot the system upon pressing the power button, use this setting:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow HandlePowerKey=reboot
HandlePowerKey=reboot
9.5.2. Changing the behavior of the power button when pressing the button and GNOME is running
On the graphical login screen or in the graphical user session, pressing the power button suspends the machine by default. This happens both in cases when the user presses the power button physically or when pressing a virtual power button from a remote console. You can select a different power button behavior.
Procedure
Create a local database for system-wide settings in the
/etc/dconf/db/local.d/01-power
file with the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow [org/gnome/settings-daemon/plugins/power] power-button-action=<value>
[org/gnome/settings-daemon/plugins/power] power-button-action=<value>
Replace
<value>
with one of the following power button actions:nothing
- Does nothing .
suspend
- Suspends the system.
hibernate
- Hibernates the system.
interactive
Shows a pop-up query asking the user what to do.
With interactive mode, the system powers off automatically after 60 seconds when pressing the power button. However, you can choose a different behavior from the pop-up query.
Optional: Override the user’s setting, and prevent the user from changing it. Enter the following configuration in the
/etc/dconf/db/local.d/locks/01-power
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow /org/gnome/settings-daemon/plugins/power/power-button-action
/org/gnome/settings-daemon/plugins/power/power-button-action
Update the system databases:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow dconf update
# dconf update
- Log out and back in again for the system-wide settings to take effect.