Hotkey to Close the Current Window

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
raywood

Hotkey to Close the Current Window

Post by raywood »

Let's say I have sessions of Terminal, xed, Thunar, and Firefox open currently. This would be comparable to having a command window, Notepad, Windows Explorer, and Firefox open in Windows. In Windows, Ctrl-W has relatively desirable behavior, for my purposes: it closes the Windows Explorer session and the current Firefox tab. It has no effect on the command window or Notepad, unfortunately.

I switch back and forth between the two operating systems. How close can I come to setting Ctrl-W or Super-W to close any of the foregoing? So far, I'm not finding a single universal (or even semi-universal) command that I could assign to a hotkey to close the currently selected window, dialog, or tab in LMX.

This is not a high priority for me. It is a bell or whistle that I would ideally add. In part, I'm just curious. But if I could get that functionality, it would help. TIA.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
gm10

Re: Hotkey to Close the Current Window

Post by gm10 »

I'm not on Xfce but Ctrl+W already seems to be the default for closing tabs in those apps (Ctrl+Shift+W in the terminals)? Either way, a hotkey for closing a tab has to be provided by each application individually, you cannot configure that globally. So check the respective application setings/preferences.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Hotkey to Close the Current Window

Post by catweazel »

gm10 wrote: Mon Jun 25, 2018 7:49 pm I'm not on Xfce but Ctrl+W already seems to be the default for closing tabs in those apps (Ctrl+Shift+W in the terminals)? Either way, a hotkey for closing a tab has to be provided by each application individually, you cannot configure that globally. So check the respective application setings/preferences.
Nonsense.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Hotkey to Close the Current Window

Post by catweazel »

raywood wrote: Mon Jun 25, 2018 7:28 pm In Windows, Ctrl-W has relatively desirable behavior
Alt-F4 is the standard method for closing windows. In Xfce, go to Window Manager, and on the keyboard tab, select 'Close window', double-click to clear, then set Ctrl-w as the action for F4. However on my xfce, ctrl-w closes windows without changing the setting.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
gm10

Re: Hotkey to Close the Current Window

Post by gm10 »

catweazel wrote: Mon Jun 25, 2018 8:13 pm
gm10 wrote: Mon Jun 25, 2018 7:49 pm I'm not on Xfce but Ctrl+W already seems to be the default for closing tabs in those apps (Ctrl+Shift+W in the terminals)? Either way, a hotkey for closing a tab has to be provided by each application individually, you cannot configure that globally. So check the respective application setings/preferences.
Nonsense.
Thank you for your helpful contribution. Then explain to me (or rather the OP) how a global hotkey from the window manager can interact with tabs in an application. Your explanation about closing the whole application window down, while correct, will hardly help him with that.
aes2011
Level 4
Level 4
Posts: 498
Joined: Wed Jul 06, 2011 10:39 pm

Re: Hotkey to Close the Current Window

Post by aes2011 »

raywood wrote: Mon Jun 25, 2018 7:28 pm to close the currently selected window, dialog, or tab in LMX.
+1 gm10.

I very much doubt you can have one command that deals with closing tabs as well as with closing normal windows and tabs in applications.
User avatar
AZgl1800
Level 20
Level 20
Posts: 11145
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes Sweeping down the Plains
Contact:

Re: Hotkey to Close the Current Window

Post by AZgl1800 »

I'm using 18.3 Cinnamon,

and ALT-F4 will close everything period, no problems including Terminal.
LM21.3 Cinnamon ASUS FX705GM | Donate to Mint https://www.patreon.com/linux_mint
Image
k-314

Re: Hotkey to Close the Current Window

Post by k-314 »

AZgl1500 wrote: Tue Jun 26, 2018 1:28 am I'm using 18.3 Cinnamon,

and ALT-F4 will close everything period, no problems including Terminal.
...but the question was about Xfce.
User avatar
mint4all
Level 2
Level 2
Posts: 95
Joined: Tue Feb 13, 2018 1:16 pm

Re: Hotkey to Close the Current Window

Post by mint4all »

k-314 wrote: Tue Jun 26, 2018 12:43 pm
AZgl1500 wrote: Tue Jun 26, 2018 1:28 am I'm using 18.3 Cinnamon,

and ALT-F4 will close everything period, no problems including Terminal.
...but the question was about Xfce.
Greetings! I have been using Mint's xfce-editions for over 4+ years (and have tested a number of other distro's exploring how they have tweaked xfce, i.e. xubuntu's spin), and never had a problem using the ALT-F4 key to close open windows (except, of course, when an app has crashed or hangs) just as catweazel indicated above. Just to be sure, i opened ~10 different apps, incl. Terminal, on top of each other, then used ALT-F4 to close each of those "open" windows with the last one bringing up the logout popup. Afaict, no problem at all. Note: any minimized apps remain in xfce's window list, btw.

Just in case one needs to tweak something, there's more info available about typical linux shortcuts @ https://help.ubuntu.com/community/KeyboardShortcuts and @ https://en.wikipedia.org/wiki/Magic_SysRq_key ... Hope this helps.
MtnDewManiac
Level 6
Level 6
Posts: 1491
Joined: Fri Feb 22, 2013 5:18 pm
Location: United States

Re: Hotkey to Close the Current Window

Post by MtnDewManiac »

catweazel wrote: Mon Jun 25, 2018 8:19 pmAlt-F4 is the standard method for closing windows.
In linux, too? I had been assuming that it was the standard method in Microsoft OS (for many years, at least), but wasn't sure about linux. I had been privately assuming (there I go, assuming again :lol: ) that this was another example of "The linux experience is like dealing with 1,000 rabid cats" in that there wasn't really a standard. CTRL Q seems to exit most applications I use, even ones that aren't "linux onlu" (such as Firefox). One notable exception being mint-Update, but as it still occasionally fails to display a changelog for the files it wishes to upgrade, I figure that anything else that it fails at is, realistically, pretty minor as long as it doesn't actually cause a fire :roll: . But with most apps, CTRL Q performs an exit and CTRL W closes a tab (if present) or window (ditto, if the application supports multiple windows), without actually exiting.

But if ALT F4 is the correct way to immediately exit an application and/or popup window, then I will attempt to train myself to use this combination instead of CTRL Q.

Regards,
MDM
Mint 18 Xfce 4.12.

If guns kill people, then pencils misspell words, cars make people drive drunk, and spoons made Rosie O'Donnell fat.
User avatar
AZgl1800
Level 20
Level 20
Posts: 11145
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes Sweeping down the Plains
Contact:

Re: Hotkey to Close the Current Window

Post by AZgl1800 »

In Mint Cinnamon and some of the other distros,

ALT-F4 closes every app I have tried it on, including Terminal.
LM21.3 Cinnamon ASUS FX705GM | Donate to Mint https://www.patreon.com/linux_mint
Image
gm10

Re: Hotkey to Close the Current Window

Post by gm10 »

MtnDewManiac wrote: Mon Jul 02, 2018 3:43 pm But if ALT F4 is the correct way to immediately exit an application and/or popup window, then I will attempt to train myself to use this combination instead of CTRL Q.
The more mainstream distros have just picked it up to make the transition from Windows easier. Personally I use Ctrl+Q mostly, easier to reach. On the other hand, I configured Win+E to open the file browser, blatantly copied from the Windows world, but it's a good combination.

To go with the old Perl motto, there's more than one way to do it. Use whatever suits your work flow best.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Hotkey to Close the Current Window

Post by catweazel »

gm10 wrote: Mon Jul 02, 2018 4:56 pm The more mainstream distros have just picked it up to make the transition from Windows easier.
I'm not sure that's correct. It's been in UX design guidelines since the year dot. Consistency in UX is a golden rule.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
gm10

Re: Hotkey to Close the Current Window

Post by gm10 »

catweazel wrote: Mon Jul 02, 2018 6:14 pm
gm10 wrote: Mon Jul 02, 2018 4:56 pm The more mainstream distros have just picked it up to make the transition from Windows easier.
I'm not sure that's correct. It's been in UX design guidelines since the year dot. Consistency in UX is a golden rule.
Probably a hen/egg problem, but I'm good with either, makes no difference at the end of the day.
User avatar
mint4all
Level 2
Level 2
Posts: 95
Joined: Tue Feb 13, 2018 1:16 pm

Re: Hotkey to Close the Current Window

Post by mint4all »

gm10 wrote: Mon Jul 02, 2018 6:22 pm
catweazel wrote: Mon Jul 02, 2018 6:14 pm
gm10 wrote: Mon Jul 02, 2018 4:56 pm The more mainstream distros have just picked it up to make the transition from Windows easier.
I'm not sure that's correct. It's been in UX design guidelines since the year dot. Consistency in UX is a golden rule.
Probably a hen/egg problem, but I'm good with either, makes no difference at the end of the day.
Fwiw ... You're looking at 25+ years of keyboarding tradition. The ALT+F4 combo (afaicr) was introduced by IBM in ther "CUA" (common user access) specification which was adopted by MS in Windows 3.1 (ca. 1992) & IBM in OS/2. You can find that old keyboard shortcut map @ http://allhotkeys.com/os_2_hotleys.html ... Funny how history repeats itself, eh? :wink:
gm10

Re: Hotkey to Close the Current Window

Post by gm10 »

Wow OS/2, now that's a blast from the past. Also interesting (mostly the fact that somebody would go to the trouble of creating this): https://en.wikipedia.org/wiki/Table_of_ ... _shortcuts
User avatar
lsemmens
Level 11
Level 11
Posts: 3936
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Hotkey to Close the Current Window

Post by lsemmens »

Time was when the only keyboard shortcut you needed to know was the old "three finger salute" or <Ctrl> <Alt> <Del> to terminate a process when Windows wouldn't behave. Haven't needed that since the move to Linux. :D
Fully mint Household
Out of my mind - please leave a message
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Hotkey to Close the Current Window

Post by catweazel »

lsemmens wrote: Mon Jul 02, 2018 9:40 pm Time was when the only keyboard shortcut you needed to know was the old "three finger salute" or <Ctrl> <Alt> <Del> to terminate a process when Windows wouldn't behave. Haven't needed that since the move to Linux. :D
KDE uses it to offer logout/shutdown options. Presumably other DEs do the same.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
MtnDewManiac
Level 6
Level 6
Posts: 1491
Joined: Fri Feb 22, 2013 5:18 pm
Location: United States

Re: Hotkey to Close the Current Window

Post by MtnDewManiac »

catweazel wrote: Mon Jul 02, 2018 9:49 pm
lsemmens wrote: Mon Jul 02, 2018 9:40 pm Time was when the only keyboard shortcut you needed to know was the old "three finger salute" or <Ctrl> <Alt> <Del> to terminate a process when Windows wouldn't behave. Haven't needed that since the move to Linux. :D
KDE uses it to offer logout/shutdown options. Presumably other DEs do the same.
I just tried it in Xfce (I believe this is my Mint 17.3 partition). The screen slowly faded to black. I waited a few more seconds, then pressed any key (lol) - and some archaic-looking window popped up, which required me to enter my password. After doing so, I got my system back. I assume, in Xfce, this keyboard combination is a shortcut for locking the computer without logging out or something?

I had previously thought that I could use that combination to run the task manager application included with Xfce. Apparently, I was mistaken.



Regards,
MDM
Mint 18 Xfce 4.12.

If guns kill people, then pencils misspell words, cars make people drive drunk, and spoons made Rosie O'Donnell fat.
Locked

Return to “Xfce”