aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/dmenuscreenshare
blob: 078263705fd97a5bb6a98ca0d56e4407b81c5f0b (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" | rofi -dmenu -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" | rofi -dmenu)
  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" | rofi -dmenu -p "Choose what to screenshare:")

case "$type" in
  "screen")
    get_screen
    ;;
  "windows")
    get_window
    ;;
  "region")
    get_region
    ;;
  *)
    exit 1
    ;;
esac