Python Xlib.XK.keysym_to_string() Examples

The following are 9 code examples of Xlib.XK.keysym_to_string(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module Xlib.XK , or try the search function .
Example #1
Source File: main.py    From inkscape-shortcut-manager with MIT License 6 votes vote down vote up
def listen(self):
        self.grab()
        while True:
            evt = self.disp.next_event()
            if evt.type in [X.KeyPress, X.KeyRelease]:
                keycode = evt.detail
                keysym = self.disp.keycode_to_keysym(keycode, 0)
                char = XK.keysym_to_string(keysym)
                self.disp.allow_events(X.ReplayKeyboard, X.CurrentTime)

                self.mode(self, evt, char)

            if evt.type == X.DestroyNotify:
                if evt.window.id == self.id:
                    self.ungrab()
                    return 
Example #2
Source File: normal.py    From inkscape-shortcut-manager with MIT License 5 votes vote down vote up
def event_to_string(self, event):
    mods = []
    if event.state & X.ShiftMask:
        mods.append('Shift')

    if event.state & X.ControlMask:
        mods.append('Control')

    keycode = event.detail
    keysym = self.disp.keycode_to_keysym(keycode, 0)
    char = XK.keysym_to_string(keysym)

    return ''.join(mod + '+' for mod in mods) + (char if char else '?') 
Example #3
Source File: pyxhook.py    From Python-Programs with GNU General Public License v3.0 5 votes vote down vote up
def mousemoveevent(self, event):
        self.mouse_position_x = event.root_x
        self.mouse_position_y = event.root_y

    # need the following because XK.keysym_to_string() only does printable chars
    # rather than being the correct inverse of XK.string_to_keysym() 
Example #4
Source File: pyxhook.py    From clix with MIT License 5 votes vote down vote up
def mousemoveevent(self, event):
        self.mouse_position_x = event.root_x
        self.mouse_position_y = event.root_y
        return self.makemousehookevent(event)

    # need the following because XK.keysym_to_string() only does printable
    # chars rather than being the correct inverse of XK.string_to_keysym() 
Example #5
Source File: pyxhook.py    From botnet-lab with MIT License 5 votes vote down vote up
def mousemoveevent(self, event):
        self.mouse_position_x = event.root_x
        self.mouse_position_y = event.root_y

    # need the following because XK.keysym_to_string() only does printable chars
    # rather than being the correct inverse of XK.string_to_keysym() 
Example #6
Source File: pyxhook.py    From py-keylogger with MIT License 5 votes vote down vote up
def mousemoveevent(self, event):
        self.mouse_position_x = event.root_x
        self.mouse_position_y = event.root_y

    # need the following because XK.keysym_to_string() only does printable chars
    # rather than being the correct inverse of XK.string_to_keysym() 
Example #7
Source File: pyxhook.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def mousemoveevent(self, event):
        self.mouse_position_x = event.root_x
        self.mouse_position_y = event.root_y
        return self.makemousehookevent(event)

    # need the following because XK.keysym_to_string() only does printable chars
    # rather than being the correct inverse of XK.string_to_keysym() 
Example #8
Source File: pyxhook.py    From MouseTracks with GNU General Public License v3.0 5 votes vote down vote up
def mousemoveevent(self, event):
        self.mouse_position_x = event.root_x
        self.mouse_position_y = event.root_y
        return self.makemousehookevent(event)

    # need the following because XK.keysym_to_string() only does printable
    # chars rather than being the correct inverse of XK.string_to_keysym() 
Example #9
Source File: pyxhook.py    From PythonP2PBotnet with MIT License 5 votes vote down vote up
def mousemoveevent(self, event):
        self.mouse_position_x = event.root_x
        self.mouse_position_y = event.root_y

    # need the following because XK.keysym_to_string() only does printable chars
    # rather than being the correct inverse of XK.string_to_keysym()