Skip to content

Commit

Permalink
Merge pull request #21 from kushraj/v5
Browse files Browse the repository at this point in the history
clipboard support for wayland
  • Loading branch information
friday authored Mar 11, 2021
2 parents 4007235 + 1aafe7f commit 7251e48
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
33 changes: 33 additions & 0 deletions Clipman.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import subprocess
import json
from lib import logger, execGet, tryOr, findExec, pidOf

name = 'Clipman'
client = 'clipman'
pasteAgent = "wl-paste"
copyAgent = "wl-copy"

def canStart():
return bool(findExec(client))

def isRunning():
return True
return bool(pidOf(client))

def isEnabled():
# We can't really know this.
return True

def start():
# Open and don't wait
subprocess.Popen([pasteAgent, '-t', 'text', "--watch", client ,'store'])

def add(text):
# manager is based on another clipboard program
subprocess.call([copyAgent, text])

def getHistory():
val=json.loads(execGet(client, 'show-history'))
val.reverse()
return val

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Open Ulauncher and type the keyword `c` followed by a space. This will search yo

From Ulauncher's preferences you can change the keyword and the clipboard manager to use, number of results to be shown.

If you want to use [GPaste](https://github.com/Keruspe/GPaste/) or [CopyQ](https://github.com/hluk/CopyQ), you have to install them. Unlike the other options [Clipster](https://github.com/mrichar1/clipster) will be downloaded automatically and is used as the fallback in "Auto" mode if you don't have any of the others.
If you want to use [GPaste](https://github.com/Keruspe/GPaste/) or [CopyQ](https://github.com/hluk/CopyQ) or [Clipman](https://github.com/yory8/clipman), you have to install them. Unlike the other options [Clipster](https://github.com/mrichar1/clipster) will be downloaded automatically and is used as the fallback in "Auto" mode if you don't have any of the others.

### Copy hook

Expand Down
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import Clipster
import CopyQ
import GPaste
import Clipman

from lib import logger, pidOf, tryInt, ensureStatus, findExec, getThemeIcon, setClipboard, showMessage
from ulauncher.api.client.Extension import Extension
Expand All @@ -14,7 +15,7 @@
from ulauncher.api.shared.action.RenderResultListAction import RenderResultListAction


clipboardManagers = [CopyQ, GPaste, Clipster]
clipboardManagers = [CopyQ, GPaste, Clipster, Clipman]
sorter = lambda m: int("{}{}".format(int(m.isEnabled()), int(m.isRunning())))

def showStatus(status):
Expand Down
5 changes: 3 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"required_api_version": "2",
"api_version": "1",
"name": "Clipboard",
"description": "Ulauncher clipboard management using GPaste, Clipster or CopyQ",
"description": "Ulauncher clipboard management using GPaste, Clipster, Clipman or CopyQ",
"developer_name": "Albin Larsson",
"icon": "edit-paste.png",
"preferences": [
Expand All @@ -17,7 +17,8 @@
"Auto",
"Clipster",
"CopyQ",
"GPaste"
"GPaste",
"Clipman"
]
},
{
Expand Down

0 comments on commit 7251e48

Please sign in to comment.