▲ 2 ▼ KDE cli clipboard (iusearchlinux.fyi) submitted 2 years ago by tunawasherepoo@iusearchlinux.fyi to c/snippets@iusearchlinux.fyi 4 comments fedilink hide all child comments $ cat /usr/local/bin/c #!/bin/sh if test -n "$1"; then STDIN="${1}" elif test ! -t 0; then STDIN=$(cat) else echo 'Usage:' echo ' c < /path/to/file' echo ' c text-to-be-copied' echo ' command | c' exit 1 fi qdbus org.kde.klipper /klipper setClipboardContents "$STDIN" $ cat /usr/local/bin/v #!/bin/sh qdbus org.kde.klipper /klipper getClipboardContents This is what I like to use :)
[–] kurumin@linux.community 2 points 2 years ago (1 child) I didn't get it. What does it do? permalink fedilink source hideshow 2 child comments replies: [–] tunawasherepoo@iusearchlinux.fyi [S] 2 points 2 years ago* (1 child) It's two tools: c and v for copy and paste respectively. Say you want to copy an output of a command, say grep -i 'abc' file.txt | sed 's/b/d/' then you can easily add | c to the end to get: grep -i 'abc' file.txt | sed 's/b/d/' | c and this will copy to clipboard, specifically for KDE's clipboard manager, Klipper. If you wanted to see the help text for more ways to copy, you'd run c on its own The benefit is the tool won't break between x11 and wayland, but the downsides are that it's tied to klipper, and you cant see more clipboard metadata, like mimetypes If you only use wayland, i'd recommend using wl-clipboard, and alias c=wl-copy and alias v=wl-paste it's a better tool, imo. Should you still want to use my lil snippet, you will need to create these files yourself, i suggest either in your $HOME/.local/bin/ or /usr/local/bin/. And don't forget to chmod +x them so they are executable. Happy experimenting :) permalink fedilink source parent hideshow 2 child comments replies: [–] kurumin@linux.community 2 points 2 years ago (1 child) Thank you so much! You are so kind! permalink fedilink source parent hideshow 2 child comments replies: [–] tunawasherepoo@iusearchlinux.fyi [S] 2 points 2 years ago Aw thanks! I'm glad I was able to help :) permalink fedilink source parent
[–] tunawasherepoo@iusearchlinux.fyi [S] 2 points 2 years ago* (1 child) It's two tools: c and v for copy and paste respectively. Say you want to copy an output of a command, say grep -i 'abc' file.txt | sed 's/b/d/' then you can easily add | c to the end to get: grep -i 'abc' file.txt | sed 's/b/d/' | c and this will copy to clipboard, specifically for KDE's clipboard manager, Klipper. If you wanted to see the help text for more ways to copy, you'd run c on its own The benefit is the tool won't break between x11 and wayland, but the downsides are that it's tied to klipper, and you cant see more clipboard metadata, like mimetypes If you only use wayland, i'd recommend using wl-clipboard, and alias c=wl-copy and alias v=wl-paste it's a better tool, imo. Should you still want to use my lil snippet, you will need to create these files yourself, i suggest either in your $HOME/.local/bin/ or /usr/local/bin/. And don't forget to chmod +x them so they are executable. Happy experimenting :) permalink fedilink source parent hideshow 2 child comments replies: [–] kurumin@linux.community 2 points 2 years ago (1 child) Thank you so much! You are so kind! permalink fedilink source parent hideshow 2 child comments replies: [–] tunawasherepoo@iusearchlinux.fyi [S] 2 points 2 years ago Aw thanks! I'm glad I was able to help :) permalink fedilink source parent
[–] kurumin@linux.community 2 points 2 years ago (1 child) Thank you so much! You are so kind! permalink fedilink source parent hideshow 2 child comments replies: [–] tunawasherepoo@iusearchlinux.fyi [S] 2 points 2 years ago Aw thanks! I'm glad I was able to help :) permalink fedilink source parent
[–] tunawasherepoo@iusearchlinux.fyi [S] 2 points 2 years ago Aw thanks! I'm glad I was able to help :) permalink fedilink source parent