I have acquired the following python3 script that closes all open windows. This was close to but not quite what I wanted. I wanted all open windows MINIMIZED.
Can anyone edit this script or provide a script to do so please?
Code: Select all
import subprocess
# Define a function to close all open windows
def close_all_windows():
try:
# Use wmctrl to list all open windows
windows_list = subprocess.check_output(["wmctrl", "-l"]).decode("utf-8").strip().split("\n")
# Iterate through the windows and close them one by one
for window in windows_list:
window_id = window.split()[0]
subprocess.run(["wmctrl", "-ic", window_id])
except subprocess.CalledProcessError as e:
print("Error:", e)
# Call the function to close all open windows
close_all_windows()
Logan