Compare commits

...

5 Commits

6 changed files with 114 additions and 6 deletions

View File

@ -34,6 +34,7 @@ sh:
cp -f sh/machine $(DESTDIR)$(PREFIX)/bin
cp -f sh/brightness $(DESTDIR)$(PREFIX)/bin
cp -f sh/git-credential-gitpass $(DESTDIR)$(PREFIX)/bin
cp -f sh/capture $(DESTDIR)$(PREFIX)/bin
check:
shellcheck sh/*

3
TODO
View File

@ -1,8 +1,5 @@
TODO LIST
---------
- change statusbar program so it uses static allocations instead of dynamic ones
- fix paste
- make the c programs less buggy and let them not suck as much
- add manpage for trss
- add option to *force* syncing

60
sh/capture Executable file
View File

@ -0,0 +1,60 @@
#!/bin/sh
# get screen info and temporary file
tmp=$(mktemp)
res=$(xrandr |
grep ' connected' |
awk -F' ' '{print $1 " " $4}' |
awk -F'+' '{print $1}' |
fzy |
awk -F' ' '{print $2}' )
# still or motion
medium=$(printf ".mp4\n.png\n" | fzy)
output="$tmp$medium"
# capture
case "$medium" in
*mp4*)
printf "> starting video capture...\n"
ffmpeg -video_size "$res" -f x11grab -framerate 60 -i $DISPLAY -preset ultrafast -pix_fmt yuv420p "$output"
;;
*png*)
printf "> taking screenshot...\n"
# for a screenshot, we usually want an a s t h e t i c
ffmpeg -f x11grab -video_size "$res" -i $DISPLAY -vframes 1 "$output" -loglevel quiet # be quiet
;;
*)
printf "not a choice\n"
exit 1
esac
# what to do with the capture?
printf "> written to %s\n" "$output"
while true; do
result=$(printf "delete\nmove to home directory\nupload to pastebin\nreview footage\nquit\n" | fzy --prompt="what next? ")
case "$result" in
*upload*)
paste "$output" | xclip -i
printf "> pasted! check your clipboard\n"
;;
*review*)
[ "$medium" = ".mp4" ] && mpv "$output" && continue
feh "$output"
;;
*delete*)
printf "> removing target file...\n"
rm "$output"
exit 1
;;
*home*)
printf "> warping your capture to home...\n"
name=$(echo "capture$medium" | fzy --prompt="name please? ")
mv "$output" "$HOME/$name"
exit 1
;;
*quit*)
exit 1
;;
esac
done

View File

@ -15,4 +15,13 @@ if [ "$(exists "HDMI-2")" -eq 1 ] && [ "$(exists "LVDS-1")" -eq 1 ]; then
exit 0
fi
if [ "$(exists "HDMI-1")" -eq 1 ] && [ "$(exists "LVDS-1")" -eq 1 ]; then
printf "two"
xrandr --output HDMI-1 --right-of LVDS-1 --auto
xrandr --output VGA-1 --off --auto
bspc monitor LVDS-1 -d 1 2 3 4 5 6 7 8 9
bspc monitor HDMI-1 -d 1 2 3 4 5 6 7 8 9
exit 0
fi
# default configuration's fine

41
sh/firew Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
# wrapper script to make firefox suck less
RHOME="${HOME}"
firefox_data_location="$HOME/firefoxdumpster"
[ -z "$3" ] || url="$3"
# start a profile chooser
if [ -z "$2" ]; then
profile=$(printf "programming\nschool\ntmp-school\ntmp\nchromium\n" | tmenu)
else
profile="$2"
fi
[ -z "$profile" ] && exit
if [ "$profile" = "tmp" ]; then
# firefox doesn't start in a directory within /tmp
# so we create one in $HOME/.cache
tmp=$(basename $(mktemp))
mkdir -p "${RHOME}/.cache/${tmp}"
rm -r "/tmp/$tmp"
HOME="/home/$(whoami)/.local/share/firefox" firefox --profile "${RHOME}/.cache/${tmp}" --no-remote "$url"
rm -r "${RHOME}/.cache/${tmp}"
exit
fi
if [ "$profile" = "chromium" ]; then
HOME="/home/$(whoami)/.local/share/firefox" chromium
exit
fi
# start firefox
mkdir -p "${firefox_data_location}/profile"
HOME="/home/$(whoami)/.local/share/firefox" firefox --profile "${firefox_data_location}/${profile}" --no-remote "$url"
exit
printf "failed to specify a profile. exiting.\n"
exit 1

View File

@ -11,19 +11,19 @@ mod_bspwm () {
current_desk=$(bspc query -D -d .focused --names)
final_string=""
current_printed=0
cur_char='>'
for i in $used_desk; do
[ "$i" = "$current_desk" ] && \
final_string=${final_string}"*$i " && \
final_string=${final_string}"$cur_char$i " && \
current_printed=1 || \
final_string=${final_string}"$i "
done
[ $current_printed -eq 0 ] &&
final_string=${final_string}"*$current_desk "
final_string=${final_string}"$cur_char$current_desk "
printf "%s" "$final_string"
set +x
}
mod_period () {