2

When a guest user logs in, they get an alert message saying "All data created during this guest session...". I'd like to change the text of that message, but can't find where that text is coming from. I know that Zenity is used to display it, but I can't find the source of that text.

1

2 Answers 2

2

I would recommend that you create your own dialog, and disable the default one. Please see this tutorial for guidance.

Edit (example code):

$ cat /etc/guest-session/auto.sh
TITLE='Temporary Guest Session'
TEXT="Hello my Dear Guest. Hope you'll enjoy Ubuntu!"
{ sleep 4; zenity --warning --no-wrap --title="$TITLE" --text="$TEXT"; } &
4
  • I think you need to create /etc/guest-session/ first: sudo mkdir -p /etc/guest-session/ and as you suggested add touch $HOME/.skip-guest-warning-dialog to this auto.sh script. Thanks for the example code, +1 Oct 7, 2014 at 18:55
  • @SylvainPineau: Actually, the touch $HOME/.skip-guest-warning-dialog command should be placed in /etc/guest-session/prefs.sh. Oct 7, 2014 at 18:58
  • I learned a lot about the guest session today, thanks Gunnar Oct 7, 2014 at 19:01
  • @SylvainPineau: You're welcome. You may want to edit your first comment above for clarity, and then I can remove my remark. Oct 7, 2014 at 19:05
1

The source of this text is the following script:

/usr/lib/lightdm/guest-session-auto.sh

You'll have to modify it in order to change the message as there's no way to customize the $TEXT setting:

#!/bin/sh
#
# Copyright (C) 2013 Canonical Ltd
# Author: Gunnar Hjalmarsson <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, version 3 of the License.
#
# See http://www.gnu.org/copyleft/gpl.html the full text of the license.

# This script is run via autostart at the launch of a guest session.

export TEXTDOMAINDIR=/usr/share/locale-langpack
export TEXTDOMAIN=lightdm

# disable screen locking
gsettings set org.gnome.desktop.lockdown disable-lock-screen true

# info dialog about the temporary nature of a guest session
dialog_content () {
    TITLE=$(gettext 'Temporary Guest Session')
    TEXT=$(gettext 'All data created during this guest session will be deleted
when you log out, and settings will be reset to defaults.
Please save files on some external device, for instance a
USB stick, if you would like to access them again later.')
    para2=$(gettext 'Another alternative is to save files in the
/var/guest-data folder.')
    test -w /var/guest-data && TEXT="$TEXT\n\n$para2"
}
test -f "$HOME"/.skip-guest-warning-dialog || {
    if [ "$KDE_FULL_SESSION" = true ] && [ -x /usr/bin/kdialog ]; then
        dialog_content
        TEXT_FILE="$HOME"/.guest-session-kdialog
        echo -n "$TEXT" > $TEXT_FILE
        {
            # Sleep to wait for the the info dialog to start.
            # This way the window will likely become focused.
            sleep $DIALOG_SLEEP
            kdialog --title "$TITLE" --textbox $TEXT_FILE 450 250
            rm -f $TEXT_FILE
        } &
    elif [ -x /usr/bin/zenity ]; then
        dialog_content
        {
            # Sleep to wait for the the info dialog to start.
            # This way the window will likely become focused.
            sleep $DIALOG_SLEEP
            zenity --warning --no-wrap --title="$TITLE" --text="$TEXT"
        } &
    fi
}

# run possible local startup commands
test -f /etc/guest-session/auto.sh && . /etc/guest-session/auto.sh
4
  • Editing that file is not a good idea, since any changes will be overwritten at next lightdm update. Oct 7, 2014 at 15:34
  • @GunnarHjalmarsson May I suggest to enhance your script with a new parameter to store a custom dialog text (e.g: "$HOME"/.guest-warning-dialog-text). It won't be gettext-friendly but could perhaps avoid creating the guest-prefs user. Oct 7, 2014 at 16:40
  • Better leave that script for the default behavior and create your own dialog. I just edited my own answer to show how it can be done. No need to create guest-prefs, even if I think that most users want to do so anyway once they have started to customize guest session. Oct 7, 2014 at 18:49
  • @GunnarHjalmarsson Indeed, thanks for the detailed answer. Oct 7, 2014 at 18:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .