Chapter 22. Managing user sessions 22.1. What GDM is The GNOME Display Manager (GDM) is a graphical login program running in the background that runs and manages the X.Org display servers for both local and remote logins. GDM is a replacement for XDM, the X Display Manager. However, GDM is not derived from XDM and does not contain any original XDM code. In addition, there is no support for a graphical configuration tool in GDM, so editing the /etc/gdm/custom.conf configuration file is necessary to change the GDM settings. 22.2. Restarting GDM When you make changes to the system configuration such as setting up the login screen banner message, login screen logo, or login screen background, restart GDM for your changes to take effect. Warning Restarting the gdm service terminates all currently running GNOME sessions of all desktop users who are logged in. This might result in users losing unsaved data. Procedure To restart the GDM service, run the following command: Procedure To display results of the GDM configuration, run the following command: 22.3. Adding an autostart application for all users You can set application to start automatically when any user logs into the GNOME environment. Procedure Create a .desktop file in the /etc/xdg/autostart/ directory, such as /etc/xdg/autostart/ nautilus .desktop . Enter the following content in the file: Replace Files with the name of the application. Replace /usr/bin/nautilus -n with the command that starts the application. Use the full file path. Optional: Configure the application to start only when a selected GSettings key is enabled. GNOME then runs the application automatically if the key's value is true. If the key's value changes in the running session, GNOME starts or stops the application to match the new value. Add the following line in the .desktop file: Replace org.gnome.desktop.background show-desktop-icons with the GSettings schema and key that the automatic start depends on. Additional resources You can also configure an autostart application for a specific user. Use the Tweaks application, which is available from the gnome-tweaks package. 22.4. Configuring automatic login As an administrator, you can enable automatic login from the Users panel in GNOME Settings , or you can set up automatic login manually in the GDM custom configuration file, as follows. Run the following procedure to set up automatic login for a user john . Procedure Edit the /etc/gdm/custom.conf file, and make sure that the [daemon] section in the file specifies the following: Replace john with the user that you want to be automatically logged in. 22.5. Configuring automatic logout User sessions that have been idle for a specific period of time can be ended automatically. You can set different behavior based on whether the machine is running from a battery or from mains power by setting the corresponding GSettings key, then locking it. Warning Users can potentially lose unsaved data if an idle session is automatically ended. To set automatic logout for a mains powered machine: Procedure Create a local database for machine-wide settings in the /etc/dconf/db/local.d/00-autologout file: Override the user's setting, and prevent the user from changing it in the /etc/dconf/db/local.d/locks/autologout file: Update the system databases: Users must log out and back in again before the system-wide settings take effect. The following GSettings keys are of interest: org.gnome.settings-daemon.plugins.power.sleep-inactive-ac-timeout The number of seconds that the computer needs to be inactive before it goes to sleep if it is running from AC power. org.gnome.settings-daemon.plugins.power.sleep-inactive-ac-type What should happen when the timeout has passed if the computer is running from AC power. org.gnome.settings-daemon.plugins.power.sleep-inactive-battery-timeout The number of seconds that the computer needs to be inactive before it goes to sleep if it is running from power. org.gnome.settings-daemon.plugins.power.sleep-inactive-battery-type What should happen when the timeout has passed if the computer is running from battery power. If you want to list available values for a key, use the following procedure: Procedure Run the gsettings range command on the required key. For example: 22.6. Setting a default desktop session for all users You can configure a default desktop session that is preselected for all users that have not logged in yet. If a user logs in using a different session than the default, their selection persists to their login. Procedure Copy the configuration file template: Edit the new /etc/accountsservice/user-templates/standard file. On the Session= gnome line, replace gnome with the session that you want to set as the default. Optional: To configure an exception to the default session for a certain user, follow these steps: Copy the template file to /var/lib/AccountsService/users/ user-name : In the new file, replace variables such as USD{USER} and USD{ID} with the user values. Edit the Session value. 22.7. Setting screen brightness and idle time By creating a local database, you can, for example: Configure the drop in the brightness level Set brightness level Set idle time Configuring the drop in the brightness level To set the drop in the brightness level when the device has been idle for some time: Procedure Create a local database for machine-wide settings in the /etc/dconf/db/local.d/00-power file including these lines: Update the system databases: Users must log out and back in again before the system-wide settings take effect. Setting brightness level To set brightness level: Procedure Create a local database for machine-wide settings in the /etc/dconf/db/local.d/00-power file, as in the following example: Replace 30 with the integer value you want to use. Update the system databases: Users must log out and back in again before the system-wide settings take effect. Setting idle time To set idle time after which the screen is blanked and the default screensaver is displayed: Procedure Create a local database for machine-wide settings in /etc/dconf/db/local.d/00-session , as in the following example: Replace 900 with the integer value you want to use. You must include the uint32 along with the integer value as shown. Update the system databases: Users must log out and back in again before the system-wide settings take effect. 22.8. Locking the screen when the user is idle To enable the screensaver and make the screen lock automatically when the user is idle, follow this procedure: Procedure Create a local database for system-wide settings in the etc/dconf/db/local.d/00-screensaver file: You must include the uint32 along with the integer key values as shown. Override the user's setting, and prevent the user from changing it in the /etc/dconf/db/local.d/locks/screensaver file: Update the system databases: Users must log out and back in again before the system-wide settings take effect. 22.9. Screencast recording GNOME Shell features a built-in screencast recorder. The recorder allows users to record desktop or application activity during their session and distribute the recordings as high-resolution video files in the webm format. To make a screencast: Procedure To start the recording, press the Ctrl + Alt + Shift + R shortcut. When the recorder is capturing the screen activity, it displays a red circle in the top-right corner of the screen. To stop the recording, press the Ctrl + Alt + Shift + R shortcut. The red circle in the top-right corner of the screen disappears. Navigate to the ~/Videos directory where you can find the recorded video with a file name that starts with Screencast and includes the date and time of the recording. Note The built-in recorder always captures the entire screen, including all monitors in multi-monitor setups.

Commands:
systemctl restart gdm.service
DCONF_PROFILE=gdm gsettings list-recursively org.gnome.login-screen
[Desktop Entry] Type=Application Name= Files Exec= /usr/bin/nautilus -n OnlyShowIn=GNOME; X-GNOME-Autostart-enabled=true
AutostartCondition=GSettings org.gnome.desktop.background show-desktop-icons
[daemon] AutomaticLoginEnable=True AutomaticLogin= john
Set the timeout to 900 seconds when on mains power sleep-inactive-ac-timeout=900 Set action after timeout to be logout when on mains power sleep-inactive-ac-type='logout'
Lock automatic logout settings /org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-timeout /org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-type
dconf update
gsettings range org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type enum 'blank' 'suspend' 'shutdown' 'hibernate' 'interactive' 'nothing' 'logout'
cp /usr/share/accountsservice/user-templates/standard /etc/accountsservice/user-templates/standard
cp /usr/share/accountsservice/user-templates/standard /var/lib/AccountsService/users/ user-name
[org/gnome/settings-daemon/plugins/power] idle-dim=true
dconf update
[org/gnome/settings-daemon/plugins/power] idle-brightness=30
dconf update
[org/gnome/desktop/session] idle-delay=uint32 900
dconf update
Set the lock time out to 180 seconds before the session is considered idle idle-delay=uint32 180 Set this to true to lock the screen when the screensaver activates lock-enabled=true Set the lock timeout to 180 seconds after the screensaver has been activated lock-delay=uint32 180
Lock desktop screensaver settings /org/gnome/desktop/session/idle-delay /org/gnome/desktop/screensaver/lock-enabled /org/gnome/desktop/screensaver/lock-delay
dconf update