Это то же самое, что и ответ Джейкоба Влайма, только что написанный в bash:
#!/usr/bin/env bash
## window_name will be the first argument passed or, if no
## argument was given, "Terminal"
window_name=${1:-"Terminal"}
## Get the list of open terminals
terms=( $(wmctrl -l | grep "$window_name" | cut -d ' ' -f 1) )
## If all terminals are hidden
if [ -z "${terms[0]}" ]
then
## Read the IDs of hidden windows from .hidden_window_id
while read termid
do
xdotool windowmap "$termid"
done < ~/.hidden_window_id
## If there are visible terminals
else
## Clear the .hidden_window_id file
> ~/.hidden_window_id
## For each open terminal
for i in "${terms[@]}"
do
## Save the current ID into the file
printf "%s\n" "$i" >> ~/.hidden_window_id
## Hide the window
xdotool windowunmap "$i"
done
fi
Если вы сохраните его как ~/bin/show_hide.sh, вы можете запустить его, указав строку идентификации любого окна, которое вы хочу спрятаться. Если строка не указана, она будет работать на Terminal:
show_hide.sh Terminal