From ff8222fc6f5e93db161ffe98bf8e2b994dc9bed4 Mon Sep 17 00:00:00 2001 From: Bartek Stalewski Date: Thu, 7 Oct 2021 22:54:37 +0200 Subject: [PATCH] Script for cliboard merging. --- .gitignore | 1 + _desktop/clipboard/clipboard/run | 21 ++++++++++++++++++ _desktop/clipboard/clipboard/supervise/lock | 0 _desktop/clipboard/clipboard/supervise/pid | 1 + _desktop/clipboard/clipboard/supervise/stat | 1 + _desktop/clipboard/clipboard/supervise/status | Bin 0 -> 20 bytes _desktop/clipboard/primary/run | 21 ++++++++++++++++++ _desktop/clipboard/primary/supervise/lock | 0 _desktop/clipboard/primary/supervise/pid | 1 + _desktop/clipboard/primary/supervise/stat | 1 + _desktop/clipboard/primary/supervise/status | Bin 0 -> 20 bytes _desktop/clipboard/secondary/run | 21 ++++++++++++++++++ _desktop/clipboard/secondary/supervise/lock | 0 _desktop/clipboard/secondary/supervise/pid | 1 + _desktop/clipboard/secondary/supervise/stat | 1 + _desktop/clipboard/secondary/supervise/status | Bin 0 -> 20 bytes _desktop/install-desktop.sh | 6 ++++- 17 files changed, 75 insertions(+), 1 deletion(-) create mode 100755 _desktop/clipboard/clipboard/run create mode 100644 _desktop/clipboard/clipboard/supervise/lock create mode 100644 _desktop/clipboard/clipboard/supervise/pid create mode 100644 _desktop/clipboard/clipboard/supervise/stat create mode 100644 _desktop/clipboard/clipboard/supervise/status create mode 100755 _desktop/clipboard/primary/run create mode 100644 _desktop/clipboard/primary/supervise/lock create mode 100644 _desktop/clipboard/primary/supervise/pid create mode 100644 _desktop/clipboard/primary/supervise/stat create mode 100644 _desktop/clipboard/primary/supervise/status create mode 100755 _desktop/clipboard/secondary/run create mode 100644 _desktop/clipboard/secondary/supervise/lock create mode 100644 _desktop/clipboard/secondary/supervise/pid create mode 100644 _desktop/clipboard/secondary/supervise/stat create mode 100644 _desktop/clipboard/secondary/supervise/status diff --git a/.gitignore b/.gitignore index 67f7fb5..d288c66 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ _desktop/qutebrowser/bookmarks/urls _desktop/qutebrowser/quickmarks +_desktop/clipboard/selection diff --git a/_desktop/clipboard/clipboard/run b/_desktop/clipboard/clipboard/run new file mode 100755 index 0000000..e737925 --- /dev/null +++ b/_desktop/clipboard/clipboard/run @@ -0,0 +1,21 @@ +#!/bin/sh +set -e +exec 2>&1 + +SEL="../selection" + + +# "xsel --nodetach --input" with an empty input will still exit immediately, +# so we need to make sure the selection never is empty: +[ -s "$SEL" ] || echo >| "$SEL" + +xsel --nodetach --logfile /dev/stdout --"$(basename "`pwd`")" \ + --input < "$SEL" + +# something else grabbed the selection. pull it over here: +xsel --nodetach --logfile /dev/stdout --"$(basename "`pwd`")" \ + --output > "$SEL".new +# see above: +[ -s "$SEL" ] || echo >| "$SEL" +mv "$SEL".new "$SEL" +sv term ../primary ../secondary ../clipboard diff --git a/_desktop/clipboard/clipboard/supervise/lock b/_desktop/clipboard/clipboard/supervise/lock new file mode 100644 index 0000000..e69de29 diff --git a/_desktop/clipboard/clipboard/supervise/pid b/_desktop/clipboard/clipboard/supervise/pid new file mode 100644 index 0000000..6014170 --- /dev/null +++ b/_desktop/clipboard/clipboard/supervise/pid @@ -0,0 +1 @@ +23923 diff --git a/_desktop/clipboard/clipboard/supervise/stat b/_desktop/clipboard/clipboard/supervise/stat new file mode 100644 index 0000000..f5bdd21 --- /dev/null +++ b/_desktop/clipboard/clipboard/supervise/stat @@ -0,0 +1 @@ +run diff --git a/_desktop/clipboard/clipboard/supervise/status b/_desktop/clipboard/clipboard/supervise/status new file mode 100644 index 0000000000000000000000000000000000000000..d09e69187db8dfc9db13c2b4873304373c5703e1 GIT binary patch literal 20 acmZ=@U|>j$j|&1 + +SEL="../selection" + + +# "xsel --nodetach --input" with an empty input will still exit immediately, +# so we need to make sure the selection never is empty: +[ -s "$SEL" ] || echo >| "$SEL" + +xsel --nodetach --logfile /dev/stdout --"$(basename "`pwd`")" \ + --input < "$SEL" + +# something else grabbed the selection. pull it over here: +xsel --nodetach --logfile /dev/stdout --"$(basename "`pwd`")" \ + --output > "$SEL".new +# see above: +[ -s "$SEL" ] || echo >| "$SEL" +mv "$SEL".new "$SEL" +sv term ../primary ../secondary ../clipboard diff --git a/_desktop/clipboard/primary/supervise/lock b/_desktop/clipboard/primary/supervise/lock new file mode 100644 index 0000000..e69de29 diff --git a/_desktop/clipboard/primary/supervise/pid b/_desktop/clipboard/primary/supervise/pid new file mode 100644 index 0000000..79c5b12 --- /dev/null +++ b/_desktop/clipboard/primary/supervise/pid @@ -0,0 +1 @@ +23922 diff --git a/_desktop/clipboard/primary/supervise/stat b/_desktop/clipboard/primary/supervise/stat new file mode 100644 index 0000000..f5bdd21 --- /dev/null +++ b/_desktop/clipboard/primary/supervise/stat @@ -0,0 +1 @@ +run diff --git a/_desktop/clipboard/primary/supervise/status b/_desktop/clipboard/primary/supervise/status new file mode 100644 index 0000000000000000000000000000000000000000..8abe1040888b5a12eb6d246f0f075ed463d235af GIT binary patch literal 20 acmZ=@U|>j$j|&1 + +SEL="../selection" + + +# "xsel --nodetach --input" with an empty input will still exit immediately, +# so we need to make sure the selection never is empty: +[ -s "$SEL" ] || echo >| "$SEL" + +xsel --nodetach --logfile /dev/stdout --"$(basename "`pwd`")" \ + --input < "$SEL" + +# something else grabbed the selection. pull it over here: +xsel --nodetach --logfile /dev/stdout --"$(basename "`pwd`")" \ + --output > "$SEL".new +# see above: +[ -s "$SEL" ] || echo >| "$SEL" +mv "$SEL".new "$SEL" +sv term ../primary ../secondary ../clipboard diff --git a/_desktop/clipboard/secondary/supervise/lock b/_desktop/clipboard/secondary/supervise/lock new file mode 100644 index 0000000..e69de29 diff --git a/_desktop/clipboard/secondary/supervise/pid b/_desktop/clipboard/secondary/supervise/pid new file mode 100644 index 0000000..63c1721 --- /dev/null +++ b/_desktop/clipboard/secondary/supervise/pid @@ -0,0 +1 @@ +23921 diff --git a/_desktop/clipboard/secondary/supervise/stat b/_desktop/clipboard/secondary/supervise/stat new file mode 100644 index 0000000..f5bdd21 --- /dev/null +++ b/_desktop/clipboard/secondary/supervise/stat @@ -0,0 +1 @@ +run diff --git a/_desktop/clipboard/secondary/supervise/status b/_desktop/clipboard/secondary/supervise/status new file mode 100644 index 0000000000000000000000000000000000000000..b495cde1ba6703b4c5e77499865313ded6e86a50 GIT binary patch literal 20 acmZ=@U|>j$j|