1
0
forked from extern/nix-config

sxhkd: Add clipboard to browser

This makes it easy to search for text without having to worry about
browser extensions or even being in the browser itself.
This commit is contained in:
Donovan Glover 2022-07-30 10:19:59 -04:00
parent 5a3b02add8
commit bd83212581
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
2 changed files with 40 additions and 1 deletions

27
sxhkd/.config/sxhkd/ctb.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
# Clipboard to browser
CLIPBOARD="$(xclip -o)"
OPEN="/usr/bin/$BROWSER"
URL=""
if [[ "$1" == "jisho" ]]; then
URL="https://jisho.org/search/$CLIPBOARD"
elif [[ "$1" == "weblio" ]]; then
URL="https://ejje.weblio.jp/content/$CLIPBOARD"
elif [[ "$1" == "forvo" ]]; then
# URL="https://forvo.com/search/$CLIPBOARD"
URL="https://forvo.com/word/$CLIPBOARD/#ja"
elif [[ "$1" == "deepl" ]]; then
URL="https://www.deepl.com/translator#ja/en/$CLIPBOARD"
elif [[ "$1" == "cambridge" ]]; then
URL="https://dictionary.cambridge.org/dictionary/english/$CLIPBOARD"
fi
if [[ "$URL" != "" ]]; then
"$OPEN" "$URL"
fi

View File

@ -128,6 +128,18 @@ super + F11
notify-send -t 2000 "F11" "No command defined." notify-send -t 2000 "F11" "No command defined."
super + F12 super + F12
notify-send -t 2000 "F12" "No command defined." ~/.config/sxhkd/ctb.sh jisho
super + Home
~/.config/sxhkd/ctb.sh forvo
super + End
~/.config/sxhkd/ctb.sh weblio
super + Insert
~/.config/sxhkd/ctb.sh deepl
super + Delete
~/.config/sxhkd/ctb.sh cambridge
# vim:ft=sxhkdrc # vim:ft=sxhkdrc