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
|
||||
current window
|
||||
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,
|
||||
input=options,
|
||||
stdout=subprocess.PIPE,
|
||||
|
|
@ -25,6 +26,10 @@ if result.returncode != 0:
|
|||
|
||||
choice = result.stdout.strip()
|
||||
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 "
|
||||
|
||||
for k, v in {"a selected area.*": "area ",
|
||||
|
|
@ -36,4 +41,7 @@ for k, v in {"a selected area.*": "area ",
|
|||
|
||||
subprocess.call(cmd,
|
||||
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";
|
||||
m = "meson";
|
||||
n = "ninja";
|
||||
gdb_asan = "gdb -tui -ex='break __asan::ReportGenericError'";
|
||||
};
|
||||
|
||||
plugins = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue