• Stars
    star
    144
  • Rank 255,590 (Top 6 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created almost 12 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The Cinnamon screen locker and screensaver program

Cinnamon Screensaver

build

Program Entry

Main entry is from /usr/bin/cinnamon-screensaver to cinnamon-screensaver-main.py, which launches a dbus service (org.cinnamon.Screensaver)

service.py launches the ScreensaverManager (manager.py), which is central command for all things here, as well as a session proxy to listen for idle changes from cinnamon-session, and logind or consolekit proxues.

Running

At this point we're listening, either for a command sent by the user (like via cinnamon-screensaver-command) or from one of our proxies.

Locking (active)

Once a lock command is received, the manager spawns a main window (Stage in stage.py) which covers the entire Gdk screen size (an imaginary rectangle containing all monitors).

Think of this overlay as very basic window manager. Into this overlay it places:

  • MonitorViews (monitorView.py) - one for each monitor, painted with the user's background, placed at the exact location of each window.
  • A clock widget, which bounces around mostly randomly around all monitors
  • An unlock widget, which is initially hidden

At this point we're also now setup to receive user events like button and key presses, and motion events. This is assisted by the GrabHelper and EventHandler that ensure only those keystrokes we want are allowed, and muffin is blocked from processing global keybindings.

  • Any motion is a wake event (show the unlock widget or kill the stage if we're not locked)
  • Any click is a wake event (ditto)
  • Keypresses are first filtered - media keys are checked, and things like volume, brightness controls will not raise the unlock dialog (for now, only if they're simple key combinations - complex ones with modifiers will still do it)
  • key strokes for characters will be forwarded to the dialog - if you start typing your password on a blank screensaver screen, it will be forwarded to the password entry.

Unlocking

Once the user types their password and hits enter or clicks unlock, we authenticate via a pam helper in cinnamon-desktop.

If the authentication is successful, all widgets are destroyed, all grabs released, and we go back to the idle listening state.

Files:

application.css: Application priority css, stuff to make the unlock dialog, clock widgets look ok against varying backgrounds

cinnamon-screensaver-command.py: Send commands to the screensaver via the command line

cinnamon-screensaver-main.py: Main entry point into the program, handles a couple of arguments, adds our css provider, fires up the ScreensaverService.

baseWindow.py: A base revealer class that the Clock and Unlock widgets implement - any widget that will move around the Stage should implement this (except the monitorViews) - the revealer base lets you do simple fade-ins and fade-outs.

cinnamonProxy.py: Connects to Cinnamon's dbus interface, asks Cinnamon to make sure expo or overview are closed (as they make a server grab that we can't wrest focus from, preventing the screensaver from activating).

clock.py (inherits BaseWindow): The clock widget that bounces around the screen, this contains all of that. Positioning is done via a randomizer on a timer that adjusts vertical and horizontal alignment properties (one of start, center, or end) along with current monitor, which is used by the Stage positioning function to tell it where to place the Clock widget.

config.py.in (compiles into config.py): Contains system-specific file locations that are used by various files here.

consoleKitProxy.py: Listens to commands from consolekit over dbus

constants.py: A file containing simply a list of hardcoded screens/values that various files here use.

eventHandler.py: Gets forwarded all events received from various sources, and acts on them. Does not propagate except in the case of motion.

fader.py: A helper for the Stage that uses a frame tick callback to fade the stage in our out over a specific timeframe. Since it uses the frame clock instead of a GSource, times remain consistent, and only as many frames are drawn as there is time for (a 1 second animation will take one second, but you might not see all 60 frame draws)

focusNavigator.py: A helper for navigating focus and performing activation on the navigable widgets on the unlock screen. Since we funnel events so strictly, and don't perform any propagation (to prevent wm or desktop keybindings from triggering) we have to manage the focus ourselves, as well as performing activation on the focused widget when enter or space is pressed.

grabHelper.py: A helper for achieving exclusive mouse and key grabs, as well as hiding the mouse pointer when appropriate.

keybindings.py: gets fed key events from the EventHandler, and acts on them or not - allows certain media keys, handles escape, enter, space events.

logindProxy.py: Listens to commands from logind over dbus

manager.py: This is the head honcho, the big cheese, el numero uno. It spawns the GrabHelper, FocusNavigator, along with the session and logind/ck proxies. It acts on commands received from there, as well as our own dbus service (ScreensaverService). It manages all the flags in status.py, spawns and despawns the stage.

monitorView.py: This is a widget that gets placed in the stage that provides the backgrounds or screensaver plugin view. There is one per monitor, and they are positioned directly where each monitor is by the Stage positioning function. It handles transitioning between backgrounds (during a slideshow) and transitioning between plugins and wallpaper.

service.py: This is our implementation of the dbus service "org.cinnamon.Screensaver" - commands received via this interface are sent to the manager for answers and action. This spawns the manager.

sessionProxy.py: Listens to cinnamon-session for idle changes and notifies the manager when they change.

settings.py: holds our GSettings instances, as well as getters for each of the different keys. Also takes care of our CinnamonDesktop BG instance, and updates it when settings change.

stage.py: This is our toplevel window, a GtkWindow. It is made the size of the GdkScreen (a theoretical rectangle that exactly encompasses all monitors). At its core is a GtkOverlay, which we sort of use like a window manager. The position_overlay_child callback is used to position our children (Clock, UnlockWidget, MonitorView). A forced call to this position function can be done via overlay.queue_resize(). This class talks fairly freely with the manager, even though it is spawned and despawned by the manager repeatedly (when the screensaver is activated/deactivated)

status.py: A global state tracker, used by many widgets - Active means the screensaver stage exists, and we're displaying wallpaper or whatever. Locked means we will need to enter our password to unlock. Awake means the unlock dialog is currently shown. focusChain is where a list of focusable widgets should be stored that tab will navigate between. (This is currently done just in the UnlockDialog)

trackers.py: A utility for easy tracking of timers and signal connections. It basically performs any cleanup for you, with no need to track source ids or signal ids generally.

unlock.py: Provides the unlock dialog, including the user image, name, password entry and buttons

utils.py: Various utilities that seem best to keep in one place.

x11.py: X11-specific focus helper function - optional, python3-xlib doesn't exist everywhere yet.

More Repositories

1

cinnamon

A Linux desktop featuring a traditional layout, built from modern technology and introducing brand new innovative features.
JavaScript
4,196
star
2

nemo

File browser for Cinnamon
C
1,046
star
3

timeshift

System restore tool for Linux. Creates filesystem snapshots using rsync+hardlinks, or BTRFS snapshots. Supports scheduled snapshots, multiple backup levels, and exclude filters. Snapshots can be restored while system is running or from Live CD/USB.
Vala
971
star
4

warpinator

Share files across the LAN
Python
959
star
5

hypnotix

An M3U IPTV Player
Python
865
star
6

cinnamon-spices-applets

Applets for the Cinnamon desktop
JavaScript
526
star
7

webapp-manager

Python
501
star
8

xed

X-Apps [Text] Editor (Cross-DE, backward-compatible, GTK3, traditional UI)
C
392
star
9

nemo-extensions

A set of extensions for Nemo
C
374
star
10

slick-greeter

A slick-looking LightDM greeter
Vala
308
star
11

mintupdate

The Linux Mint Update Manager
Python
267
star
12

mint-themes

Mint-X, Mint-Y..
CSS
190
star
13

sticky

A sticky notes app for the linux desktop
Python
186
star
14

muffin

The window management library for the Cinnamon desktop (libmuffin) and its sample WM binary (muffin)
C
186
star
15

xreader

A generic Document Reader
C
184
star
16

cinnamon-desktop

The cinnamon-desktop library (and common settings schemas for the cinnamon desktop)
C
173
star
17

pix

Image management application
C
172
star
18

cinnamon-spices-themes

Themes for the Cinnamon desktop
CSS
139
star
19

mintstick

Python
131
star
20

blueberry

A Bluetooth configuration tool
Python
126
star
21

mintinstall

Software Manager
Python
119
star
22

cinnamon-spices-desklets

Desklets for the Cinnamon desktop
JavaScript
116
star
23

mint-y-icons

The Mint-Y icon theme
Python
100
star
24

mdm

The MDM Display Manager
C
94
star
25

cinnamon-spices-extensions

Extensions for the Cinnamon desktop
JavaScript
93
star
26

lightdm-settings

A configuration tool for the LightDM display manager
Python
92
star
27

mintmenu

Advanced Mint menu for MATE
Python
86
star
28

xplayer

A generic Media Player
C
81
star
29

xapp

Cross-desktop libraries and common resources
C
75
star
30

bulky

Bulk Renamer
Python
73
star
31

mint-y-theme

This is an old repository, please check https://github.com/linuxmint/mint-themes instead.
CSS
71
star
32

xviewer

A generic Image viewer
C
66
star
33

cjs

The Cinnamon Javascript interpreter
C++
65
star
34

mintwelcome

Welcome screen
Python
64
star
35

cinnamon-control-center

A collection of configuration plugins used in cinnamon-settings
C
63
star
36

website-wizixo

CSS
59
star
37

cinnamon-settings-daemon

The settings daemon for the Cinnamon desktop
C
56
star
38

mintdrivers

Driver Manager
Python
54
star
39

live-installer

A live installer for the Debian edition
HTML
53
star
40

mintbackup

The mintBackup Backup Tool
Python
52
star
41

mint-x-icons

Icon theme for Linux Mint
Python
51
star
42

mintsystem

Python
51
star
43

mintdesktop

Desktop configuration tool for MATE and Xfce
Python
51
star
44

mintsources

Python
50
star
45

linuxmint

Linux Mint
48
star
46

mint4win

Windows installer for Linux Mint based on Wubi
C++
44
star
47

ubiquity

Installer
Python
43
star
48

mate

MATE Debian Packages (please report bugs either to MATE or Linux Mint directly)
Python
39
star
49

pia-manager

A VPN configuration tool for PIA
Python
31
star
50

mintupgrade

Python
31
star
51

nvidia-prime-applet

Python
29
star
52

mintnanny

Domain blocker
Python
29
star
53

xapp-thumbnailers

Thumbnailers for GTK Desktop Environments
Python
27
star
54

cinnamon-session

The Cinnamon session manager
C
25
star
55

thingy

Library - Recent and favorite documents
Python
25
star
56

cinnamon-menus

The cinnamon-menu library
C
24
star
57

gtk

GTK toolkit for Betsy (master) and Mint 17.
C
22
star
58

mint-dev-tools

Python
21
star
59

mint20-beta

BETA Bug Squah Rush
21
star
60

doc-user-guide

The Linux Mint User Guide
Python
20
star
61

mintcommon

Python
20
star
62

doc-developer-guide

The Linux Mint Developer Guide
20
star
63

mintupgrade-legacy

Tool to upgrade from one LTS to another.
Python
20
star
64

gdebi

Pinned version of gdebi in Mint 18.x
Python
19
star
65

cinnamon-translations

Makefile
18
star
66

python3-xapp

Python3 Xapp Library
Python
17
star
67

mint-themes-gtk3

CSS
16
star
68

folder-color-switcher

Python
16
star
69

mint21-beta

BETA Bug Squash Rush
16
star
70

mintreport

Troubleshooting tool
Python
16
star
71

mintupload

Uploads files on the Internet
Python
16
star
72

mintlocale

Python
14
star
73

doc-troubleshooting-guide

The Linux Mint Troubleshooting Guide
Python
12
star
74

flags

Source package for iso-flag-png
12
star
75

cinnamon-themes

This is an old repository, please check https://github.com/linuxmint/mint-themes instead.
CSS
12
star
76

brand-logo

Linux Mint Logo and brand resources
11
star
77

mint19.3-beta

BETA Bug Squah Rush
10
star
78

wine-installer

Meta package and missing files for Wine
10
star
79

mint-translations

Python
10
star
80

mint20.1-beta

BETA Bug Squah Rush
9
star
81

mint21.2-beta

BETA Bug Squash Rush
9
star
82

mint-mdm-themes

JavaScript
9
star
83

xfce-panel

C
8
star
84

linuxmint.github.io

This is the content of https://projects.linuxmint.com
HTML
8
star
85

ubuntu-drivers-common

Python
8
star
86

xfce4-xapp-status-plugin

XappStatus panel applet for Xfce4
C
8
star
87

xviewer-plugins

C
8
star
88

gnome-screenshot

Patched version for Linux Mint 18, and 19.
C
7
star
89

mint20.3-beta

BETA Bug Squah Rush
7
star
90

libreoffice-style-mint

Icons for LibreOffice
7
star
91

cinnamon-bluetooth

No longer used. Please check blueberry instead.
Shell
7
star
92

mint-l-theme

Mint-L Theme
CSS
7
star
93

apturl

Python
7
star
94

mint-y-colors

Temporary project to work on colors
Python
7
star
95

mint21.1-beta

BETA Bug Squash Rush
7
star
96

libappindicator

Patched version of libappindicator (falls back to XAppStatusIcon instead of GtkStatusIcon)
C
6
star
97

xplayer-plparser

C
6
star
98

mint-upgrade-info

Metadata used to upgrade from one minor release to the next
6
star
99

lmde6-beta

BETA Bug Squash Rush
6
star
100

doc-translation-guide

The Linux Mint Translation Guide
6
star