nixos-configs/eww/scripts/close-opened.sh
2023-06-14 03:16:26 -04:00

19 lines
461 B
Bash
Executable file

#!/usr/bin/env bash
# Store the output of the command in an array, keeping only lines with '*'
readarray -t array <<< "$(eww windows | grep '^\*')"
# Remove the '*' from each element
for ((i=0; i<${#array[@]}; i++))
do
array[i]=${array[i]#'*'}
array[i]=${array[i]%-reveal}
done
# Close every window except permanent ones
for element in "${array[@]}"
do
if [[ "$element" != "tablet-toggle" ]]; then
$HOME/.config/eww/scripts/close.sh "$element"
fi
done