summaryrefslogtreecommitdiff
path: root/qmenu/qmenu_vm/f_screenshot
diff options
context:
space:
mode:
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
+