#!/bin/sh # /usr/bin/i3-maim # # simple screenshot-script using maim. _conf=$HOME/.config/i3/i3-maim.conf if ! [ -f $_conf ]; then echo "maim_dir=$(xdg-user-dir PICTURES)" > $_conf fi source $_conf if ! [ -d $maim_dir ]; then mkdir -p $maim_dir fi if ! [[ -z "$2" ]]; then cmd="maim -d $2" else cmd='maim' fi case "$1" in --fullscreen|-f|$NULL) $cmd "$maim_dir/$(date +%s).png" && sleep 1 && notify-send "screenshot has been saved in $maim_dir" ;; --window|-w) $cmd -i $(xdotool getactivewindow) "$maim_dir/$(date +%s).png" && sleep 1 && notify-send "screenshot has been saved in $maim_dir" ;; --select|-s) notify-send 'select an area for the screenshot' & $cmd -s "$maim_dir/$(date +%s).png" && sleep 1 && notify-send "screenshot has been saved in $maim_dir" ;; --help|-h) echo " available options: -f | --fullscreen full screen -w | --window active window -s | --select selection -h | --help display this information The -f or -w options can be used with a delay by adding the number of seconds, like for example: 'i3-maim -w 5' Default option is 'full screen'. The file destination can be set in ${_conf}. Default is $maim_dir " ;; *) echo " == ! i3-maim: missing or wrong argument ! == available options: -f | --fullscreen full screen -w | --window active window -s | --select selection -h | --help display this information Default option is 'full screen'. The -f or -w options can be used with a delay by adding the number of seconds, like for example: 'i3-maim -w 5' Default option is 'full screen'. The file destination can be set in ${_conf}. Default is $maim_dir " exit 2 esac exit 0