/usr/share/cinnamon/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.py is in cinnamon-common 2.8.6-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #!/usr/bin/env python2
import os
import subprocess
import gettext
from gi.repository import Gtk
import pwd
# i18n
gettext.install("cinnamon", "/usr/share/locale")
class MainWindow:
''' Create the UI '''
def __init__(self):
user_id = os.getuid()
username = pwd.getpwuid(user_id).pw_name
real_name = pwd.getpwuid(user_id).pw_gecos
home_dir = pwd.getpwuid(user_id).pw_dir
real_name = real_name.replace(",", "")
if real_name == "":
real_name = username
self.builder = Gtk.Builder()
self.builder.add_from_file("/usr/share/cinnamon/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.ui")
self.window = self.builder.get_object("main_dialog")
self.button_cancel = self.builder.get_object("button_cancel")
self.button_ok = self.builder.get_object("button_ok")
self.entry = self.builder.get_object("entry_away_message")
self.image = self.builder.get_object("image_face")
self.window.set_title(_("Screen Locker"))
self.window.set_icon_name("cs-screensaver")
self.builder.get_object("label_description").set_markup("<i>%s</i>" % _("Please type an away message for the lock screen"))
self.builder.get_object("label_away_message").set_markup("<b>%s: </b>" % real_name)
if os.path.exists("%s/.face" % home_dir):
self.image.set_from_file("%s/.face" % home_dir)
else:
self.image.set_from_file("/usr/share/pixmaps/nobody.png")
self.window.connect("destroy", Gtk.main_quit)
self.button_cancel.connect("clicked", Gtk.main_quit)
self.button_ok.connect('clicked', self.lock_screen)
self.entry.connect('activate', self.lock_screen)
self.builder.get_object("dialog-action_area1").set_focus_chain((self.button_ok, self.button_cancel))
self.window.show()
def lock_screen(self, data):
message = self.entry.get_text()
if (message != ""):
subprocess.call(["cinnamon-screensaver-command", "--lock", "--away-message", self.entry.get_text()])
else:
subprocess.call(["cinnamon-screensaver-command", "--lock"])
Gtk.main_quit()
if __name__ == "__main__":
MainWindow()
Gtk.main()
|