shortcut to Close All Windows

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
trope
Level 3
Level 3
Posts: 194
Joined: Tue Feb 19, 2013 1:10 pm

shortcut to Close All Windows

Post by trope » Fri Sep 21, 2018 3:47 am

Is there any shortcut to close all open windows? Am using Tara, 64-bit, MATE. I would still like the option to save each document in which changes have been made.

User avatar
AZgl1500
Level 9
Level 9
Posts: 2876
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes sweeping down the plains
Contact:

Re: shortcut to Close All Windows

Post by AZgl1500 » Fri Sep 21, 2018 7:36 am

Yes,

the same exact Keystroke used in MS Windows.

Windows Key D
at least it works in Cinnamon.

if it does not in your version of Mint, then install AutoKey from Software Manager and create a shortcut,

or, go to Settings / Keyboard / Custom Shortcuts and create one there with any kybd key combination you want.

srq2625
Level 4
Level 4
Posts: 398
Joined: Tue Jan 08, 2013 11:35 am
Location: State: Constant Confusion, Country: D'oh

Re: shortcut to Close All Windows

Post by srq2625 » Fri Sep 21, 2018 8:34 am

Windows-D (in Windows 7) does not close open windows, it just minimizes them.

Don't know about how/what it does in Cinnamon - don't have that installed.

User avatar
AZgl1500
Level 9
Level 9
Posts: 2876
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes sweeping down the plains
Contact:

Re: shortcut to Close All Windows

Post by AZgl1500 » Fri Sep 21, 2018 8:44 am

srq2625 wrote:
Fri Sep 21, 2018 8:34 am
Windows-D (in Windows 7) does not close open windows, it just minimizes them.

Don't know about how/what it does in Cinnamon - don't have that installed.
oops, did not read and register what you said there.
sorry...


But yes, in Cinnamon, nearly every Win7 kybd shortcut performs the same.

User avatar
N3wb
Level 2
Level 2
Posts: 72
Joined: Mon Sep 17, 2018 11:33 am

Re: shortcut to Close All Windows

Post by N3wb » Sat Sep 22, 2018 10:01 am

I haven't seen any such shortcut in Windows. However you can implement it by writing a bash script and then assigning keyboard shortcut to execute that script.
Bash script source:

Code: Select all

for n in $(wmctrl -l | awk -v name=$1 '$0 ~ name{print $1}');
do
    wmctrl -i -c $n;
done
Save it as <filename>.sh in your preferred directory. Then in GUI, you can right click file and change file property to make it executable.
Or in command line, go to the directory where the script is present and type

Code: Select all

chmod u+x <filename>.sh
Finally, in system settings, add custom keyboard shortcut and set source file as the script. My recommendation for key combo: Shift + Alt + F4
Linux Mint 19 Cinnamon
Kernel: 4.15.0-36-generic

User avatar
AZgl1500
Level 9
Level 9
Posts: 2876
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes sweeping down the plains
Contact:

Re: shortcut to Close All Windows

Post by AZgl1500 » Sat Sep 22, 2018 1:41 pm

N3wb wrote:
Sat Sep 22, 2018 10:01 am
I haven't seen any such shortcut in Windows. However you can implement it by writing a bash script and then assigning keyboard shortcut to execute that script.
Bash script source:

Code: Select all

for n in $(wmctrl -l | awk -v name=$1 '$0 ~ name{print $1}');
do
    wmctrl -i -c $n;
done
Save it as <filename>.sh in your preferred directory. Then in GUI, you can right click file and change file property to make it executable.
Or in command line, go to the directory where the script is present and type

Code: Select all

chmod u+x <filename>.sh
Finally, in system settings, add custom keyboard shortcut and set source file as the script. My recommendation for key combo: Shift + Alt + F4
thank you this script.

I already have keyboard combo shortcut to shutdown my PC, and have had to close all of my windows before I did it, because I wanted everything to be saved 'gracefully'....

I just added this closeallwindows script and added my shutdown command to it.

works like a charm.

trope
Level 3
Level 3
Posts: 194
Joined: Tue Feb 19, 2013 1:10 pm

Re: shortcut to Close All Windows

Post by trope » Tue Oct 02, 2018 9:34 am

To clarify, all this discussion is for Windows OS, right? So there is no already-installed way to do it in linux mint?

gm10
Level 13
Level 13
Posts: 4661
Joined: Thu Jun 21, 2018 5:11 pm

Re: shortcut to Close All Windows

Post by gm10 » Tue Oct 02, 2018 9:45 am

trope wrote:
Tue Oct 02, 2018 9:34 am
To clarify, all this discussion is for Windows OS, right? So there is no already-installed way to do it in linux mint?
The discussion above is for Linux, the script N3wb posted will close all applications that have open windows.

As far as pre-installed ways go, you can log out and back in, in case that counts for you.

trope
Level 3
Level 3
Posts: 194
Joined: Tue Feb 19, 2013 1:10 pm

Re: shortcut to Close All Windows

Post by trope » Wed Oct 03, 2018 8:23 pm

gm10 wrote:
Tue Oct 02, 2018 9:45 am
trope wrote:
Tue Oct 02, 2018 9:34 am
To clarify, all this discussion is for Windows OS, right? So there is no already-installed way to do it in linux mint?
The discussion above is for Linux, the script N3wb posted will close all applications that have open windows.

As far as pre-installed ways go, you can log out and back in, in case that counts for you.
Unless there is something wrong with my system, logging out did not give me the option to save anything. All the spreadsheets closed; when I logged back in, it asked me whether I wanted to recover them. After that, I was able to save each one.

gm10
Level 13
Level 13
Posts: 4661
Joined: Thu Jun 21, 2018 5:11 pm

Re: shortcut to Close All Windows

Post by gm10 » Wed Oct 03, 2018 8:37 pm

trope wrote:
Wed Oct 03, 2018 8:23 pm
Unless there is something wrong with my system, logging out did not give me the option to save anything.
No, I tried, you are correct, it's not just you. No built-in way then I guess.

User avatar
AZgl1500
Level 9
Level 9
Posts: 2876
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes sweeping down the plains
Contact:

Re: shortcut to Close All Windows

Post by AZgl1500 » Wed Oct 03, 2018 9:48 pm

I noticed that also, "close all windows" and shutdown left things in a very awkward state.

I don't do that anymore. I manually close close them down, so when reopened, they come back to where I was, and with the info saved.

Post Reply

Return to “Newbie Questions”