mirror of
https://github.com/frebib/dotfiles.git
synced 2024-06-14 12:57:23 +00:00
i3/config: add rofi-emoji and rofi-pass keybinds
This commit is contained in:
parent
8ab712c37e
commit
b013a98e0d
@ -5,7 +5,7 @@
|
|||||||
<test name="family">
|
<test name="family">
|
||||||
<string>sans-serif</string>
|
<string>sans-serif</string>
|
||||||
</test>
|
</test>
|
||||||
<edit name="family" mode="prepend" binding="strong">
|
<edit name="family" mode="prepend" binding="weak">
|
||||||
<string>Noto Sans</string>
|
<string>Noto Sans</string>
|
||||||
<string>Noto Color Emoji</string>
|
<string>Noto Color Emoji</string>
|
||||||
</edit>
|
</edit>
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<test name="family">
|
<test name="family">
|
||||||
<string>serif</string>
|
<string>serif</string>
|
||||||
</test>
|
</test>
|
||||||
<edit name="family" mode="prepend" binding="strong">
|
<edit name="family" mode="prepend" binding="weak">
|
||||||
<string>Noto Serif</string>
|
<string>Noto Serif</string>
|
||||||
<string>Noto Color Emoji</string>
|
<string>Noto Color Emoji</string>
|
||||||
</edit>
|
</edit>
|
||||||
@ -23,7 +23,7 @@
|
|||||||
<test name="family">
|
<test name="family">
|
||||||
<string>monospace</string>
|
<string>monospace</string>
|
||||||
</test>
|
</test>
|
||||||
<edit name="family" mode="prepend" binding="strong">
|
<edit name="family" mode="prepend" binding="weak">
|
||||||
<string>Sauce Code Pro</string>
|
<string>Sauce Code Pro</string>
|
||||||
<string>Noto Color Emoji</string>
|
<string>Noto Color Emoji</string>
|
||||||
</edit>
|
</edit>
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<test name="family">
|
<test name="family">
|
||||||
<string>Apple Color Emoji</string>
|
<string>Apple Color Emoji</string>
|
||||||
</test>
|
</test>
|
||||||
<edit name="family" mode="prepend" binding="strong">
|
<edit name="family" mode="prepend" binding="weak">
|
||||||
<string>Noto Color Emoji</string>
|
<string>Noto Color Emoji</string>
|
||||||
</edit>
|
</edit>
|
||||||
</match>
|
</match>
|
||||||
|
@ -151,7 +151,7 @@ focus_follows_mouse yes
|
|||||||
|
|
||||||
# keybindings
|
# keybindings
|
||||||
bindsym $mod+Shift+j reload
|
bindsym $mod+Shift+j reload
|
||||||
bindsym $mod+Shift+p restart
|
#bindsym $mod+Shift+p restart
|
||||||
bindsym $mod+c exec chromium
|
bindsym $mod+c exec chromium
|
||||||
bindsym $mod+v exec "i3-sensible-terminal -e \\"$SHELL -c vim;$SHELL\\"
|
bindsym $mod+v exec "i3-sensible-terminal -e \\"$SHELL -c vim;$SHELL\\"
|
||||||
bindsym $mod+Ctrl+v exec "i3-sensible-terminal -r floating-term -e \\"$SHELL -c vim;$SHELL\\"
|
bindsym $mod+Ctrl+v exec "i3-sensible-terminal -r floating-term -e \\"$SHELL -c vim;$SHELL\\"
|
||||||
@ -163,6 +163,8 @@ bindsym $mod+Ctrl+Shift+Return exec i3-sensible-terminal -r floating-term --ge
|
|||||||
bindsym $mod+l exec ~/.config/i3/lock.sh
|
bindsym $mod+l exec ~/.config/i3/lock.sh
|
||||||
# -fg "#CCD3DAE3" -bg "#CC383C4A" -hlbg "#CC5294E2"
|
# -fg "#CCD3DAE3" -bg "#CC383C4A" -hlbg "#CC5294E2"
|
||||||
bindsym $mod+space exec "pkill rofi; rofi -show run -sidebar-mode -terminal i3-sensible-terminal -normal-window"
|
bindsym $mod+space exec "pkill rofi; rofi -show run -sidebar-mode -terminal i3-sensible-terminal -normal-window"
|
||||||
|
bindsym $mod+Shift+p exec rofi-pass
|
||||||
|
bindsym $mod+Shift+e exec rofi-emoji
|
||||||
bindsym --release Print exec imgur-screenshot
|
bindsym --release Print exec imgur-screenshot
|
||||||
bindsym --release $mod+Print exec imgur-screenshot -f
|
bindsym --release $mod+Print exec imgur-screenshot -f
|
||||||
bindsym $mod+Mod1+space exec --no-startup-id ~/.config/i3/cycleaudio.py && pkill -RTMIN+10 i3blocks
|
bindsym $mod+Mod1+space exec --no-startup-id ~/.config/i3/cycleaudio.py && pkill -RTMIN+10 i3blocks
|
||||||
|
86
scripts/rofi-emoji
Executable file
86
scripts/rofi-emoji
Executable file
@ -0,0 +1,86 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Use rofi to pick emoji because that's what this
|
||||||
|
# century is about apparently...
|
||||||
|
#
|
||||||
|
# Requirements:
|
||||||
|
# rofi, xsel, xdotool, curl, xmllint
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# 1. Download all emoji
|
||||||
|
# $ rofi-emoji --download
|
||||||
|
#
|
||||||
|
# 2. Run it!
|
||||||
|
# $ rofi-emoji
|
||||||
|
#
|
||||||
|
# Notes:
|
||||||
|
# * You'll need a emoji font like "Noto Emoji" or "EmojiOne".
|
||||||
|
# * Confirming an item will automatically paste it WITHOUT
|
||||||
|
# writing it to your clipboard.
|
||||||
|
# * Ctrl+C will copy it to your clipboard WITHOUT pasting it.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Where to save the emojis file.
|
||||||
|
EMOJI_FILE="$HOME/.cache/emojis.txt"
|
||||||
|
|
||||||
|
# Urls of emoji to download.
|
||||||
|
# You can remove what you don't need.
|
||||||
|
URLS=(
|
||||||
|
'https://emojipedia.org/people/'
|
||||||
|
'https://emojipedia.org/nature/'
|
||||||
|
'https://emojipedia.org/food-drink/'
|
||||||
|
'https://emojipedia.org/activity/'
|
||||||
|
'https://emojipedia.org/travel-places/'
|
||||||
|
'https://emojipedia.org/objects/'
|
||||||
|
'https://emojipedia.org/symbols/'
|
||||||
|
'https://emojipedia.org/flags/'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
function download() {
|
||||||
|
echo "" > "$EMOJI_FILE"
|
||||||
|
|
||||||
|
for url in "${URLS[@]}"; do
|
||||||
|
echo "Downloading: $url"
|
||||||
|
|
||||||
|
# Download the list of emoji and remove all the junk around it
|
||||||
|
emojis=$(curl -s "$url" | \
|
||||||
|
xmllint --html \
|
||||||
|
--xpath '//ul[@class="emoji-list"]' - 2>/dev/null)
|
||||||
|
|
||||||
|
# Get rid of starting/closing ul tags
|
||||||
|
emojis=$(echo "$emojis" | head -n -1 | tail -n +1)
|
||||||
|
|
||||||
|
# Extract the emoji and its description
|
||||||
|
emojis=$(echo "$emojis" | \
|
||||||
|
sed -rn 's/.*<span class="emoji">(.*)<\/span> (.*)<\/a><\/li>/\1 \2/p')
|
||||||
|
|
||||||
|
echo "$emojis" >> "$EMOJI_FILE"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function display() {
|
||||||
|
emoji=$(cat "$EMOJI_FILE" | grep -v '#' | grep -v '^[[:space:]]*$')
|
||||||
|
line=$(echo "$emoji" | rofi -dmenu -i -p emoji -kb-custom-1 Ctrl+c $@)
|
||||||
|
exit_code=$?
|
||||||
|
|
||||||
|
line=($line)
|
||||||
|
|
||||||
|
if [ $exit_code == 0 ]; then
|
||||||
|
xdotool type --clearmodifiers "${line[0]}"
|
||||||
|
elif [ $exit_code == 10 ]; then
|
||||||
|
echo -n "${line[0]}" | xsel -i -b
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if [[ "$1" =~ -D|--download ]]; then
|
||||||
|
download
|
||||||
|
exit 0
|
||||||
|
elif [[ "$1" =~ -h|--help ]]; then
|
||||||
|
echo "usage: $0 [-D|--download]"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
display
|
Loading…
Reference in New Issue
Block a user