Added shortcuts for maim
This commit is contained in:
parent
6000841c7e
commit
8602033910
49
.bashrc
49
.bashrc
|
@ -106,6 +106,8 @@ alias screenterm='TERM=screen-256color'
|
|||
# If you are thurstylark-vps, connect to the existing tmux session locally
|
||||
[[ "$HOSTNAME" = "thurstylark-vps" ]] && alias weechat='tmux attach -dt weechat'
|
||||
|
||||
### FUNCTIONS ###
|
||||
|
||||
# Print Dell Service Tag
|
||||
getdst() {
|
||||
if [[ "$1" = "-l" ]]; then
|
||||
|
@ -114,3 +116,50 @@ getdst() {
|
|||
sudo dmidecode -s system-serial-number
|
||||
fi
|
||||
}
|
||||
|
||||
countdown() {
|
||||
local secs="$1"
|
||||
while [ $secs -gt 0 ]; do
|
||||
echo -ne "$secs\033[0K\r"
|
||||
sleep 1
|
||||
: $((secs--))
|
||||
done
|
||||
}
|
||||
|
||||
# Screenshot utils
|
||||
shot() {
|
||||
# Usage: shot XY
|
||||
local destdir="$HOME/Pictures/screenshots"
|
||||
local fname="screenshot-$(date +%F-%T).png"
|
||||
local fpath="${destdir}/${fname}"
|
||||
local pb="fb"
|
||||
local pipe
|
||||
local -a opts
|
||||
|
||||
# X: What to capture
|
||||
case ${1:0:1} in
|
||||
# Active window
|
||||
w)
|
||||
countdown 5
|
||||
opts[0]="-i$(xdotool getactivewindow)"
|
||||
;;
|
||||
# All
|
||||
a) opts[0]="";;
|
||||
# Mouse selection
|
||||
s) opts[0]="-s --noopengl";;
|
||||
esac
|
||||
|
||||
#Y: Where to put the result
|
||||
case ${1:1:1} in
|
||||
# Save to file
|
||||
f) [ ! -d "$destdir" ] && mkdir -p "$destdir"
|
||||
opts[1]="$fpath"
|
||||
printf "Writing to %s\n" "$fpath"
|
||||
;;
|
||||
# Post to a pastebin
|
||||
p) opts[1]="/tmp/$fname"
|
||||
pipe="$pb ${opts[1]}";;
|
||||
esac
|
||||
|
||||
maim ${opts[@]}; $pipe
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue