Skip to content

Instantly share code, notes, and snippets.

@xywei
Last active January 12, 2019 16:16
Show Gist options
  • Save xywei/1e2c8a2fa6f17ba3f61b2e0d9f17bb7a to your computer and use it in GitHub Desktop.
Save xywei/1e2c8a2fa6f17ba3f61b2e0d9f17bb7a to your computer and use it in GitHub Desktop.
rofiunicode
#!/bin/sh
# Give dmenu list of all unicode characters to copy.
# Shows the selected character in dunst if running.
# Must have xclip installed to even show menu.
xclip -h >/dev/null || exit
chosen=$(grep -v "#" ~/.emoji | rofi -dmenu \
-location 1 -width 100 \
-lines 2 -line-margin 0 -line-padding 1 \
-separator-style none -font "Monospace 18" -columns 9 -bw 0 \
-disable-history \
-hide-scrollbar \
-color-window "#222222, #222222, #b1b4b3" \
-color-normal "#222222, #b1b4b3, #222222, #005577, #b1b4b3" \
-color-active "#222222, #b1b4b3, #222222, #007763, #b1b4b3" \
-color-urgent "#222222, #b1b4b3, #222222, #77003d, #b1b4b3" \
-kb-row-select "Tab" -kb-row-tab "" \
-i)
[ "$chosen" != "" ] || exit
c=$(echo "$chosen" | sed "s/ .*//")
echo "$c" | tr -d '\n' | xclip -selection clipboard
notify-send "'$c' copied to clipboard." &
s=$(echo "$chosen" | sed "s/.*; //" | awk '{print $1}')
echo "$s" | tr -d '\n' | xclip
notify-send "'$s' copied to primary." &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment