Adding scripts

This commit is contained in:
Dorian Wood 2021-03-31 07:33:37 -04:00
parent 4c15f13f14
commit ea846a9f35
4 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,3 @@
#! /bin/bash
linkhandler $(xclip -o -selection clip)

View File

@ -0,0 +1,27 @@
#!/bin/sh
# Feed script a url or file location.
# If an image, it will view in sxiv,
# if a video or gif, it will view in mpv
# if a music file or pdf, it will download,
# otherwise it opens link in browser.
# If no url given. Opens browser. For using script as $BROWSER.
[ -z "$1" ] && { "$BROWSER"; exit; }
case "$1" in
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*invidio.us*|*invidious.snopyta.org*|*invidiou.site*)
setsid -f mpv --ytdl --ytdl-format="bestvideo[height<=720]+bestaudio" -quiet "$1" >/dev/null 2>&1 ;;
*png|*jpg|*jpe|*jpeg|*gif)
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
*mp3|*flac|*opus|*mp3?source*)
setsid -f tsp curl -LO "$1" >/dev/null 2>&1 ;;
magnet:*|*.torrent)
transadd $1;;
https://drive.google.com*)
id=$(tsp wget --no-check-certificate -r "https://docs.google.com/uc?export=download&id=$( $1 | sed 's/.*=//')" -O gurglefile);
tsp -D $id notify-send "👍 $id done" ;;
*)
if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR" "$1"
else setsid -f "$BROWSER" "$1" >/dev/null 2>&1; fi ;;
esac

View File

@ -0,0 +1,11 @@
#!/bin/sh
# This script is called on startup to remap keys.
# Increase key speed via a rate change
xset r rate 300 50
# Map the caps lock key to super...
setxkbmap -option caps:super
# But when it is pressed only once, treat it as escape.
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
# Map the menu button to right super as well.
xmodmap -e 'keycode 135 = Super_R'

View File

@ -0,0 +1,33 @@
#!/bin/bash
# A simple shell script to make self reflection prompts easier.
declare -a PROMPTS
while getopts "i:o:" opt; do
case $opt in
i)
INPUT=$OPTARG;;
o)
OUTPUT=$OPTARG;;
esac
done
while read -r line; do
PROMPTS+=("$line")
done < $INPUT
[ ! -e $INPUT ] && echo "Invalid Input File" && exit 1
# If today's diary doesn't exist yet, it needs the standard date headeer
[ -e $OUTPUT ] || printf "%s \n" "# $(date +%F)" >> $OUTPUT
printf "%s \n" " " >> $OUTPUT
printf "%s \n" "## ${INPUT##*/}" "Entry Time: $(date +%R)" >> $OUTPUT
for p in "${PROMPTS[@]}"
do
read -p "$p " a
printf "%s %s\n" "$p $a" >> $OUTPUT
done