def isEnabled(): return canStart() and execGet('gsettings', 'get', 'org.gnome.GPaste', 'track-changes') == 'true'
def getHistory(): # The only separator options are zero bytes and line breaks. # Line breaks are very likely to be in the actual clipboard entries, so we can't use that. # Zero bytes are less likely, but would not be my first choice. return execGet('sh', '-c', "{0} $({0} get-history) --raw --zero".format(client)).split('\x00')
def getHistory(): # Clipster uses a json log file. However the default config is to defer/collect writes # so we have to call the client to get the latest return execGet(client, '--output', '--clipboard', '--number', '0', '--delim', delim).split(delim)
# This can't be easily tested though. The conf dir can vary return True def start(): if not isRunning(): subprocess.Popen([client, '-d']) def getHistory(): # Clipster uses a json log file. However the default config is to defer/collect writes # so we have to call the client to get the latest return execGet(client, '--output', '--clipboard', '--number', '0', '--delim', delim).split(delim) # Download and prepare binary if not canStart(): # If there's no local client, fetch it urllib.urlretrieve(binUrl, client) # Force it to use Python2 (otherwise it crashes if run from Ulauncher) # Using env in the shebang makes the process name "python2" instead of Clipster # I'm sure there's a better way, but until then... pythonBinary = execGet( 'sh', '-c', 'env python2 -c "import sys; sys.stdout.write(sys.executable)"') subprocess.call( ['sed', '-i', '1s|.*|#\\!{}|'.format(pythonBinary), client]) # Make it executable os.chmod(client, 0o755)
def getHistory(): # CopyQ uses QT's JS implementation for scripting, which doesn't support modern JS script = "history = []; for (var ind = 0; ind < size(); ind += 1) { history.push(str(read(ind))); }; JSON.stringify(history)" return json.loads(execGet(client, 'eval', script))
def isEnabled(): # activated and configured to sync clipboard # The "Auto" option detection logic will disfavor copyq when not running because it will show as disabled return isRunning() and execGet(client, 'eval', 'monitoring() && config("check_clipboard")') == 'true'