rlopez1j / xmonad

Automatically exported from code.google.com/p/xmonad
0 stars 0 forks source link

Key bindings should be showable #182

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In order to support a popup display of the current keybindings, we need to
be able to show key bindings, and their associated docs, in a nice format.

This is important for new users, and encouraging adoption.

Original issue reported on code.google.com by don...@gmail.com on 19 Apr 2008 at 7:34

GoogleCodeExporter commented 9 years ago
As a wrapper around the XConfig, the attached contrib patch offers some of the
features requested here. The results are readable, but not too pretty with
xmessage (ex.  no alignment of columns, no cheatsheet drawn like
http://haskell.org/haskellwiki/Image:Xmbindings.png).

As an addition to the core, I'm not sure which way is best for preserving the
backwards-compatibility:
    1. Change XConfig to have
         keys :: NamedAction a => XConfig Layout -> Map (ButtonMask, KeySym) a
       and then keep the old defaultConfig, but have a new
       defaultNamedKeyConfig that uses a different representation that keeps
       the descriptions (and possibly ordering and sectioning, since that is
       lost in the Map). Results in more puzzling type errors if ex (1+1) is
       the only action that is bound.
    2. Add yet another record field to XConfig that contains actions with the
       new style.
    3. Show just the builtin keybindings already done, except for the
       keybindings for it

Original comment by vogt.a...@gmail.com on 12 Apr 2009 at 8:04

Attachments:

GoogleCodeExporter commented 9 years ago
Issue 489 has been merged into this issue.

Original comment by daniel.s...@googlemail.com on 24 Dec 2011 at 3:26

GoogleCodeExporter commented 9 years ago
I vote for #3. #1 and 2 both look like they will break extensions, configs, or 
both, and people simply don't care about newbie documentation enough to support 
breakage just for their sake. #3 avoids this, so actually has a chance of 
getting consensus.

Simplest would just be binding M-? to xmessage with a large static string 
specifying the defaults. Zero breakage\* and the newbies get the documentation 
they need; people customizing their config already know what keys they modified.

Technically, we'd have to update it every time we change the default bindings. 
As far as I can tell, the last time a binding was added or removed (rather than 
fixed or improved), was almost four years ago, in March 2008 when Spencer 
commented out M-b which was some sort of toolbar-gap-toggle.

This seems like an improvement to me.

\* anyone binding M-? in their existing config will be overriding the default 
keymap and so will not be affected. And as far as I can tell, no one *does* - 
in the XMonad config archive are only two hits for `xK_slash`, both of which 
are not shifted and so not question-mark bindings.

Original comment by gwe...@gmail.com on 24 Dec 2011 at 3:40

GoogleCodeExporter commented 9 years ago
Aye, #3 simply show defaults.

Assuming it's not a portability nightmare, it might be
better to open the XConfig terminal and echo the
bindings there. It would be more readable and leave
the user a terminal to work with afterward.

I don't think any solution chosen has to be too
perfect. Good enough is good enough.

For example, the terminal may not be installed, but
then again, XMessage may not be installed. And
whatever key is chosen people may not think to use it
till they've been told to. (Personally I'd never have
thought of M-?. But I don't want to muddy
the waters; that binding's fine with me.)

So first person to submit a reasonable patch gets my
vote, however it's implemented on whatever binding.

Original comment by wirtwo...@gmail.com on 24 Dec 2011 at 5:59

GoogleCodeExporter commented 9 years ago
Some more thoughts.

1. When you start "ratpoison" (another tiling manager) you see in the left 
corner a message "Welcome to ratpoison! Press Alt-? to list available 
commands". 
2. Later I can disable such start message in ratpoison config file.
3. This http://haskell.org/haskellwiki/Image:Xmbindings.png image won't be very 
helpfull. Newbie searches a hotkey *for an action*, not an action *for a 
hotkey*.
4. Cheatsheet is required mostly for newbies, so default keybindings are enough 
to list in, imho.

Glad, if this user-point-of-view will help!

Original comment by abcz2.up...@gmail.com on 24 Dec 2011 at 7:13

GoogleCodeExporter commented 9 years ago
A wild gues is that mod-? I won't work on international keyboards as '?' has 
nothing to do with 'shift-xK_slas' on a danish keyboard. In general there are 
some issues with multiple layouts etc that xmonad doesn't handle that we'll. 

Original comment by jesper.reenberg on 24 Dec 2011 at 8:35

GoogleCodeExporter commented 9 years ago
Increasingly Linux distributions are not installing xmessage by default.  (This 
may warrant being a separate bug as well, since it affects reporting errors on 
mod-q.)

Original comment by allber...@gmail.com on 24 Dec 2011 at 9:41

GoogleCodeExporter commented 9 years ago
I don't think that gwern suggested to bind it to shift+xK_slash, he just 
checked to see if someone bound '?' "indirectly" instead of using just 
xK_question, which would probably work on all layouts with a question mark.

Original comment by daniel.s...@googlemail.com on 24 Dec 2011 at 9:43

GoogleCodeExporter commented 9 years ago
Well, no one seems to bind xK_question either.

I've put together a definition. It works the obvious way: I took the keymap and 
edited it by hand into a table of the bindings and their Haddock description, 
used the `unlines` idiom, and piped it into xmessage (best way to preserve the 
newlines, I found).

you can see it run from GHCi here: http://i.imgur.com/4J2VG.png (Looks the same 
with the binding.)

Confusingly, it doesn't seem to work for me with xK_question, but it *does* 
work with xK_slash, suggesting Daniel is wrong about it probably just working.

So we can either just accept that - hardly worse than xmessage being missing on 
Ubuntu - or maybe we could bind both shift-/ and ?. I don't know if we can do 
that, I've never wanted to do it before.

The patch is attached.

Original comment by gwe...@gmail.com on 13 Jan 2012 at 12:06

Attachments:

GoogleCodeExporter commented 9 years ago
On US keyboards, xmonad will not see xK_question because that is not bound 
directly; instead, programs get "?" from XLookupString(ShiftMask, XK_slash).  
On some other keyboards, xK_question is the directly bound key.

Original comment by allber...@gmail.com on 13 Jan 2012 at 12:19

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Repeating is kind of ugly, but if we must, we must. Amended patch attached. 
Compiles, haven't tested.

Original comment by gwe...@gmail.com on 13 Jan 2012 at 1:07

Attachments:

GoogleCodeExporter commented 9 years ago
I applied gwern's #12 a couple weeks ago. It is included in 0.11.

There's sort of some redundancy with contrib module X.A.NamedActions. I'm not 
sure anybody uses that contrib module, since people probably learn the 
important keybindings before they look through contrib.

Original comment by vogt.a...@gmail.com on 1 Jan 2013 at 2:58

GoogleCodeExporter commented 9 years ago
Adam, fwiw I actually use X.A.NamedActions heavily, but I'm happy if there is 
now native support for documented key bindings.

Just for the sake of use-case documentation: I'd consider myself an 
intermediate level XMonad user (using XMonad for several years now) and I 
customize my keybindings heavily and iterate regularly. NamedActions (and 
hopefully the new system as well) makes it easier for me to change the bindings 
to a new/experimental set and memorize them quickly.

-Ethan

Original comment by e...@ethanschoonover.com on 13 Jan 2013 at 2:24