diff --git a/README.md b/README.md index e894088..3ca99cc 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Hyprfreeze is available in [AUR](https://aur.archlinux.org/packages/hyprfreeze-g - `psmisc` contains 'pstree' which is required to list child processes - Systemd for the `loginctl` utility ### Optional -- [`hyprprop`](https://github.com/vilari-mickopf/hyprprop) to get the pid of a window by selecting it with your mouse +- [`hyprprop`](https://github.com/vilari-mickopf/hyprprop) or [`swayprop`](https://git.alternerd.tv/alterNERDtive/swayprop) to get the pid of a window by selecting it with your mouse ### Highly Recommended - [`gamescope`](https://github.com/ValveSoftware/gamescope) fixes mouse input not working in other XWayland windows after pausing a Wine game. It's also the superior way to game in Wayland anyway. diff --git a/hyprfreeze b/hyprfreeze index 27fb249..0344f45 100755 --- a/hyprfreeze +++ b/hyprfreeze @@ -12,7 +12,8 @@ Options: -a, --active toggle suspend by active window (supported on hyprland and sway) -p, --pid toggle suspend by process id -n, --name toggle suspend by process name/command - -r, --prop toggle suspend by clicking on window (supported on hyprland, hyprprop must be installed) + -r, --prop toggle suspend by clicking on window (supported on hyprland and sway, + hyprprop/swayprop must be installed) -s, --silent don't send notification -t, --notif-timeout notification timeout in milliseconds (default 5000) @@ -100,12 +101,19 @@ function getPidByName() { function getPidByProp() { debugPrint "Getting PID by prop..." if [[ "hyprland" == "$DESKTOP" ]]; then - if ! command -v hyprprop; then + if ! [ $(command -v hyprprop) ]; then echo "You need to install 'hyprprop' to use this feature. (https://github.com/vilari-mickopf/hyprprop)" exit 1 fi PID=$(hyprprop | jq '.pid') + elif [[ "sway" == "$DESKTOP" ]]; then + if ! [ $(command -v swayprop) ]; then + echo "You need to install 'swayprop' to use this feature. (https://git.alternerd.tv/alterNERDtive/swayprop)" + exit 1 + fi + + PID=$(swayprop | jq '.pid') else echo "Selecting the target window by mouse is currently not supported on $DESKTOP." exit 1