updates to Makefile, vim-swap-handler, disp, and nws
This commit is contained in:
parent
3751a7d125
commit
d8febccf82
1
Makefile
1
Makefile
|
@ -19,6 +19,7 @@ sh:
|
||||||
cp -f sh/proxtest $(DESTDIR)$(PREFIX)/bin
|
cp -f sh/proxtest $(DESTDIR)$(PREFIX)/bin
|
||||||
cp -f sh/pco $(DESTDIR)$(PREFIX)/bin
|
cp -f sh/pco $(DESTDIR)$(PREFIX)/bin
|
||||||
cp -f sh/git-survey $(DESTDIR)$(PREFIX)/bin
|
cp -f sh/git-survey $(DESTDIR)$(PREFIX)/bin
|
||||||
|
cp -f sh/vim-swap-handler $(DESTDIR)$(PREFIX)/bin
|
||||||
|
|
||||||
mkc:
|
mkc:
|
||||||
cc c/scream.c -o c/scream
|
cc c/scream.c -o c/scream
|
||||||
|
|
32
sh/disp
32
sh/disp
|
@ -1,29 +1,29 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
exists() {
|
exists() {
|
||||||
xrandr | grep ' connected' | grep "${1}" | wc -l
|
xrandr | grep ' connected' | grep "${1}" | wc -l
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $(exists "HDMI-2") -eq 1 ]; then
|
if [ $(exists "HDMI-2") -eq 1 ]; then
|
||||||
printf "one"
|
printf "one"
|
||||||
xrandr --output LVDS-1 --off --auto
|
xrandr --output LVDS-1 --off --auto
|
||||||
xrandr --output VGA-1 --off --auto
|
xrandr --output VGA-1 --off --auto
|
||||||
bspc monitor -d I II III IV V VI VII VIII IX X
|
bspc monitor -d I II III IV V VI VII VIII IX X
|
||||||
bspc monitor -g 1680x1050+0+0
|
bspc monitor -g 1680x1050+0+0
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(exists "LVDS-1") -eq 1 ]; then
|
if [ $(exists "LVDS-1") -eq 1 ]; then
|
||||||
bspc monitor -d I II III IV V VI VII VIII IX X
|
bspc monitor -d I II III IV V VI VII VIII IX X
|
||||||
bspc monitor LVDS-1 -a I II III IV V VI VII VIII IX
|
bspc monitor LVDS-1 -a I II III IV V VI VII VIII IX
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(exists "HDMI-2") -eq 1 ] && [ $(exists "LVDS-1") -eq 1 ]; then
|
if [ $(exists "HDMI-2") -eq 1 ] && [ $(exists "LVDS-1") -eq 1 ]; then
|
||||||
printf "two"
|
printf "two"
|
||||||
xrandr --output HDMI-2 --above LVDS-1 --auto
|
xrandr --output HDMI-2 --above LVDS-1 --auto
|
||||||
xrandr --output VGA-1 --off --auto
|
xrandr --output VGA-1 --off --auto
|
||||||
bspc monitor LVDS-1 -a I III V VII IX
|
bspc monitor LVDS-1 -a I III V VII IX
|
||||||
bspc monitor HDMI-2 -a II IV VI VIII
|
bspc monitor HDMI-2 -a II IV VI VIII
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
98
sh/nws
98
sh/nws
|
@ -28,74 +28,74 @@ Torify wrapper: export NWS_TORIFY=<command>
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
err () {
|
err () {
|
||||||
printf "err: %s\n" ${1}
|
printf "err: %s\n" ${1}
|
||||||
[ -z "${2}" ] && exit 1
|
[ -z "${2}" ] && exit 1
|
||||||
exit ${2}
|
exit ${2}
|
||||||
}
|
}
|
||||||
kstrip () {
|
kstrip () {
|
||||||
printf %s "$1" | sed 's/^K\(.*\)/\1/'
|
printf %s "$1" | sed 's/^K\(.*\)/\1/'
|
||||||
}
|
}
|
||||||
national () {
|
national () {
|
||||||
mosaic CONUS-LARGE
|
mosaic CONUS-LARGE
|
||||||
}
|
}
|
||||||
# name interestingly to avoid keyword collision
|
# name interestingly to avoid keyword collision
|
||||||
localradar () {
|
localradar () {
|
||||||
mosaic ${NWS_ZONE}
|
mosaic ${NWS_ZONE}
|
||||||
}
|
}
|
||||||
mosaic () {
|
mosaic () {
|
||||||
${NWS_GIF} "https://radar.weather.gov/ridge/lite/${1}_loop.gif"
|
${NWS_GIF} "https://radar.weather.gov/ridge/lite/${1}_loop.gif"
|
||||||
}
|
}
|
||||||
setzone () {
|
setzone () {
|
||||||
printf "%s" "${1}" > ${NWS_CONFIG}
|
printf "%s" "${1}" > ${NWS_CONFIG}
|
||||||
}
|
}
|
||||||
river () {
|
river () {
|
||||||
textmessage "RVA"
|
textmessage "RVA"
|
||||||
}
|
}
|
||||||
weather () {
|
weather () {
|
||||||
textmessage "ZFP"
|
textmessage "ZFP"
|
||||||
}
|
}
|
||||||
textmessage () {
|
textmessage () {
|
||||||
curl --silent --fail "https://forecast.weather.gov/product.php?site=NWS&issuedby=$(kstrip ${NWS_ZONE})&product=${1}&format=TXT&version=1" | \
|
curl --silent --fail "https://forecast.weather.gov/product.php?site=NWS&issuedby=$(kstrip ${NWS_ZONE})&product=${1}&format=TXT&version=1" | \
|
||||||
sed -n '/<!-- \/\/ CONTENT STARTS HERE -->/,/<\/pre>/p' | \
|
sed -n '/<!-- \/\/ CONTENT STARTS HERE -->/,/<\/pre>/p' | \
|
||||||
grep -v "a href" | \
|
grep -v "a href" | \
|
||||||
grep -v '<!-- // CONTENT STARTS HERE -->' | \
|
grep -v '<!-- // CONTENT STARTS HERE -->' | \
|
||||||
grep -v '<\/pre>' || \
|
grep -v '<\/pre>' || \
|
||||||
printf "${1} data not found for zone %s" ${NWS_ZONE}
|
printf "${1} data not found for zone %s" ${NWS_ZONE}
|
||||||
}
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
"n"*)
|
"n"*)
|
||||||
national
|
national
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
"l"*)
|
"l"*)
|
||||||
localradar
|
localradar
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
"r"*)
|
"r"*)
|
||||||
river
|
river
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
"w"*)
|
"w"*)
|
||||||
weather
|
weather
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
"m"*)
|
"m"*)
|
||||||
[ $# -eq 2 ] && mosaid $2 || \
|
[ $# -eq 2 ] && mosaid $2 || \
|
||||||
err "two args required"
|
err "two args required"
|
||||||
;;
|
;;
|
||||||
"s"*)
|
"s"*)
|
||||||
[ $# -eq 2 ] && setzone $2 || \
|
[ $# -eq 2 ] && setzone $2 || \
|
||||||
err "two args required"
|
err "two args required"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
"t"*)
|
"t"*)
|
||||||
[ $# -eq 2 ] && textmessage $2 || \
|
[ $# -eq 2 ] && textmessage $2 || \
|
||||||
err "two args required"
|
err "two args required"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
info
|
info
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# when the vim SwapExists autocommand is fired, this script is
|
||||||
|
# called with the path of the file in question.
|
||||||
|
|
||||||
|
# mad props to daniel conway for having this big brain idea
|
||||||
|
|
||||||
|
# note to self: protect $1 from expansion as it can contain a
|
||||||
|
# ~
|
||||||
|
|
||||||
|
[ "$#" -eq 0 ] && exit 2
|
||||||
|
|
||||||
|
window=$(
|
||||||
|
xdotool search --name "$1" | \
|
||||||
|
sed 1q
|
||||||
|
)
|
||||||
|
|
||||||
|
desk=$(
|
||||||
|
xdotool get_desktop_for_window "$window" 2>/dev/null || printf "none"
|
||||||
|
)
|
||||||
|
|
||||||
|
[ "$desk" = "none" ] && exit 1
|
||||||
|
desk=$(($desk + 1))
|
||||||
|
|
||||||
|
bspc desktop -f "^${desk}"
|
||||||
|
killall -10 simplestatus
|
||||||
|
xdotool set_window --urgency 1 "$window"
|
||||||
|
|
||||||
|
exit 0
|
Loading…
Reference in New Issue