parent
265a3ad84e
commit
8ced2f42f5
47 changed files with 254 additions and 245 deletions
@ -0,0 +1,5 @@ |
|||||||
|
# Dmenu Scripts |
||||||
|
|
||||||
|
Most of these scripts should work with dmenu although I have a dmenu symlinked to [rofi](https://github.com/davatorium/rofi) because I haven't yet got around to switching and testing these scripts with proper dmenu. |
||||||
|
|
||||||
|
|
@ -0,0 +1 @@ |
|||||||
|
/usr/bin/rofi |
unable to load file from base commit
|
unable to load file from base commit
|
@ -0,0 +1,52 @@ |
|||||||
|
#!/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="$(dirname "$0")/unicode.txt" |
||||||
|
|
||||||
|
|
||||||
|
function notify() { |
||||||
|
if [ "$(command -v notify-send)" ]; then |
||||||
|
notify-send "$1" "$2" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
function display() { |
||||||
|
emoji=$(cat "$UNICODE_FILE" | grep -v '^[[:space:]]*$') |
||||||
|
line=$(echo "$emoji" | 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 |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# display displays :) |
||||||
|
display |
@ -0,0 +1,3 @@ |
|||||||
|
#!/usr/bin/env bash |
||||||
|
|
||||||
|
notify-send "$(date '+%T')" "$(date '+%A %d %Y')" |
@ -0,0 +1,29 @@ |
|||||||
|
#!/usr/bin/env bash |
||||||
|
|
||||||
|
after=0 |
||||||
|
before=0 |
||||||
|
search='' |
||||||
|
if [ $# == 0 ]; then |
||||||
|
echo "Usage: $0 [-A <after>] [-B <before>] query" |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
while [ $# != 0 ]; do |
||||||
|
case "$1" in |
||||||
|
-A) |
||||||
|
after="$2" |
||||||
|
shift |
||||||
|
shift |
||||||
|
;; |
||||||
|
-B) |
||||||
|
before="$2" |
||||||
|
shift |
||||||
|
shift |
||||||
|
;; |
||||||
|
*) |
||||||
|
search="$search $1" |
||||||
|
shift |
||||||
|
;; |
||||||
|
esac |
||||||
|
done |
||||||
|
|
||||||
|
grep -r -i -n --color="always" --include=\*.{css,less,scss,sass} --exclude=\*.min.css -A "$after" -B "$before" "$search" . |
@ -0,0 +1,29 @@ |
|||||||
|
#!/usr/bin/env bash |
||||||
|
|
||||||
|
after=0 |
||||||
|
before=0 |
||||||
|
search='' |
||||||
|
if [ $# == 0 ]; then |
||||||
|
echo "Usage: $0 [-A <after>] [-B <before>] query" |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
while [ $# != 0 ]; do |
||||||
|
case "$1" in |
||||||
|
-A) |
||||||
|
after="$2" |
||||||
|
shift |
||||||
|
shift |
||||||
|
;; |
||||||
|
-B) |
||||||
|
before="$2" |
||||||
|
shift |
||||||
|
shift |
||||||
|
;; |
||||||
|
*) |
||||||
|
search="$search $1" |
||||||
|
shift |
||||||
|
;; |
||||||
|
esac |
||||||
|
done |
||||||
|
|
||||||
|
grep -r -i -n --color="always" --include=\*.{html,htm} -A "$after" -B "$before" "$search" . |
@ -0,0 +1,29 @@ |
|||||||
|
#!/usr/bin/env bash |
||||||
|
|
||||||
|
after=0 |
||||||
|
before=0 |
||||||
|
search='' |
||||||
|
if [ $# == 0 ]; then |
||||||
|
echo "Usage: $0 [-A <after>] [-B <before>] query" |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
while [ $# != 0 ]; do |
||||||
|
case "$1" in |
||||||
|
-A) |
||||||
|
after="$2" |
||||||
|
shift |
||||||
|
shift |
||||||
|
;; |
||||||
|
-B) |
||||||
|
before="$2" |
||||||
|
shift |
||||||
|
shift |
||||||
|
;; |
||||||
|
*) |
||||||
|
search="$search $1" |
||||||
|
shift |
||||||
|
;; |
||||||
|
esac |
||||||
|
done |
||||||
|
|
||||||
|
grep -r -i -n --color="always" --include=\*.{js,es6} --exclude=\*.min.js -A "$after" -B "$before" "$search" . |
@ -0,0 +1,29 @@ |
|||||||
|
#!/usr/bin/env bash |
||||||
|
|
||||||
|
after=0 |
||||||
|
before=0 |
||||||
|
search='' |
||||||
|
if [ $# == 0 ]; then |
||||||
|
echo "Usage: $0 [-A <after>] [-B <before>] query" |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
while [ $# != 0 ]; do |
||||||
|
case "$1" in |
||||||
|
-A) |
||||||
|
after="$2" |
||||||
|
shift |
||||||
|
shift |
||||||
|
;; |
||||||
|
-B) |
||||||
|
before="$2" |
||||||
|
shift |
||||||
|
shift |
||||||
|
;; |
||||||
|
*) |
||||||
|
search="$search $1" |
||||||
|
shift |
||||||
|
;; |
||||||
|
esac |
||||||
|
done |
||||||
|
|
||||||
|
grep -r -i -n --color="always" --include=\*.{php,phtml} -A "$after" -B "$before" "$search" . |
@ -0,0 +1,3 @@ |
|||||||
|
#!/usr/bin/env bash |
||||||
|
|
||||||
|
/usr/bin/whoami > /tmp/testing |
@ -0,0 +1,52 @@ |
|||||||
|
#!/usr/bin/env zsh |
||||||
|
|
||||||
|
# Small script that echos the path of a wordpress theme |
||||||
|
# |
||||||
|
# By default it will echo the path of the active theme. If an argument is given, it will grep the list of themes with the argment and return the path for the first |
||||||
|
# |
||||||
|
# It assumes that the wordpress is in a folder called public_html or public_html/wp. It should be run from inside this directory |
||||||
|
# |
||||||
|
# It can also be run inside a wiki directory if public_html is a sibling of wiki |
||||||
|
# |
||||||
|
# @author jab2870 |
||||||
|
# @requires wp |
||||||
|
|
||||||
|
# Gets the public html folder from any sub folder or the wiki folder |
||||||
|
public_html="${${PWD%/public_html*}%/wiki*}/public_html" |
||||||
|
# Checks the public_html directory exists |
||||||
|
if [ -d $public_html ]; then |
||||||
|
|
||||||
|
# Checks to see if wp is in a subdirectory called wp |
||||||
|
if [ -d $public_html/wp ]; then |
||||||
|
wpPath=$public_html/wp; |
||||||
|
else |
||||||
|
wpPath=$public_html; |
||||||
|
fi |
||||||
|
|
||||||
|
# This assumes the domain for the site. It should be changed according to your setup |
||||||
|
# It assumes here that the domain is the same as public_html folder with .local.jh appended |
||||||
|
# This is needed if using a multisite setup |
||||||
|
domain="$(basename $(dirname $public_html ) ).local.jh" |
||||||
|
|
||||||
|
# If we have an argument |
||||||
|
if [ ! -z "$1" ]; then |
||||||
|
# Try and find the theme containing the argument and return it's path |
||||||
|
theme=$(dirname $(wp --path="$wpPath" --url="$domain" theme path $(wp --path="$wpPath" --url="$domain" theme list 2> /dev/null | grep "$1" | head -n 1 | awk '{print $1}') 2> /dev/null )) |
||||||
|
else |
||||||
|
# Otherwise, get the active plugin |
||||||
|
theme=$(dirname $(wp --path="$wpPath" --url="$domain" theme path $(wp --path="$wpPath" --url="$domain" theme list 2> /dev/null | grep "active" | grep -v "inactive" | awk '{print $1}') 2> /dev/null )) |
||||||
|
fi |
||||||
|
|
||||||
|
# If we have an answer |
||||||
|
if [ -d $theme ]; then |
||||||
|
# Echo it |
||||||
|
echo $theme |
||||||
|
else |
||||||
|
# Otherwise we can fail |
||||||
|
>&2 echo "cannot find theme" |
||||||
|
exit 2 |
||||||
|
fi |
||||||
|
else |
||||||
|
>&2 echo "Cannot find public_html" |
||||||
|
exit 1 |
||||||
|
fi |
@ -1 +1 @@ |
|||||||
Subproject commit bdc4d25b7af384533e17fb47c2acceb7126dfd34 |
Subproject commit e3594813917e8b8a162c701162432c9ee24a3551 |
@ -1,106 +0,0 @@ |
|||||||
#!/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/.dotfiles/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 |
|
@ -1 +1 @@ |
|||||||
Subproject commit 6fc7e108bfbb023fa028db299ec8e4b28e2fbcab |
Subproject commit 16d377b884fc88a352d7ed04be36c4a000f4e8f0 |
Loading…
Reference in new issue