def volumeUp(): os.popen("pamixer --increase 5 --allow-boost") volume = SystemUtil.getProcessOutput("pamixer --get-volume") Message.hint(volume)
def volumeDown(): os.popen("pamixer --decrease 5") volume = SystemUtil.getProcessOutput("pamixer --get-volume --allow-boost") Message.hint(volume)
def openSelection(): SystemUtil.openSelection("xdg-open", "")
def runSelection(): SystemUtil.runSelection()
def runSelection(): text = getSelection() common = SystemUtil.transformUrlBeforeOpen(text) os.popen("open -a " + common) return None
Since 2011-02-01 """ import logging import os import subprocess import sys import gtk import ClipboardUtil import Message import subprocess import SendToUi import SendToUi import SystemUtil fireFoxPid=SystemUtil.getProcessOutput("pidof firefox") if fireFoxPid == "": sys.exit("Firefox window is not found") lines = fireFoxPid.split(None, 4) fireFoxPid = lines[0] fireFoxWindowName=SystemUtil.getWindowNameByProcessId(fireFoxPid) (title,s,url) = fireFoxWindowName.partition('- Firefox -') lines = title.split(None, 4) title = lines[4] # sometimes there are several browser windows are opened get the url of the first window lines = url.split(None, 2) url = lines[0]
""" Sends series of characters to UI. Mac version. Based on applescript. Author Andrew Terekhine Since 2014-11-23 """ import os import string import time import MacClipboardUtil import MacCommon import MacUtil import SystemUtil if SystemUtil.isMac(): import applescript if __name__ == "__main__": import sys, PythonCall PythonCall.PythonCall(sys.argv).execute() def sendUnicodeTextAsKeyCodes(text): if len(text) == 0: return text = text.strip() command = "\nkeystroke \"" for c in text: command += ("0x" + hex(ord(c))[2:].zfill(4)) content = "tell application \"System Events\"" + command + "\" using option down\n end tell"
def openSelection(): text = getSelection() text = SystemUtil.transformUrlBeforeOpen(text) os.popen("open " + text) return None
def getLanguage(): return SystemUtil.getProcessOutput("setxkbmap -print | grep xkb_symbols | awk -F'+' '{print $2}'")
def open(title, url): text = SystemUtil.getSelection() Message.hint(title + " " + text) openExecute(url, text)
""" Sends series of characters to UI. Mac version. Based on applescript. Author Andrew Terekhine Since 2014-11-23 """ import os import string import time import MacClipboardUtil import MacCommon import MacUtil import SystemUtil if SystemUtil.isMac(): import applescript if __name__ == "__main__": import sys, PythonCall PythonCall.PythonCall(sys.argv).execute() def sendUnicodeTextAsKeyCodes(text): if len(text) == 0: return text = text.strip() command = "\nkeystroke \"" for c in text: command += ("0x" + hex(ord(c))[2:].zfill(4)) content = "tell application \"System Events\"" + command + "\" using option down\n end tell" script = applescript.AppleScript(content)