aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/dmenuscreenshare
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/dmenuscreenshare')
-rwxr-xr-x.local/bin/dmenuscreenshare39
1 files changed, 39 insertions, 0 deletions
diff --git a/.local/bin/dmenuscreenshare b/.local/bin/dmenuscreenshare
new file mode 100755
index 0000000..b4cd94e
--- /dev/null
+++ b/.local/bin/dmenuscreenshare
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+get_window()
+{
+ input="$(echo $XDPH_WINDOW_SHARING_LIST | sed 's/\[HA>\]/\n/g' | sed -E 's/\[(HC|HE)>][^[]*//g')"
+ choice=$(echo "$input" | mew -l 10)
+ printf '[SELECTION]/window:%s\n' "$choice"
+}
+
+get_screen()
+{
+ input="$(hyprctl monitors -j | jq -r '.[].name')"
+ num="$(cat $input | wc -l)"
+ choice=$(echo "$input" | mew)
+ printf '[SELECTION]/screen:%s\n' "$choice"
+}
+
+get_region()
+{
+ choice="$(slurp -f "%o@%X,%Y,%w,%h")"
+ printf '[SELECTION]/region:%s\n' "$choice"
+}
+
+type=$(printf "screen\nwindows\nregion" | mew -p "Choose what to screenshare:")
+
+case "$type" in
+ "screen")
+ get_screen
+ ;;
+ "windows")
+ get_window
+ ;;
+ "region")
+ get_region
+ ;;
+ *)
+ exit 1
+ ;;
+esac