diff options
author | awy <awy@awy.one> | 2025-08-14 18:03:22 +0300 |
---|---|---|
committer | awy <awy@awy.one> | 2025-08-14 18:03:22 +0300 |
commit | f8fc78a2e54ac81ddd047055749f3ab616560f0e (patch) | |
tree | 6a0e042aad0f352cc4ff7c12d128c0642c1aad83 /.local/bin/dmenuscreenshare | |
parent | a4ee024f382ec90b85c0da51bf628cbecb48c4ee (diff) | |
download | hyprdots-f8fc78a2e54ac81ddd047055749f3ab616560f0e.tar.gz |
dmenu wrapper for hyprland screenshare picker
Diffstat (limited to '.local/bin/dmenuscreenshare')
-rwxr-xr-x | .local/bin/dmenuscreenshare | 39 |
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 |