Skip to content

Commit

Permalink
Merge pull request #160 from signed-log/wayland-priority
Browse files Browse the repository at this point in the history
Conditionally prefer wl-copy under wayland
  • Loading branch information
jarun authored Jan 1, 2024
2 parents bbbec3a + d1e32b5 commit b302ca3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ A big advantage of `ddgr` over `googler` is DuckDuckGo works over the Tor networ

`ddgr` requires Python 3.8 or later. Only the latest patch release of each minor version is supported.

To copy url to clipboard at the omniprompt, `ddgr` looks for `xsel` or `xclip` or `termux-clipboard-set` (in the same order) on Linux, `pbcopy` (default installed) on OS X, `clip` (default installed) on Windows and `clipboard` (default installed) on Haiku. It also supports GNU Screen and tmux copy-paste buffers in the absence of X11.
To copy url to clipboard at the omniprompt, `ddgr` looks for `wl-copy` (only under Wayland) or `xsel` or `xclip` or `termux-clipboard-set` (in the same order) on Linux, `pbcopy` (default installed) on OS X, `clip` (default installed) on Windows and `clipboard` (default installed) on Haiku. It also supports GNU Screen and tmux copy-paste buffers in the absence of X11.

Note: v1.1 and below require the Python3 `requests` library to make HTTPS requests. This dependency is removed in the later releases.

Expand Down
6 changes: 3 additions & 3 deletions ddgr
Original file line number Diff line number Diff line change
Expand Up @@ -1719,12 +1719,12 @@ class DdgCmd:
# try copying the url to clipboard using native utilities
copier_params = []
if sys.platform.startswith(('linux', 'freebsd', 'openbsd')):
if shutil.which('xsel') is not None:
if os.getenv('WAYLAND_DISPLAY') is not None and shutil.which('wl-copy') is not None:
copier_params = ['wl-copy']
elif shutil.which('xsel') is not None:
copier_params = ['xsel', '-b', '-i']
elif shutil.which('xclip') is not None:
copier_params = ['xclip', '-selection', 'clipboard']
elif shutil.which('wl-copy') is not None:
copier_params = ['wl-copy']
# If we're using Termux (Android) use its 'termux-api'
# add-on to set device clipboard.
elif shutil.which('termux-clipboard-set') is not None:
Expand Down

0 comments on commit b302ca3

Please sign in to comment.