mirror of
https://github.com/Zerodya/hyprfreeze.git
synced 2024-11-09 17:08:49 +01:00
Merge pull request #9 from alterNERDtive/fix/numeric-pid
fix: check for numeric PID in `getPidByActive`
This commit is contained in:
commit
21d3adac45
1 changed files with 6 additions and 0 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue