| Server IP : 172.67.134.114 / Your IP : 104.23.197.122 Web Server : Apache/2.4.37 System : Linux almalinux.duckdns.org 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64 User : ricodeal ( 1046) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/libexec/ |
Upload File : |
#!/usr/libexec/platform-python
# SPDX-License-Identifier: GPL-3.0+
# License-Filename: LICENSES/GPL-3.0
import gi
gi.require_version("GLib", "2.0")
from gi.repository import Gio, GLib
def on_activate(app):
if app._inhibitor:
return
app.hold()
bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
var, fdlist = bus.call_with_unix_fd_list_sync('org.freedesktop.login1',
'/org/freedesktop/login1',
'org.freedesktop.login1.Manager',
'Inhibit',
GLib.Variant('(ssss)',
('handle-lid-switch',
'gnome-tweak-tool-lid-inhibitor',
'user preference',
'block')),
None, 0, -1, None, None)
app._inhibitor = Gio.UnixInputStream(fd=fdlist.steal_fds()[var[0]])
def on_quit_action(action, param, app):
app.quit()
if __name__ == '__main__':
app = Gio.Application(application_id='org.gnome.tweak-tool.lid-inhibitor', flags=0)
app.connect('activate', on_activate)
app._inhibitor = None
action = Gio.SimpleAction(name='quit')
app.add_action(action)
action.connect('activate', on_quit_action, app)
app.run([])