Created
March 13, 2025 14:07
-
-
Save bonnebulle/35f8cccd1260778dd2bdca9f4cd2f33d to your computer and use it in GitHub Desktop.
xdotool close all current app windows not the active one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
current=$(xprop -root | grep '^_NET_ACTIVE_W' | awk -F'# 0x' '{print $2}' | awk -F', ' '{print $1}') | |
echo current $current | |
class=$(xdotool getwindowfocus getwindowclassname) | |
echo class $class | |
currapp_windows=$(wmctrl -mlpx | grep $class | awk '{print $1}') | |
echo currapp_windows $currapp_windows | |
currapp_window_active=$(wmctrl -mlpx | grep $current | awk '{print $1}') | |
echo currapp_window_active $currapp_window_active | |
for window in $currapp_windows; do | |
if [[ $window != $currapp_window_active ]];then | |
echo "X Fenêtre : $window" # Exemple d'action | |
wmctrl -ic $window | |
else | |
echo "Fenêtre : $window" # Exemple d'action | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment