diff options
Diffstat (limited to '.local/bin/scripts/screenshot.py')
| -rwxr-xr-x | .local/bin/scripts/screenshot.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/.local/bin/scripts/screenshot.py b/.local/bin/scripts/screenshot.py new file mode 100755 index 0000000..752924b --- /dev/null +++ b/.local/bin/scripts/screenshot.py @@ -0,0 +1,52 @@ +#!/bin/python3 +import sys +import re +import subprocess + +def shoot(arg, dst): + print(f"{tool_name} {arg} | {dst}") + + +tool_name = "maim" +default_tool = "area" +default_dest = "clip" + +file_path = "~/Pictures" +file_name = "Screenshot_$(date +%Y-%m-%d_%H-%M-%S).png" + +tool = { + "area": "-u -s -m 1", + "window": "-B -u -i $(xdotool getactivewindow)", + "screen": "-u", +} + +dest = { + "file": f"tee {file_path}/{file_name}", + "clip": "xclip -selection clipboard -t image/png", +} + +args = sys.argv[1:] +if len(args) == 0: + shoot(tool[default_tool], dest[default_dest]) + +elif len(args) == 1: + if args[0] in tool: + shoot(tool[args[0]], dest[default_dest]) + else: + print("Wrong arguments") + quit(1) + +elif len(args) == 2: + if args[0] == "to" and args[1] in dest: + shoot(tool[default_tool], dest[args[1]]) + else: + print("Wrong arguments") + quit(1) + +elif len(args) == 3: + if args[1] == "to" and args[0] in tool and args[2] in dest: + shoot(tool[args[0]], dest[args[2]]) + else: + print("Wrong arguments") + quit(1) + |