def bind_with_custom(self): print 'Using own key method - binding' x = commands.getoutput('xmodmap') if x.find('Super_L') == '-1' and Globals.Settings['Bind_Key'] == 'Super_L': os.system("xmodmap -e 'keycode 115 = Super_L'") os.system('xmodmap -e "add mod4 = Super_L"') try: from Xlib.display import Display from Xlib import X from globalkeybinding import GlobalKeyBinding gtk.gdk.threads_init () keybinding = GlobalKeyBinding (Globals.Settings['Bind_Key']) keybinding.connect ('activate', self.bindkey_callback) keybinding.grab () keybinding.start () except: if Globals.FirstUse: utils.show_message('Please install python xlib') else: print 'Please install python xlib'
def main(): GObject.threads_init() app = TerminalWin() keybinding = GlobalKeyBinding() app.keybinding = keybinding ConfigManager.ref_keybinding = keybinding ConfigManager.ref_show_hide = app.show_hide keybinding.connect('activate', lambda w: app.show_hide()) if not keybinding.grab(): ConfigManager.set_conf('losefocus-hiding', 'False') ConfigManager.set_conf('hide-on-start', 'False') app.update_ui() msgtext = "Another application using '%s'. Please open preferences and change the shortcut key." % ConfigManager.get_conf( 'global-key') msgbox = Gtk.MessageDialog(app, Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.WARNING, Gtk.ButtonsType.OK, msgtext) msgbox.run() msgbox.destroy() else: keybinding.start() Gtk.main()
def main(): GObject.threads_init() app = TerminalWin() keybinding = GlobalKeyBinding() app.keybinding = keybinding ConfigManager.ref_keybinding = keybinding ConfigManager.ref_show_hide = app.show_hide keybinding.connect('activate', lambda w: app.show_hide()) if not keybinding.grab(): ConfigManager.set_conf('losefocus-hiding', 'False') ConfigManager.set_conf('hide-on-start', 'False') app.update_ui() msgtext = "Another application using '%s'. Please open preferences and change the shortcut key." % ConfigManager.get_conf('global-key') msgbox = Gtk.MessageDialog(app, Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.WARNING, Gtk.ButtonsType.OK, msgtext) msgbox.run() msgbox.destroy() else: keybinding.start() Gtk.main()