| |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
Description | |||||||||||||||||||||||||||||||||||||
UrgencyHook lets you configure an action to occur when a window demands your attention. (In traditional WMs, this takes the form of "flashing" on your "taskbar." Blech.) | |||||||||||||||||||||||||||||||||||||
Synopsis | |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
Usage | |||||||||||||||||||||||||||||||||||||
To wire this up, first add: import XMonad.Hooks.UrgencyHook to your import list in your config file. Now, you have a decision to make: When a window deems itself urgent, do you want to pop up a temporary dzen bar telling you so, or do you have an existing dzen wherein you would like to highlight urgent workspaces? | |||||||||||||||||||||||||||||||||||||
Pop up a temporary dzen | |||||||||||||||||||||||||||||||||||||
Enable your urgency hook by wrapping your config record in a call to withUrgencyHook. For example: main = xmonad $ withUrgencyHook dzenUrgencyHook { args = ["-bg", "darkgreen", "-xs", "1"] } $ defaultConfig This will pop up a dzen bar for five seconds telling you you've got an urgent window. | |||||||||||||||||||||||||||||||||||||
Highlight in existing dzen | |||||||||||||||||||||||||||||||||||||
In order for xmonad to track urgent windows, you must install an urgency hook. You can use the above dzenUrgencyHook, or if you're not interested in the extra popup, install NoUrgencyHook, as so: main = xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig Now, your XMonad.Hooks.DynamicLog must be set up to display the urgent windows. If you're using the dzen or dzenPP functions from that module, then you should be good. Otherwise, you want to figure out how to set ppUrgents. | |||||||||||||||||||||||||||||||||||||
Useful keybinding | |||||||||||||||||||||||||||||||||||||
You can set up a keybinding to jump to the window that was recently marked urgent. See an example at focusUrgent. | |||||||||||||||||||||||||||||||||||||
Note | |||||||||||||||||||||||||||||||||||||
Note: UrgencyHook installs itself as a LayoutModifier, so if you modify your urgency hook and restart xmonad, you may need to rejigger your layout by hitting mod-shift-space. | |||||||||||||||||||||||||||||||||||||
Example: Setting up irssi + rxvt-unicode | |||||||||||||||||||||||||||||||||||||
This is a commonly asked example. By default, the window doesn't get flagged urgent when somebody messages you in irssi. You will have to configure some things. If you're using different tools than this, your mileage will almost certainly vary. (For example, in Xchat2, it's just a simple checkbox.) | |||||||||||||||||||||||||||||||||||||
Configuring irssi | |||||||||||||||||||||||||||||||||||||
Irssi is not an X11 app, so it can't set the UrgencyHint flag on XWMHints. However, on all console applications is bestown the greatest of all notification systems: the bell. That's right, Ctrl+G, ASCII code 7, echo -e '\a', your friend, the bell. To configure irssi to send a bell when you receive a message: /set beep_msg_level MSGS NOTICES INVITES DCC DCCMSGS HILIGHT Consult your local irssi documentation for more detail. | |||||||||||||||||||||||||||||||||||||
Configuring screen | |||||||||||||||||||||||||||||||||||||
A common way to run irssi is within the lovable giant, screen. Some distros (e.g. Ubuntu) like to configure screen to trample on your poor console applications -- in particular, to turn bell characters into evil, smelly "visual bells." To turn this off, add: vbell off # or remove the existing 'vbell on' line to your .screenrc, or hit C-a C-g within a running screen session for a temporary fix. | |||||||||||||||||||||||||||||||||||||
Configuring rxvt-unicode | |||||||||||||||||||||||||||||||||||||
Rubber, meet road. Urxvt is the gateway between console apps and X11. To tell urxvt to set an UrgencyHint when it receives a bell character, first, have an urxvt version 8.3 or newer, and second, set the following in your .Xdefaults: urxvt.urgentOnBell: true Depending on your setup, you may need to xrdb that. | |||||||||||||||||||||||||||||||||||||
Configuring xmonad | |||||||||||||||||||||||||||||||||||||
Hopefully you already read the section on how to configure xmonad. If not, hopefully you know where to find it. | |||||||||||||||||||||||||||||||||||||
Stuff for your config file: | |||||||||||||||||||||||||||||||||||||
withUrgencyHook :: (LayoutClass l Window, UrgencyHook h) => h -> XConfig l -> XConfig (HandleEvent (WithUrgencyHook h) l) | |||||||||||||||||||||||||||||||||||||
This is the method to enable an urgency hook. It suppresses urgency status for windows that are currently visible. If you'd like to change that behavior, use withUrgencyHookC. | |||||||||||||||||||||||||||||||||||||
withUrgencyHookC :: (LayoutClass l Window, UrgencyHook h) => h -> (WithUrgencyHook h -> WithUrgencyHook h) -> XConfig l -> XConfig (HandleEvent (WithUrgencyHook h) l) | |||||||||||||||||||||||||||||||||||||
If you'd like to configure *when* to trigger the urgency hook, call this function with an extra mutator function. Or, by example: withUrgencyHookC dzenUrgencyHook { ... } (suppressWhen Focused) (Don't type the ..., you dolt.) See documentation on your options at SuppressWhen. | |||||||||||||||||||||||||||||||||||||
suppressWhen :: UrgencyHook h => SuppressWhen -> WithUrgencyHook h -> WithUrgencyHook h | |||||||||||||||||||||||||||||||||||||
See withUrgencyHookC for an example use. suppressWhen is a global configuration option, applicable to all urgency hooks, whereas the stuff inside the { ... } is type-specific. | |||||||||||||||||||||||||||||||||||||
data SuppressWhen | |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
focusUrgent :: X () | |||||||||||||||||||||||||||||||||||||
Focuses the most recently urgent window. Good for what ails ya -- I mean, your keybindings. Example keybinding: , ((modMask , xK_BackSpace), focusUrgent) | |||||||||||||||||||||||||||||||||||||
dzenUrgencyHook :: DzenUrgencyHook | |||||||||||||||||||||||||||||||||||||
Flashes when a window requests your attention and you can't see it. Defaults to a duration of five seconds, and no extra args to dzen. See DzenUrgencyHook. | |||||||||||||||||||||||||||||||||||||
data DzenUrgencyHook | |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
seconds :: Rational -> Int | |||||||||||||||||||||||||||||||||||||
Multiplies by ONE MILLION, for functions that take microseconds. Use like: (5.5 `seconds`) | |||||||||||||||||||||||||||||||||||||
data NoUrgencyHook | |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
Stuff for developers: | |||||||||||||||||||||||||||||||||||||
readUrgents :: X [Window] | |||||||||||||||||||||||||||||||||||||
X action that returns a list of currently urgent windows. You might use it, or withUrgents, in your custom logHook, to display the workspaces that contain urgent windows. | |||||||||||||||||||||||||||||||||||||
withUrgents :: ([Window] -> X a) -> X a | |||||||||||||||||||||||||||||||||||||
An HOF version of readUrgents, for those who prefer that sort of thing. | |||||||||||||||||||||||||||||||||||||
data StdoutUrgencyHook | |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
newtype SpawnUrgencyHook | |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
class (Read h, Show h) => UrgencyHook h where | |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
Produced by Haddock version 0.8 |