Gtk4SessionLock.Instance¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
The |
|
The |
|
The |
|
The |
Fields¶
- Inherited:
Class Details¶
- class Gtk4SessionLock.Instance(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
An instance of the object used to control locking the screen. Multiple instances can exist at once, but only one can be locked at a time.
New in version 1.1.
- classmethod new()¶
- Returns:
new session lock instance
- Return type:
- assign_window_to_monitor(window, monitor)¶
- Parameters:
window (
Gtk.Window) – The GTK Window to use as a lock surfacemonitor (
Gdk.Monitor) – The monitor to show it on
This must be called with a different unrealized window once for each monitor immediately after calling gtk_session_lock_lock(). Hiding a window that is active on a monitor or not letting a window be resized by the library is not allowed (may result in a Wayland protocol error). The window will be unmapped and
Gtk.Window.destroy() called on it when the current lock ends.
- lock()¶
- Returns:
false on immediate fail, true if lock acquisition was successfully started
- Return type:
Lock the screen. This should be called before assigning any windows to monitors. If this function fails the
::failedsignal is emitted, if it succeeds the::lockedsignal is emitted. The::failedsignal may be emitted before the function returns (for example, if anotherGtk4SessionLock.Instanceholds a lock) or later (if another process holds a lock). The only case where neither signal is triggered is if the instance is already locked.
- unlock()¶
If the screen is locked by this instance unlocks it and fires
::unlocked. Otherwise has no effect
Signal Details¶
- Gtk4SessionLock.Instance.signals.failed(instance)¶
- Signal Name:
failed- Flags:
- Parameters:
instance (
Gtk4SessionLock.Instance) – The object which received the signal
The
::failedsignal is fired when the lock could not be acquired.
- Gtk4SessionLock.Instance.signals.locked(instance)¶
- Signal Name:
locked- Flags:
- Parameters:
instance (
Gtk4SessionLock.Instance) – The object which received the signal
The
::lockedsignal is fired when the screen is successfully locked.
- Gtk4SessionLock.Instance.signals.monitor(instance, monitor)¶
- Signal Name:
monitor- Flags:
- Parameters:
instance (
Gtk4SessionLock.Instance) – The object which received the signalmonitor (
Gdk.Monitor) – theGdk.Monitorthat exists or was added
The
::monitorsignal is fired once for each monitor that exists when a lock is started, and then whenever a new monitor is detected during the lock. You generally want to callGtk4SessionLock.Instance.assign_window_to_monitor() once in the handler for this signal with a newly created window and the given monitor.This API does not directly tell you when a monitor is removed (GTK APIs can be used for that), however the window you send to
Gtk4SessionLock.Instance.assign_window_to_monitor() will be automatically unmapped and dereferenced when its monitor is removed or the screen is unlocked.New in version 1.2.
- Gtk4SessionLock.Instance.signals.unlocked(instance)¶
- Signal Name:
unlocked- Flags:
- Parameters:
instance (
Gtk4SessionLock.Instance) – The object which received the signal
The
::unlockedsignal is fired when the session is unlocked, which may have been caused by a call toGtk4SessionLock.Instance.unlock() or by the compositor.