def _async_top_start(self): uid = os.getuid() utils.AsyncCommand(["top", "-b", "-n", "1", "-u", "%d" % uid], self._async_top_finished, 60, env=["LC_NUMERIC=C"])
def activate(self, leaf, ctx): if isinstance(leaf, Command): argv = ['sh', '-c', leaf.object, '--'] else: argv = [leaf.object] def finish_callback(acommand, stdout, stderr): finish_command(ctx, acommand, stdout, stderr) pretty.print_debug(__name__, "Spawning with timeout 15 seconds") utils.AsyncCommand(argv, finish_callback, 15)
def activate(self, leaf, iobj, ctx): if isinstance(iobj, Command): argv = ['sh', '-c', iobj.object] else: argv = [iobj.object] def finish_callback(acommand, stdout, stderr): finish_command(ctx, acommand, stdout, stderr, self.post_result) pretty.print_debug(__name__, "Spawning without timeout") utils.AsyncCommand(argv, finish_callback, None, stdin=leaf.object)
def _run_command(self, objs, iobj, ctx): if isinstance(iobj, Command): argv = ['sh', '-c', iobj.object + ' "$@"', '--'] else: argv = [iobj.object] def finish_callback(acommand, stdout, stderr): finish_command(ctx, acommand, stdout, stderr, False) argv.extend([o.object for o in objs]) pretty.print_debug(__name__, "Spawning without timeout") utils.AsyncCommand(argv, finish_callback, None)
def _create_note(self, text): argv = ['zim', '--plugin', 'quicknote', 'input=stdin'] basename = __kupfer_settings__['quicknote_basename'] if basename: try: basename = time.strftime(basename, time.localtime()) basename = basename.replace(':', '_') except: pass argv.append("basename=" + basename) namespace = __kupfer_settings__['quicknote_namespace'] if namespace: argv.append("namespace=" + namespace) def finish_callback(acommand, stdout, stderr): pretty.print_debug(__name__, "CreateZimQuickNote.finish_callback", acommand, stdout, stderr) utils.AsyncCommand(argv, finish_callback, None, stdin=text)
def activate(self, leaf): shortcut = leaf.object args = "xdotool search --class \"eclipse\" windowactivate --sync key --clearmodifiers \"%s\"" % shortcut['keys'].lower() argv = ['sh', '-c', args, '--'] def finish_callback(acommand, stdout, stderr): pretty.print_debug(__name__, "%s: stdout: %s, stderr: %s, shortcut: %s" % (acommand, stdout, stderr, shortcut['keys'].lower())) utils.AsyncCommand(argv, finish_callback, 15) uiutils.show_notification(shortcut['keys'], shortcut['desc'], icon_name=self.get_icon_name()) # ROADMAP # 0.1 show shortcuts for eclipse in notification # 1.0 show shortcuts for any in notification # UNSORTED future possible features: # - read / import shortcuts from server maybe using DICT protocol # - execute this shortcut at app # - edit shortcuts file/online # - use sqlite for database # - suggestions? :)