Skip to content

Commit

Permalink
Prefer if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
amarakon committed Jul 20, 2022
1 parent 33e82ec commit 2797357
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions magickshot
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ main() {
[ -z "$title" ] && title="$(date +'%Y-%m-%d_%R:%S')"
[ -z "$output_file" ] && output_file=$output_directory/import-$title.png

{ [ -n "$help" ] && help; } ||
{ [ -n "$selection" -a -n "$window" ] && screenshot -window $(xdotool selectwindow); } ||
{ [ -n "$selection" ] && xdotool mousemove_relative 1 0 && xdotool mousemove_relative -- -1 0 && screenshot; } ||
{ [ -n "$window" ] && screenshot -window "$window"; } ||
{ [ -n "$display" ] && screenshot -window root; } ||
{ screenshot -window root && magick -extract "$(randr | cut -d ' ' -f 3)" $output_file $output_file; }
if [ -n "$help" ]; then help
elif [ -n "$selection" -a -n "$window" ]; then screenshot -window $(xdotool selectwindow)
elif [ -n "$selection" ]; then xdotool mousemove_relative 1 0 && xdotool mousemove_relative -- -1 0 && screenshot
elif [ -n "$window" ]; then screenshot -window "$window"
elif [ -n "$display" ]; then screenshot -window root
else screenshot -window root && magick -extract "$(randr | cut -d ' ' -f 3)" $output_file $output_file; fi
}

pl() {
Expand Down

0 comments on commit 2797357

Please sign in to comment.