Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 02, 2016, 08:29:13 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: Universal behavior for Ctrl-W  (Read 3512 times)

loopernow

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 3
    • View Profile
    • Donate to Member
IDEA: Universal behavior for Ctrl-W
« on: January 13, 2007, 07:18:53 PM »
I like the way Ctrl-W works in Firefox. It closes the current tab, but if there's only one tab open, it closes the whole Firefox window.

In Adobe products, Ctrl-W closes child windows but not the main program window.

Ctrl-W will close Explorer windows, but in many other programs, you have to use some other hotkey. I find myself trying to use Ctrl-W in other programs and getting frustrated when it doesn't work. I know about Alt-F4 but Ctrl-W is an easier combination to reach for.

Would it be possible to make a program that made Ctrl-W always work the way it does in Firefox? That is, no matter what program you were in, Ctrl-W would first close active child windows or tabs, then it would close the main program window. If the program only had one window, it would close that window.

Also, and this part would be optional, would it be possible for this program to:

-detect if the active program has ascribed a different use for Ctrl-W
-if the active program uses Ctrl-W for something different, pop up a dialog box asking if you want to override the Ctrl-W behavior for this program from now on (in other words, this would allow the Universal Ctrl-W program to update a "override" and "exceptions" list)?

I hope this sounds useful to other people...

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,029
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: IDEA: Universal behavior for Ctrl-W
« Reply #1 on: January 13, 2007, 08:26:29 PM »
It should be pretty easy globally remapping Ctrl+W to Ctrl+F4... adding the "close main app on no  tabs" would take more work, and I dunno if you can do it universally.

Checking if a program already handles Ctrl+W probably isn't that easy either, there's multiple ways a program can choose to handle key input.
- carpe noctem

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 886
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: Universal behavior for Ctrl-W
« Reply #2 on: January 14, 2007, 02:03:18 AM »
 :) In AutoHotkey this should to the trick:

^w::Send,^{F4}

I'll look into finding existing hotkeys.

Skrommel
Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.

loopernow

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 3
    • View Profile
    • Donate to Member
Re: IDEA: Universal behavior for Ctrl-W
« Reply #3 on: January 15, 2007, 03:39:00 PM »
I'm somewhat familiar with Autohotkey but get frustrated quickly when things start to get complex and then subsequently don't work the way I want them to (that's why I thought I should post here  :P)...

...for instance, in this case simply globally remapping Ctrl-W to Alt-F4 would have some undesired consequences, right? That is, in Firefox, it would close an entire Firefox window (regardless of how many tabs are open) instead of closing the active tab first. In Adobe Photoshop (and in other Adobe programs), it would close the main Adobe window, not the active child window first.

So, what I'm thinking of is something like this (imaginary coding language follows):

Line 1 - Ctrl-W key pressed?; if yes, proceed to line 2; if no, repeat line 1
Line 2 - is active window Firefox? if yes, pass the key press to Firefox; if no, proceed to line 3
Line 3 - is active window an Adobe child window? if yes, pass the key press to Adobe; if no, proceed to line 4
Line 4 - close active window; proceed to line 1

I don't know if there's a more elegant way of doing it than hard-coding Firefox and Adobe programs into the program, but that's the only way I know of to make Ctrl-W act slightly differently based on which program is active.

The end result should be that Ctrl-W always closes child windows and tabs first, and then the main program window, no matter what program is active. Globally remapping Ctrl-W to Alt-F4 without making exceptions based on which program is active would destroy this subtlety--instead of closing tabs or child windows, Ctrl-W would just close the main program window "by brute force".

Does that make sense? Sorry if you guys already understand the idea; but from your replies I wasn't sure. The part about detecting if the program already uses Ctrl-W for something else would be nice, especially if it could detect if it is used to close child windows, but I don't know if it's absolutely necessary.


skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 886
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: Universal behavior for Ctrl-W
« Reply #4 on: January 15, 2007, 03:47:20 PM »
 :) No, it's actually mapping Ctrl-W to Ctrl-F4, which closes child windows first.

Skrommel
Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.

loopernow

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 3
    • View Profile
    • Donate to Member
Re: IDEA: Universal behavior for Ctrl-W
« Reply #5 on: January 18, 2007, 11:21:50 PM »
Ah! I thought "Ctrl-F4" was a typo!

:) No, it's actually mapping Ctrl-W to Ctrl-F4, which closes child windows first.