Merge pull request #9 from alterNERDtive/fix/numeric-pid

fix: check for numeric PID in `getPidByActive`
This commit is contained in:
Nicola 2024-02-17 13:31:03 +01:00 committed by GitHub
commit 21d3adac45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -58,6 +58,12 @@ function getPidByActive() {
debugPrint "Getting PID by active window..."
PID=$(hyprctl activewindow -j | jq '.pid')
debugPrint "PID by active window: $PID"
# Die if PID is not numeric (e.g. "null" if there is no active window)
if ! [[ $PID == ?(-)+([[:digit:]]) ]]; then
echo "Cannot freeze window with invalid PID $PID."
exit 1
fi
}
function getPidByPid() {