summaryrefslogtreecommitdiff
path: root/qmenu/qmenu_vm/f_screenshot
diff options
context:
space:
mode:
authorCasper <me@skylarcloud.xyz>2024-12-23 17:13:45 -0700
committerCasper <me@skylarcloud.xyz>2024-12-23 17:13:45 -0700
commit01a33ab0913d439150065ac23644c4f140ff8917 (patch)
tree9ad71bd7e6f5a5aad2c2cdbff4bb75de12565998 /qmenu/qmenu_vm/f_screenshot
parent7b5a0e9e88f015cb68a46bb657661f4663e287af (diff)
added qmenu!
Diffstat (limited to 'qmenu/qmenu_vm/f_screenshot')
-rw-r--r--qmenu/qmenu_vm/f_screenshot18
1 files changed, 18 insertions, 0 deletions
diff --git a/qmenu/qmenu_vm/f_screenshot b/qmenu/qmenu_vm/f_screenshot
new file mode 100644
index 0000000..cac22bc
--- /dev/null
+++ b/qmenu/qmenu_vm/f_screenshot
@@ -0,0 +1,18 @@
+err="qmenu-vm - Error: Failed to take a screenshot! Please make sure that 'scrot' is installed inside $qube."
+
+target=$(printf 'Focused window\nAll visible windows' | dmenu-unlinked -l 2 -i -p "$qube:" | cut -f1 -d\ )
+
+if [ "$target" = Focused ]; then
+
+ if [ "$(xprop -id "$(xdotool getwindowfocus)" _QUBES_VMNAME | cut -d\" -f2)" = "$qube" ]; then
+
+ (qvm-run -q "$qube" 'scrot -q 100 -u $HOME/Pictures/screenshot' || notify-send -u normal "$err")&
+ else
+ echo 'Go back...' | dmenu-unlinked -p "Warning: Unable to take a screenshot. Please focus a window belonging to $qube." > /dev/null 2>&1
+ fi
+
+elif [ "$target" = All ]; then
+
+ (qvm-run -q "$qube" 'scrot -q 100 $HOME/Pictures/screenshot' || notify-send -u normal "$err")&
+fi
+