add screenshot to an image viewer
This commit is contained in:
parent
542eb04540
commit
e341716e95
2 changed files with 11 additions and 2 deletions
|
|
@ -10,9 +10,10 @@ full screen (copy)
|
||||||
a selected area
|
a selected area
|
||||||
current window
|
current window
|
||||||
full screen
|
full screen
|
||||||
|
viewer
|
||||||
"""
|
"""
|
||||||
|
|
||||||
cmd = '${pkgs.rofi-wayland}/bin/rofi -dmenu -location 2 -l 6 -i -p "Screenshot which area?"'
|
cmd = '${pkgs.rofi-wayland}/bin/rofi -dmenu -location 2 -l 7 -i -p "Screenshot which area?"'
|
||||||
result = subprocess.run(cmd,
|
result = subprocess.run(cmd,
|
||||||
input=options,
|
input=options,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
|
|
@ -25,6 +26,10 @@ if result.returncode != 0:
|
||||||
|
|
||||||
choice = result.stdout.strip()
|
choice = result.stdout.strip()
|
||||||
cmd = "${pkgs.pkgs.sway-contrib.grimshot}/bin/grimshot "
|
cmd = "${pkgs.pkgs.sway-contrib.grimshot}/bin/grimshot "
|
||||||
|
if choice == "viewer":
|
||||||
|
filename = subprocess.getoutput("mktemp")
|
||||||
|
cmd += f"save area {filename}"
|
||||||
|
else:
|
||||||
cmd += "copy " if re.match(".*(copy)", choice) else "save "
|
cmd += "copy " if re.match(".*(copy)", choice) else "save "
|
||||||
|
|
||||||
for k, v in {"a selected area.*": "area ",
|
for k, v in {"a selected area.*": "area ",
|
||||||
|
|
@ -36,4 +41,7 @@ for k, v in {"a selected area.*": "area ",
|
||||||
|
|
||||||
subprocess.call(cmd,
|
subprocess.call(cmd,
|
||||||
shell=True)
|
shell=True)
|
||||||
|
|
||||||
|
if choice == "viewer":
|
||||||
|
subprocess.run(f"nsxiv -b {filename}", shell=True)
|
||||||
''
|
''
|
||||||
|
|
|
||||||
1
fish.nix
1
fish.nix
|
|
@ -110,6 +110,7 @@
|
||||||
pull = "git pull";
|
pull = "git pull";
|
||||||
m = "meson";
|
m = "meson";
|
||||||
n = "ninja";
|
n = "ninja";
|
||||||
|
gdb_asan = "gdb -tui -ex='break __asan::ReportGenericError'";
|
||||||
};
|
};
|
||||||
|
|
||||||
plugins = [
|
plugins = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue