]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - debian/guest-session-auto.sh
Make sleep time before starting guest dialog configurable.
[sojka/lightdm.git] / debian / guest-session-auto.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2013 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 TEXTDOMAINDIR=/usr/share/locale-langpack
15 TEXTDOMAIN=lightdm
16
17 # disable screen locking
18 gsettings set org.gnome.desktop.lockdown disable-lock-screen true
19
20 # info dialog about the temporary nature of a guest session
21 dialog_content () {
22         TITLE=$(gettext 'Temporary Guest Session')
23         TEXT=$(gettext 'All data created during this guest session will be deleted
24 when you log out, and settings will be reset to defaults.
25 Please save files on some external device, for instance a
26 USB stick, if you would like to access them again later.')
27         para2=$(gettext 'Another alternative is to save files in the
28 /var/guest-data folder.')
29         test -w /var/guest-data && TEXT="$TEXT\n\n$para2"
30 }
31 test -f "$HOME"/.skip-guest-warning-dialog || {
32         if [ "$KDE_FULL_SESSION" = true ] && [ -x /usr/bin/kdialog ]; then
33                 dialog_content
34                 TEXT_FILE="$HOME"/.guest-session-kdialog
35                 echo -n "$TEXT" > $TEXT_FILE
36                 {
37                         # Sleep to wait for the the info dialog to start.
38                         # This way the window will likely become focused.
39                         sleep $DIALOG_SLEEP
40                         kdialog --title "$TITLE" --textbox $TEXT_FILE 450 250
41                         rm -f $TEXT_FILE
42                 } &
43         elif [ -x /usr/bin/zenity ]; then
44                 dialog_content
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                         zenity --warning --no-wrap --title="$TITLE" --text="$TEXT"
50                 } &
51         fi
52 }
53
54 # run possible local startup commands
55 test -f /etc/guest-session/auto.sh && . /etc/guest-session/auto.sh