Skip to content

Instantly share code, notes, and snippets.

@pineapples5972
Created August 20, 2021 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pineapples5972/38d877ac8fb2678e4f1db4e02caee5c9 to your computer and use it in GitHub Desktop.
Save pineapples5972/38d877ac8fb2678e4f1db4e02caee5c9 to your computer and use it in GitHub Desktop.
# DIY clipboard manager
This was the part of larbs but i never able to get it working until now.
**Using xclip, xdotool and dmenu to fetch clipboard contents**
*Dependancies:
- xdotool
- xclip
- dmenu
- sxhkd (optional and depends on how you manage keybinds)
`xclip -sel c -o` will put selected clipboard content into file
using dmenu later we will get the list of copied texts
but this file need to updated everytime we copied something.
So we can either cron job it or use a trigger recognizing program like entr.
So i choose to create aliases instead
```
alias \
cc="{xclip -sel c -o -r; printf '\n'; } >> ~/.local/share/larbs/snippets" \
cr=" : > ~/.local/share/larbs/snippets"
```
`cc` will update the clipboard and `cr` will clear all the file
and this sxhkd hotkey will be use to get the list of content.
```
super + Insert
xdotool type "$(dmenu -i -l 50 < ~/.local/share/clipboard/snippets)"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment