Skip to content

Instantly share code, notes, and snippets.

@bonnebulle
Last active October 8, 2023 08:50
Show Gist options
  • Save bonnebulle/930c272b797715a54c366d0256223962 to your computer and use it in GitHub Desktop.
Save bonnebulle/930c272b797715a54c366d0256223962 to your computer and use it in GitHub Desktop.
Close current app windows (linux)
#!/bin/bash
# DO Close all windows in current/active app
# USAGE Keyboard Shortcut Ctrl+Alt+W (like macOS)
# SOURCE https://www.tuxtips.info/linux/how-to-close-all-open-windows-in-linux ( close ALL)
# SOURCE https://unix.stackexchange.com/a/588813 ( search only current app )
for n in $(xdotool search -class $(xdotool getactivewindow getwindowclassname) | awk $2 '!/-1/ {print $1}')
do
wmctrl -i -c $n;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment