From 24f34060f902c0f82a0c6e84a730b67021556415 Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Wed, 15 Jun 2022 13:19:44 +0300 Subject: [PATCH] Only show overlay image on focused display --- .bin/wscreenshot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.bin/wscreenshot.py b/.bin/wscreenshot.py index bd13dc9..715d4a7 100755 --- a/.bin/wscreenshot.py +++ b/.bin/wscreenshot.py @@ -30,10 +30,11 @@ else: elif sys.argv[1] == '--region': outputs = run(['swaymsg', '-t', 'get_outputs'], check=True, capture_output=True) for output in json.loads(outputs.stdout): + if not output.get("focused"): + continue image = Popen(["grim", "-o", f"{output.get('name')}", '-'], stdout=PIPE) viewer = Popen(['swayimg', '-f', '-o', f'{output.get("name")}','-'], stdin=image.stdout) image_viewers.append(viewer) - time.sleep(0.1) region = run('slurp', check=True, capture_output=True) run(["grim", '-g', '-', file_name], check=True, input=region.stdout)