diff options
author | Tim Keller <tjkeller.xyz> | 2024-11-17 23:34:54 -0600 |
---|---|---|
committer | Tim Keller <tjkeller.xyz> | 2024-11-17 23:34:54 -0600 |
commit | 09ada24d4ec23cf24ab136141b354953d1bbc2fa (patch) | |
tree | 2c41e87c71ad3f3cd67a8bea0c1413efbab4087d /launch | |
parent | 090a3a31683eb08b91351e4d1508a0a73a310a38 (diff) | |
download | scripts-09ada24d4ec23cf24ab136141b354953d1bbc2fa.tar.xz scripts-09ada24d4ec23cf24ab136141b354953d1bbc2fa.zip |
reorganize scripts
Diffstat (limited to 'launch')
-rwxr-xr-x | launch/dmenu_runapp | 4 | ||||
-rwxr-xr-x | launch/emu | 57 | ||||
-rwxr-xr-x | launch/launch | 110 | ||||
-rwxr-xr-x | launch/music | 28 | ||||
-rwxr-xr-x | launch/shows | 26 |
5 files changed, 0 insertions, 225 deletions
diff --git a/launch/dmenu_runapp b/launch/dmenu_runapp deleted file mode 100755 index 4d7a45e..0000000 --- a/launch/dmenu_runapp +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -apps="$(echo ${XDG_DATA_DIRS:-/usr/share}: | sed 's/:/\/applications\/*.desktop /g')" -name="$(grep -Rhm1 '^Name=' $apps 2>/dev/null | cut -d'=' -f2- | sort | uniq | dmenu "$@")" -[ -n "$name" ] && gtk-launch $(basename `grep -Rlm1 "^Name=$name$" $apps 2>/dev/null`) & diff --git a/launch/emu b/launch/emu deleted file mode 100755 index 87c0e2a..0000000 --- a/launch/emu +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# This only works for collections with a common extension. You can rename all your roms to use the same extension and (in any decent emulator at least) they should work regardless of the actual header type -gamedir=${XDG_DATA_HOME:-$HOME/.local/share}/games -dmenuprompt="dmenu -l 25" -resolution() { cat /sys/class/drm/*/modes | head -1; } -case "$1" in - 2600) - #dmenucolors="-nb #111 -nf #e4963c -sb #6c3b17 -sf #fff -nhb #121212 -nhf #fc5231 -shb #804f2d -shf #fc5231" - dmenucolors="-nb #111 -nf #e4963c -sb #6c3b17 -sf #fff" - emulator="stella" - ext=bin - ;; - 3ds) - #dmenucolors="-nb #111 -nf #888 -sb #999 -sf #F00 -nhb #111 -nhf #fff -shb #999" - dmenucolors="-nb #111 -nf #888 -sb #999 -sf #F00" - emulator="citra" - ext=3ds - ;; - nes) - #dmenucolors="-nb #6d6a6d -nf #fff -sb #dfdcdd -sf #c1121c -nhb #222 -nhf #dc444d -shb #a29fa3 -shf #dc444d" - dmenucolors="-nb #6d6a6d -nf #fff -sb #dfdcdd -sf #c1121c" - emulator="fceux" - ext=nes - ;; - snes) - #dmenucolors="-nb #b2b4b2 -nf #000 -sb #514689 -sf #fff -nhb #707372 -nhf #fff -shb #a7a4e0 -shf #000" - dmenucolors="-nb #b2b4b2 -nf #000 -sb #514689 -sf #fff" - emulator="launch snes" - ext=sfc - ;; - n64) - #dmenucolors="-nb #223 -nf #fff -sb #069330 -sf #fff -nhb #c20d02 -nhf #ffc001 -shb #011da9 -shf #ffc001" - dmenucolors="-nb #223 -nf #fff -sb #069330 -sf #fff" - emulator="mupen64plus --fullscreen --gfx mupen64plus-video-glide64mk2 --resolution $(resolution)" - ext=z64 - ;; - gcn) - #dmenucolors="-nb #4d3b7c -nf #ddd -sb #000 -sf #fff -nhb #4d3b7c -nhf #eba982 -shb #000 -shf #eba982" - dmenucolors="-nb #4d3b7c -nf #ddd -sb #000 -sf #fff" - emulator="dolphin-emu -b" - ext=iso - ;; - nds) - #dmenucolors="-nb #ccc -nf #000 -sb #52398d -sf #fff -nhb #888 -nhf #fff -shb #52398d" - dmenucolors="-nb #ccc -nf #000 -sb #52398d -sf #fff" - emulator="desmume --3d-engine 2" - ext=nds - ;; - *) - console=`ls $gamedir | dmenu -l 25` && ($0 $console || $0) # Allows going back to select a different console - exit - ;; -esac - -gamedir="$gamedir/$1" && [ -e "$gamedir" ] \ - && selgame="`ls "$gamedir" | sed -n "s/\.$ext$//p" | $dmenuprompt $dmenucolors`.$ext" \ - && $emulator "$gamedir/$selgame" diff --git a/launch/launch b/launch/launch deleted file mode 100755 index 5947ae7..0000000 --- a/launch/launch +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/sh -awk=awk -me() { basename "$0"; } - -printhelp() { -cat << HELPDOC -Usage: - $(me): [-gh] [COMMAND] [COMMAND ARGS]... - -Args: - -g, --gen-cache : Force generate cache - -h, --help : show this help message - -Config Syntax: - +host [HOSTNAME] - Add a new host. Hosts can be referenced using their number starting with 1. - [COMMAND] - launch [COMMAND] will start the process specified for the specific hostname. Aliases are separated by |. - [TAB][SHELL] - Run this shell command when the above [COMMAND] is specified. In order of hostnames. Can be a number to reference to a hostname, a '-' to disregard this command for the specific host, or a '^' to reference the previous command. -HELPDOC -} - -# Make sure user is using GNU Awk (gawk) -checkawk() { - if ! ($awk -V >/dev/null 2>/dev/null && $awk -V | grep "GNU Awk" >/dev/null); then - if command -v gawk > /dev/null; then - awk=gawk - else - echo "$(me) requires GNU Awk (gawk) to function properly. Please install GNU Awk and try again." - exit 0 - fi - fi -} - -gencache() { -$awk ' -BEGIN { - print "run=\"$1\"; shift" - print "case \"$run\" in" -} -{ - sub(/#.*/, "") # Remove comments - if (!/^\s*$/) { - if (/^\+host/) { - sub(/\s*\+host\s*/, "") - h++ - hosts[h] = $0 - } - else { - if (!/^\t/) { - hostnum = 1 - o++ - opts[o] = $0 - } - else { - sub(/^\t/, "") - if ($0 == "^") - $0 = cache - else if ($0 ~ /^[0-9]*$/) - $0 = cmds[hosts[$0]":"opts[o]] - cmds[hosts[hostnum]":"opts[o]] = cache = $0 - hostnum++ - } - } - } -} -END { - for (host in hosts) { - if (hosts[host] != "'`hostname`'") - continue - for (cmd in cmds) { - if (cmd ~ hosts[host] && cmds[cmd] && cmds[cmd] != "-") { - i = cmd - sub(/.*:/, "", cmd) - print "\t"cmd") "cmds[i]" \"$@\" & ;;" - } - } - } - print "\t*) command -v \"$run\" >/dev/null && exec \"$run\" \"$@\" || echo \"\\`$run${@:+ $@}\\` Does not exist or exited with an error\" ;;" - print "esac" -} -' $conf > $cache -chmod +x $cache -} - -# Config file setup -confdir=${XDG_CONFIG_HOME:-~/.config}/launch -conf=$confdir/config -if [ ! -e $conf ]; then - mkdir -p $confdir - echo "#HOSTS\n+host $(hostname)\n\n#OPTS\ntest\n\techo \"Tested!\"" > $conf - echo "No config file exists! new config file created at $conf! Exiting\n" - printhelp - exit 1 -fi - -# Cache file setup -cachedir=${XDG_CACHE_HOME:-~/.cache}/launch -cache=$cachedir/cache -[ ! -e $cache ] && mkdir -p $cachedir && gencache -[ $conf -nt $cache ] && gencache - -# Command line options -checkawk -case "$1" in - -g|--gen-cache) echo "Generating new cache: $cache"; gencache && cat $cache ;; - -h|--help|'') printhelp ;; - *) exec $cache "$@" ;; # Run -esac diff --git a/launch/music b/launch/music deleted file mode 100755 index cb78257..0000000 --- a/launch/music +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -albumsdir=/media/4tbhdd/Music -dmenucolors="-l 25" - -playsong() { - list="`find $albumsdir -type f -name '*mka' | sort | sed 's/.*\/\(.*\) - \(.*\)\/[0-9]*: \(.*\).mka$/\3\t\1\t\2/' | awk -F '\t' '{ printf "%-120s %-60s %s\n", $1, $2, $3 }'`" - selection="`echo "$list" | dmenu $dmenucolors -p 'Song:'`" - selection="`echo "$selection" | sed 's/\(.*\) *\(.*\) *\(.*\)/\2 - \3\/[0-9]*: \1-/'`" - echo "$selection" -} - -playalbum() { - list="`find $albumsdir -type d -mindepth 1 -maxdepth 1 | sort`" -} - -playartist() { - list="`find $albumsdir -type d -mindepth 1 -maxdepth 1 | sed 's/ - .*//' | sort | uniq`" - artist= - list="`find $albumsdir -type d -name "$artist*" | sort`" -} - -playshuffle() { - list="`find $albumsdir -type f -name "*mka" | sort -R`" -} - -playsong -#play="`echo "$list" | grep "$selection"`" -#echo "$play" diff --git a/launch/shows b/launch/shows deleted file mode 100755 index a0cb8a6..0000000 --- a/launch/shows +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -showsdir=/media/4tbhdd/Videos/Shows -dmenucolors="-l 25" - -playvid() { [ -e "$1" ] && mpv --fullscreen "$1" || exit 1; } - -# Select show -show="`ls "$showsdir" | dmenu $dmenucolors -p "Show:"`" || exit 1 - -# Select season or special option -allep="Show All Episodes" -randep="Play Random Episode" -season="`echo "$allep\n$randep\n$(ls "$showsdir/$show")" | dmenu $dmenucolors -p "Season:"`" || exit 1 - -# Select episode -case "$season" in - $allep) - ep="$(find "$showsdir/$show" -type f | sort | sed 's/.* \([0-9]*\)\/\(.*\)\.mkv$/S\1E\2/' | dmenu $dmenucolors -p "Episode:")" - playvid "$showsdir/$show/$(echo "$ep" | sed 's/^S\([0-9]*\)E/Season \1\//').mkv" - ;; - $randep) playvid "$(find "$showsdir/$show" -type f | shuf -n1)" ;; - *) - ep="$(ls "$showsdir/$show/$season" | sed 's/\.mkv$//' | dmenu $dmenucolors -p "Episode:")" - playvid "$showsdir/$show/$season/$ep.mkv" - ;; -esac |