]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - debian/guest-session-auto.sh
Skip guest warning dialog in MATE (LP: #1627395)
[sojka/lightdm.git] / debian / guest-session-auto.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2013-2016 Canonical Ltd
4 # Author: Gunnar Hjalmarsson <gunnarhj@ubuntu.com>
5 #
6 # This program is free software: you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free Software
8 # Foundation, version 3 of the License.
9 #
10 # See http://www.gnu.org/copyleft/gpl.html the full text of the license.
11
12 # This script is run via autostart at the launch of a guest session.
13
14 export TEXTDOMAINDIR=/usr/share/locale-langpack
15 export TEXTDOMAIN=lightdm
16
17 # disable screen locking (GNOME, Unity)
18 gsettings set org.gnome.desktop.lockdown disable-lock-screen true
19
20 # disable screen locking (MATE)
21 gsettings set org.mate.screensaver lock-enabled false
22
23 # disable screenlocking (XFCE, Pantheon)
24 gsettings set apps.light-locker light-locker-enabled false
25 gsettings set apps.light-locker late-locking false
26 gsettings set apps.light-locker lock-on-lid false
27 gsettings set apps.light-locker lock-on-suspend false
28
29 # info dialog about the temporary nature of a guest session
30 dialog_content () {
31         TITLE=$(gettext 'Temporary Guest Session')
32         TEXT=$(gettext 'All data created during this guest session will be deleted
33 when you log out, and settings will be reset to defaults.
34 Please save files on some external device, for instance a
35 USB stick, if you would like to access them again later.')
36         para2=$(gettext 'Another alternative is to save files in the
37 /var/guest-data folder.')
38         test -w /var/guest-data && TEXT="$TEXT\n\n$para2"
39 }
40 if [ ! -f "$HOME"/.skip-guest-warning-dialog ] && [ "$XDG_CURRENT_DESKTOP" != 'MATE' ]; then
41         if [ "$KDE_FULL_SESSION" = true ] && [ -x /usr/bin/kdialog ]; then
42                 dialog_content
43                 TEXT_FILE="$HOME"/.guest-session-kdialog
44                 echo -n "$TEXT" > $TEXT_FILE
45                 {
46                         # Sleep to wait for the the info dialog to start.
47                         # This way the window will likely become focused.
48                         sleep $DIALOG_SLEEP
49                         kdialog --title "$TITLE" --textbox $TEXT_FILE 450 250
50                         rm -f $TEXT_FILE
51                 } &
52         elif [ -x /usr/bin/zenity ]; then
53                 dialog_content
54                 {
55                         # Sleep to wait for the the info dialog to start.
56                         # This way the window will likely become focused.
57                         sleep $DIALOG_SLEEP
58                         zenity --warning --no-wrap --title="$TITLE" --text="$TEXT"
59                 } &
60         fi
61 fi
62
63 # run possible local startup commands
64 test -f /etc/guest-session/auto.sh && . /etc/guest-session/auto.sh