diff options
author | ensa <psii@riseup.net> | 2020-06-26 17:04:50 -0700 |
---|---|---|
committer | ensa <psii@riseup.net> | 2020-06-26 17:04:50 -0700 |
commit | a11f7c357236afea1b00df5f85dc8674f5f1d661 (patch) | |
tree | dfc5c2c7617709ee29803897ce24acd06c71b2e4 /bin | |
parent | 310c76b161e680a698995d61b2a741a05b384fbe (diff) | |
download | cfg-a11f7c357236afea1b00df5f85dc8674f5f1d661.tar.gz |
improved lh, switched to catgirl
bin/ lh: now resolves link shorteners first, so web browser is used less catgirl-open.sh: uses tabbed with xterm to put multiple catgirl clients on one "window" comm-sel: now uses catgirl-open.sh instead of epic5 in xterm cordless specifies config dir so non-standard config locations will work added different x class flags for different TERMINAL values config/ cwmrc: removed St and tabbed from autogroups, added tabbed-surf things generally fixed to accommodate for xterm ALTSCR removed $SCR invocations now include -u to hide the cursor window force-killing uses non-old $() syntax ksh/prompt.ksh: uses unicode halfbar instead of powerline triangles clears formatting at start of PS1 before coloring things
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/bar.sh | 2 | ||||
-rwxr-xr-x | bin/catgirl-open.sh | 31 | ||||
-rwxr-xr-x | bin/comm-sel | 20 | ||||
-rwxr-xr-x | bin/lh | 38 |
4 files changed, 64 insertions, 27 deletions
diff --git a/bin/bar.sh b/bin/bar.sh index 49500ee..6a0a04d 100755 --- a/bin/bar.sh +++ b/bin/bar.sh @@ -1,4 +1,4 @@ #!/bin/sh # loads color envs, pipes spoon to dzen . $HOME_ETC/color/colors.sh -spoon -t|dzen2 -ta r -fg "$color0" -bg "$color1" -fn "Terminus:style=Regular:pixelsize=12" -u -h 13 -w 1366 -l 0 -p +spoon -t|dzen2 -ta r -fg "$foreground" -bg "$background" -fn "Terminus:style=Regular:pixelsize=12" -u -h 13 -w 1366 -l 0 -p diff --git a/bin/catgirl-open.sh b/bin/catgirl-open.sh new file mode 100755 index 0000000..76673ec --- /dev/null +++ b/bin/catgirl-open.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# script for tabbing together catgirl instances, similar to surf-open.sh +. ~/etc/shrc + +xidfile="$XDG_CACHE_HOME/catgirl/tabbed-catgirl.xid" + +choosenet() { + for network in $(ls $HOME_ETC/catgirl/*.conf|sed 's/.*\///'); + do + printf '%s\n' $network; + done | dmenu -p "choose network:" +} + +runtabbed() { + tabbed -fdn comm -r 2 $TERMINAL -into '' -e catgirl $(choosenet) >"$xidfile" & +} + +if [ ! -r "$xidfile" ]; +then + runtabbed +else + xid=$(<"$xidfile") + xprop -id "$xid" >/dev/null 2>&1 + if [ $? -gt 0 ]; + then + runtabbed + else + $TERMINAL -into "$xid" -e catgirl $(choosenet) >/dev/null 2>&1 & + fi +fi + diff --git a/bin/comm-sel b/bin/comm-sel index 0021f88..ce2e99b 100755 --- a/bin/comm-sel +++ b/bin/comm-sel @@ -1,14 +1,14 @@ #!/bin/sh -# sends a list of communication TUIs (e.g epic5) to dmenu and allows the user to choose one. +# sends a list of communication TUIs (e.g catgirl) to dmenu and allows the user to choose one. # class "comm" is added to enable window managers (e.g dwm) to do specific things with them. -# st-altscreen is a built of st that doesn't have scrollback or extra keybindings, so it doesn't get in the way of whatever binds clients have. -# as a result it's lighter than the build of st i use for interactive use. -if command -v st-altscreen>/dev/null; then - TERMINAL="st-altscreen" -fi -case "$(dmenu_path|grep -E "epic5$|cordless|scli$"|dmenu -p "choose chat app:")" in - epic5) $TERMINAL -c comm -e epic5 -l "$XDG_CONFIG_HOME/epic/epicrc" ensa&;; - cordless) $TERMINAL -c comm -e cordless -config-dir "$XDG_CONFIG_HOME/cordless" &;; - scli) $TERMINAL -c comm -e scli&;; +case "$TERMINAL" in + xterm) CLASS='-class';; + urxvt) CLASS='-name';; + alacritty|kitty) CLASS='--class';; +esac +case "$(dmenu_path|grep -E "catgirl$|cordless|scli$"|dmenu -p "choose chat app:")" in + catgirl) catgirl-open.sh &;; + cordless) $TERMINAL $CLASS comm -e env TERM=xterm-256color cordless -config-dir "$XDG_CONFIG_HOME/cordless" &;; + scli) $TERMINAL $CLASS comm -e scli&;; *) return;; esac diff --git a/bin/lh b/bin/lh index 016b37f..e662589 100755 --- a/bin/lh +++ b/bin/lh @@ -15,34 +15,40 @@ split() { set +f } -case "$1" in +# handle redirects. tr removes control characters, so the case statement below works as expected. +URL=$(curl -IL "$1"|grep '^location: '|tail -1|sed 's/location: //'|tr -d '[:cntrl:]') +# if there were no redirects, just set URL to the first argument +[ -z "$URL" ] && URL="$1" + +echo $URL +case "$URL" in gemini://*|gopher://*) - $TERMINAL -e bombadillo "$1" ;; + $TERMINAL -e bombadillo "$URL" ;; *mkv|*webm|*mp4) - mpv "$1" >/dev/null 2>&1 & ;; + mpv "$URL" >/dev/null 2>&1 & ;; *youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*twitch.tv/videos/*|*twitch.tv/*/v/*) - mpv --ytdl "$1" >/dev/null 2>&1 & ;; + mpv --ytdl "$URL" >/dev/null 2>&1 & ;; *twitch.tv/*) - STREAMQUAL="$(split "$(streamlink "$1"|grep 'Available streams')" ", "|\ + STREAMQUAL="$(split "$(streamlink "$URL"|grep 'Available streams')" ", "|\ grep -E "[0-9]"|\ - dmenu -p "choose stream quality for $1")" - streamlink -p mpv $1 $STREAMQUAL >/dev/null 2>&1 & ;; + dmenu -p "choose stream quality for $URL")" + streamlink -p mpv $URL $STREAMQUAL >/dev/null 2>&1 & ;; *png|*jpg|*jpe|*jpeg|*gif) - IMGPATH="/tmp/$(echo "$1"|sed "s/.*\\///")" - curl -sL "$1" >"$IMGPATH"&&sxiv -a "$IMGPATH">/dev/null 2>&1 & ;; + IMGPATH="/tmp/$(echo "$URL"|sed "s/.*\\///")" + curl -sL "$URL" >"$IMGPATH"&&sxiv -a "$IMGPATH">/dev/null 2>&1 & ;; *mp3|*m4a|*flac|*aiff|*opus|*ogg|*mp3?source*) - mpv "$1" >/dev/null 2>&1 & ;; + mpv "$URL" >/dev/null 2>&1 & ;; *epub|*pdf|*djvu) - BOOKPATH="/tmp/$(echo "$1"|sed "s/.*\\///")" + BOOKPATH="/tmp/$(echo "$URL"|sed 's/.*\///')" if [ -n "$READER" ]; then - curl -sL "$1" >"$BOOKPATH"&&$READER "$BOOKPATH">/dev/null 2>&1 & + curl -sL "$URL" >"$BOOKPATH"&&$READER "$BOOKPATH">/dev/null 2>&1 & else - curl -sL "$1" >"$BOOKPATH" & + curl -sL "$URL" >"$BOOKPATH" & fi ;; *) - if [ -f "$1" ]; then - $TERMINAL -e "${EDITOR:-vi} $1" + if [ -f "$URL" ]; then + $TERMINAL -e "${EDITOR:-vi} $URL" else - $BROWSER "$1" >/dev/null 2>&1 & + $BROWSER "$URL" >/dev/null 2>&1 & fi ;; esac |