aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/dmenuscreenshare
blob: f94f00b9a1260228aaca147764c2bd357d5cb131 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

get_window()
{
  input="$(echo $XDPH_WINDOW_SHARING_LIST | sed 's/\[HA>\]/[HA>]\n/g')"
  choice=$(echo "$input" | mew -l 10)
  printf '[SELECTION]r/window:%s\n' "$choice"
  echo $XDPH_WINDOW_SHARING_LIST > ~/test
}

get_screen()
{
  input="$(hyprctl monitors -j | jq -r '.[].name')"
  num="$(cat $input | wc -l)"
  choice=$(echo "$input" | mew)
  printf '[SELECTION]r/screen:%s\n' "$choice"
}

get_region()
{
  choice="$(slurp -f "%o@%X,%Y,%w,%h")"
  printf '[SELECTION]r/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