Start re-organising my dotfiles

This commit is contained in:
Jonathan Hodgson 2018-04-16 23:03:29 +01:00
parent 4141702986
commit 8954b21d7f
101 changed files with 40 additions and 3228 deletions

3
rofi/config Normal file
View file

@ -0,0 +1,3 @@
rofi.theme: /usr/share/rofi/themes/solarized_alternate.rasi
rofi.font: Noto\ 16
rofi.show-icons: True

106
rofi/scripts/rofi-emoji Executable file
View file

@ -0,0 +1,106 @@
#!/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.
UNICODE_FILE="/home/jonathan/.dotfiles/config/rofi/scripts/unicode.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 notify() {
if [ "$(command -v notify-send)" ]; then
notify-send "$1" "$2"
fi
}
function download() {
echo "Disabled the download"
#notify `basename "$0"` 'Downloading all emoji for your pleasure'
#echo "" > "$UNICODE_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" >> "$UNICODE_FILE"
#done
#notify `basename "$0"` "We're all set!"
}
function display() {
emoji=$(cat "$UNICODE_FILE" | grep -v '^[[:space:]]*$')
line=$(echo "$emoji" | rofi -dmenu -i -p Unicode -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]}" | /usr/bin/xclip -i -selection clipboard
fi
}
# Some simple argparsing
if [[ "$1" =~ -D|--download ]]; then
download
exit 0
elif [[ "$1" =~ -h|--help ]]; then
echo "usage: $0 [-D|--download]"
exit 0
fi
# Download all emoji if they don't exist yet
if [ ! -f "$UNICODE_FILE" ]; then
download
fi
# display displays :)
display

28
rofi/scripts/rofi-shutdown Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/sh
selection=$( \
echo -e "Lock\nLogout\nSuspend\nHibernate\nReboot\nShutdown" |\
rofi -dmenu -i -p 'Option');
echo $selection;
sleep .2
case $selection in
Lock)
~/.config/i3/i3exit lock
;;
Logout)
~/.config/i3/i3exit logout
;;
Suspend)
~/.config/i3/i3exit suspend
;;
Hibernate)
~/.config/i3/i3exit hibernate
;;
Reboot)
~/.config/i3/i3exit reboot
;;
Shutdown)
~/.config/i3/i3exit shutdown
;;
esac

121333
rofi/scripts/unicode.txt Normal file

File diff suppressed because it is too large Load diff