feat: implement swayprop

This commit is contained in:
alterNERDtive 2024-02-13 02:07:02 +01:00
parent d2656ce853
commit 16346343dd
Signed by: alterNERDtive
GPG key ID: 547787A4FE6533F1
2 changed files with 11 additions and 3 deletions

View file

@ -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.

View file

@ -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