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 | |
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
-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 | ||||
-rw-r--r-- | config/cwmrc | 29 | ||||
-rw-r--r-- | config/ksh/prompt.ksh | 6 |
6 files changed, 81 insertions, 45 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 diff --git a/config/cwmrc b/config/cwmrc index 8539b13..0a34d84 100644 --- a/config/cwmrc +++ b/config/cwmrc @@ -4,12 +4,11 @@ gap 13 0 0 0 sticky yes #autogroup rules autogroup 1 XTerm -autogroup 1 St autogroup 3 mail autogroup 4 comm autogroup 5 music autogroup 5 mpv -autogroup 8 tabbed +autogroup 8 tabbed-surf autogroup 9 pass #aesthetics fontname "Cozette:style=Medium:pixelsize=11" @@ -35,21 +34,21 @@ bind-key 4-d menu-exec bind-key 4S-d menu-cmd bind-key 4C-d menu-window-hidden bind-key 4-Return terminal -#bind-key 4S-Return "sh -c \"$TERMINAL -c popup" -bind-key 4-e "sh -c \"$TERMINAL -e $EDITOR\"" -#bind-key 4S-e "sh -c \"$TERMINAL -c popup -e $EDITOR\"" +#bind-key 4S-Return "sh -c \"$TERMINAL -class popup" +bind-key 4-e "sh -c \"$TERMINAL -e env TERM=xterm-256color $EDITOR\"" +#bind-key 4S-e "sh -c \"$TERMINAL -class popup -e env TERM=xterm-256color $EDITOR\"" bind-key 4-w "sh -c \"$BROWSER $HOMEPAGE\"" bind-key 4S-c "sh -c \"$COMM\"" -bind-key 4-a "sh -c \"$TERMINAL -c pass -e kpcli --kdb=$XDG_DATA_HOME/KeePass/database.kdbx\"" -bind-key 4-s "sh -c \"lh `xclip -o`\"" -bind-key 4S-s "sh -c \"lh `xclip -sel clip -o`\"" -bind-key 4-m "sh -c \"$ALTSCR -c musictui -e $MUSIC\"" -bind-key 4-c "sh -c \"$ALTSCR -c mail -e $MAILER\"" -bind-key 4-n "sh -c \"$ALTSCR -e $RSS\"" -bind-key 4-r "sh -c \"$ALTSCR -e $FILE\"" +bind-key 4-a "sh -c \"$TERMINAL -class pass -e kpcli --kdb=$HOME_DATA/KeePass/database.kdbx\"" +bind-key 4-s "sh -c \"lh $(xclip -o)\"" +bind-key 4S-s "sh -c \"lh $(xclip -sel clip -o)\"" +bind-key 4-m "sh -c \"$TERMINAL -class musictui -e $MUSIC\"" +bind-key 4-c "sh -c \"$TERMINAL -class mail -e $MAILER\"" +bind-key 4-n "sh -c \"$TERMINAL -e $RSS\"" +bind-key 4-r "sh -c \"$TERMINAL -e $FILE\"" bind-key 4S-r "sh -c \"$READER\"" -bind-key 4-p "sh -c \"$SCR $(xdg-user-dir PICTURES)/screenshot-$(date +%Y-%m-%d_%T).png\"" -bind-key 4S-p "sh -c \"$SCR -s $(xdg-user-dir PICTURES)/screenshot-$(date +%Y-%m-%d_%T).png\"" +bind-key 4-p "sh -c \"$SCR -u $(xdg-user-dir PICTURES)/screenshot-$(date +%Y-%m-%d_%T).png\"" +bind-key 4S-p "sh -c \"$SCR -us $(xdg-user-dir PICTURES)/screenshot-$(date +%Y-%m-%d_%T).png\"" bind-key 4S-comma "mpc -q prev" bind-key 4S-period "mpc -q next" bind-key 4-apostrophe "mpc -q single" @@ -102,7 +101,7 @@ bind-key 4-Tab group-cycle bind-key 4S-Tab group-rcycle #window killing bind-key 4-q window-close -bind-key 4S-q "sh -c \"kill -9 `xdotool getwindowfocus getwindowpid`\"" +bind-key 4S-q "sh -c \"kill -9 $(xdotool getwindowfocus getwindowpid)\"" #layouts bind-key 4-f window-maximize bind-key 4S-f window-fullscreen diff --git a/config/ksh/prompt.ksh b/config/ksh/prompt.ksh index c56d441..6ef4c34 100644 --- a/config/ksh/prompt.ksh +++ b/config/ksh/prompt.ksh @@ -1,6 +1,6 @@ #!/bin/ksh -SEP="" -RSEP="" +SEP="▍" +RSEP="▐" #_PS1='\[\033['; #_END='m\]'; #_CLEAR=0; _FG_BLACK=30; _BG_BLACK=40 @@ -17,4 +17,4 @@ vcs() { printf ' %s' "$_GIT_BRANCH" fi } -PS1='\[\033[7;32m\]$?\[\033[0;32;45m\]$SEP\[\033[0;7;35m\]\A$RSEP\[\033[0;1;31m\]\u\[\033[0;32m\]@\[\033[1;34m\]\h\[\033[7;36m\]$SEP\[\033[7m\]\w$RSEP\[\033[0;32m\]$(vcs)\n\[\033[0;32m\]\$\[\033[0m\] ' +PS1='\[\033[0;7;32m\]$?\[\033[0;32;45m\]$SEP\[\033[0;7;35m\]\A$RSEP\[\033[0;1;31m\]\u\[\033[0;32m\]@\[\033[1;34m\]\h\[\033[7;36m\]$SEP\[\033[7m\]\w$RSEP\[\033[0;32m\]$(vcs)\n\[\033[0;32m\]\$\[\033[0m\] ' |