Beispiel #1
0
def isEnabled():
    return canStart() and execGet('gsettings', 'get', 'org.gnome.GPaste',
                                  'track-changes') == 'true'
Beispiel #2
0
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')
Beispiel #3
0
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)
Beispiel #4
0
    # 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)
Beispiel #5
0
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))
Beispiel #6
0
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'