Comments (15)
@shvedes if you're using the master version of cliphist (where the separator is tab character instead of dot)
then you could try ask rofi to hide it for you
cliphist list | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy
this has the benefit of also working for binary data and stuff with unusual white space
from cliphist.
added "faq" section here https://github.com/sentriz/cliphist#faq
from cliphist.
howdy. unfortunately it's not possible, since the numbers are IDs that reference rows in the cliphist database, which hold the input byte for byte
if you were to take the stdout of your dmenu (eventually piped into wl-copy) literally, you would miss out on newline data, tab characters, images, etc
at least for me these nuances in the text are really important for editing in vim etc
from cliphist.
Personally, I don't quite understand the purpose or benefit of seeing the ids next to the copied test. I would just like to see the copied test. Would it be possible to add an option that prints the copied items without the ids? Thanks for the awesome program!
Hello. This is a small script that cuts the ID before the copied text and outputs the entire list in rofi. I hope it helps you.
#!/usr/bin/env bash
cliphist_list=$(cliphist list)
cliphist_array=()
while read -r line; do
cliphist_array+=("${line#*[[:blank:]]}")
done <<< "$cliphist_list"
rofi_options=$(printf "%s\n" "${cliphist_array[@]}")
# Change rofi path to yours
chosen=$(echo -e "${rofi_options}" | rofi -dmenu -i -p "Clipboard:" -theme "$HOME"/.config/rofi/launchers/clipboard/launcher.rasi)
echo "$chosen" | tr -d '\n' | wl-copy
from cliphist.
What @sentriz said works well, but for me it prints an empty first column, so there is a bunch of unnecessary whitespace on the left. What I prefer is this:
cliphist list | cut -f 2- | rofi -dmenu | wl-copy
cut
automatically uses TAB
as a delimiter, and the -f 2-
guarantees that it will keep all fields (i.e. fields seperated by tabs) except the first one. This includes an edge case where your copied text contains tabs itself, and then only selecting the second column would not select everything. Hope this helps someone.
from cliphist.
However, the problem I get with mine is that leading whitespace also gets deleted, because it is counted as part of the first tab.
from cliphist.
@fritzrehde that works, but if you skip the "cliphist decode" then all whitespace will be not be preserved. that's why cliphist needs the ID
(also forgot that in my example, updated)
and you're right about rofi printing the extra whitespace seems like a bug in rofi?
$ printf "1\t%s\n" one two three | rofi -dmenu -display-columns 2
$ printf "1\t%s\n" one two three | fzf -d $'\t' --with-nth 2
20230412_172327.mp4
from cliphist.
added a bug/question to rofi about that here:
davatorium/rofi#1834
from cliphist.
now it's it's fixed with the master version of rofi after davatorium/rofi#1834
so you should be able to do cliphist list | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy
and this will make sure all whitespace from your original selection and images etc are preserved since the "decode" command is used
from cliphist.
Cool, that's very helpful. Thanks!
from cliphist.
Can you add fuzzel command too ?
from cliphist.
PRs are welcome
from cliphist.
PRs are welcome
I meant I donno how to parse the content in fuzzel. If you now how to, help us filter the number out in fuzzel & I'll try to PR.
from cliphist.
from cliphist.
Strange. I will file a ticket then.
https://codeberg.org/dnkl/fuzzel/issues/288
from cliphist.
Related Issues (20)
- Copying images doesn't seem to work HOT 2
- cliphist-rofi-img fails to display images HOT 4
- [SUGGESTION] - Release chiphist in openSUSE Build Service HOT 1
- Multi-line content HOT 1
- Add vendor directory HOT 3
- How to quit picker without clearing clipboard ? HOT 4
- Possible to use with xclip ? HOT 6
- won't preserve clipboard after copy source is closed HOT 4
- How to play notification sound for succesfull copy? HOT 1
- reset numbers HOT 1
- Implement secret clipboard entry conventions HOT 4
- Copying Image from browser comes with HTML and Image HOT 1
- Fzf now support sixel HOT 5
- Items in clipboard history don't properly copy HOT 9
- Image files not copying/decoding correctly HOT 1
- Clear Database on shutdown / configurable path to db HOT 9
- How to configure cliphist to save in history the selected text with mouse? HOT 1
- Missing version tag HOT 2
- Sync with KDE Connect? HOT 3
- How do I delete the last four items? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cliphist.