From 836240e023df6ea5680c52cc2e59f7c86e79f3ad Mon Sep 17 00:00:00 2001 From: Thore Bödecker Date: Sun, 26 Jun 2022 11:21:59 +0200 Subject: add wl-clipboard support for wayland --- PKGBUILD | 5 ++++- fb.1 | 19 ++++++++++++++----- fb.py | 2 ++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 6f1fd93..96fe05f 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -8,7 +8,10 @@ arch=("any") url="https://paste.xinu.at" license=('GPL3') depends=('python' 'python-pycurl' 'python-xdg') -optdepends=('xclip: for automatically copying the URL into the clipboard') +optdepends=( + 'xclip: automatically copy the URL into the clipboard on X11' + 'wl-clipboard: automatically copy the URL into the clipboard on wayland' +) source=("git+https://git.server-speed.net/users/flo/fb#branch=dev") md5sums=('SKIP') validpgpkeys=("CFA6AF15E5C74149FC1D8C086D1655C14CE1C13E") diff --git a/fb.1 b/fb.1 index 249a23d..c777c5d 100644 --- a/fb.1 +++ b/fb.1 @@ -38,13 +38,22 @@ If the file being uploaded is bigger than 10MiB .Nm will query the server for the maximum upload size and abort the upload if the file would be rejected. +.Pp Before terminating, .Nm -will try to copy all links into the X clipboard if -.Xr xclip 1 -or on Darwin -.Xr pbcopy -is installed. +will try to copy all links into the clipboard. Depending on the environment from +which +.Nm +was executed. +If you want this to work, you need to install the correct tool for your environment: +.Bl -tag -width "wl-clipboard(1)" -offset indent +.It Xr xclip 1 +when running on X11 +.It Xr wl-clipboard 1 +when running on wayland +.It Xr pbcopy 1 +when running on Mac OS / Darwin +.El .Pp If you want to use paste.xinu.at, you need to create an account there and then run .Sq Nm Fl a diff --git a/fb.py b/fb.py index 8f24013..15d92d2 100755 --- a/fb.py +++ b/fb.py @@ -401,6 +401,8 @@ class ConfigParser: self.config["clipboard_cmd"] = "xclip" if os.uname()[0] == "Darwin": self.config["clipboard_cmd"] = "pbcopy" + elif os.environ.get('XDG_SESSION_TYPE') == 'wayland': + self.config["clipboard_cmd"] = "wl-copy" self.config["apikey_file"] = os.path.join(xdg.BaseDirectory.xdg_config_home, "fb-client/apikey") self._parse(file, ignoreMissing=ignoreMissing) -- cgit v1.2.3-24-g4f1b