diff options
-rw-r--r-- | .config/hypr/hyprland.conf | 1 | ||||
-rw-r--r-- | .config/hypr/xdph.conf | 3 | ||||
-rw-r--r-- | .config/xdg-desktop-portal/config | 3 | ||||
-rwxr-xr-x | .local/bin/dmenuscreenshare | 39 | ||||
-rwxr-xr-x | .local/bin/portal | 5 |
5 files changed, 50 insertions, 1 deletions
diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index 8f092bb..1a3efb5 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -16,6 +16,7 @@ exec-once = singboxwrap # exec-once = sleep 0.1 && randombg exec-once = gpg-agent --daemon exec-once = gnome-keyring-daemon --start --components=secrets +exec-once = portal env = XCURSOR_SIZE,24 env = XCURSOR_THEME,Retrowaita diff --git a/.config/hypr/xdph.conf b/.config/hypr/xdph.conf new file mode 100644 index 0000000..3a80fde --- /dev/null +++ b/.config/hypr/xdph.conf @@ -0,0 +1,3 @@ +screencopy { + custom_picker_binary = dmenuscreenshare +} diff --git a/.config/xdg-desktop-portal/config b/.config/xdg-desktop-portal/config new file mode 100644 index 0000000..06f1cf1 --- /dev/null +++ b/.config/xdg-desktop-portal/config @@ -0,0 +1,3 @@ +[preferred] +default=hyprland;termfilechooser +org.freedesktop.impl.portal.FileChooser=termfilechooser 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 diff --git a/.local/bin/portal b/.local/bin/portal index b0afa23..c73e77b 100755 --- a/.local/bin/portal +++ b/.local/bin/portal @@ -1,5 +1,8 @@ #!/bin/sh sleep 1 +killall /lib/xdg-desktop-portal-hyprland killall xdg-desktop-portal-wlr killall xdg-desktop-portal -/lib/xdg-desktop-portal-wlr & +killall xdg-desktop-portal-termfilechooser +/lib/xdg-desktop-portal-hyprland & +/lib/xdg-desktop-portal-termfilechooser -r & |