Re-inserting keystrokes as X events for client

Hi all,
Is there a way to re-insert the original keystroke as an X event for the
currently focused client in response to a keybinding?
Basically I want to do a keybindings along these lines:
((controlMask, xK_t), submap . M.fromList $
[ ((0, xK_r), whatever)
, ((0, xK_f), whatever)
...
, ((0, xK_t), <re-send the original keystroke to the focused client>)
])
so that I essentially have a "prefix" key of C-t for all my rarely used
xmonad commands, but if I need to actually send a C-t to the client I
can still do so by pressing C-t twice.
(I've tried searching around for an answer to this but my Google-fu
seems to be lacking.)
Cheers,
--
Bardur Arantsson

On Thu, Sep 11, 2008 at 08:59:08AM +0200, Bárður Árantsson wrote:
Hi all,
Is there a way to re-insert the original keystroke as an X event for the currently focused client in response to a keybinding?
Basically I want to do a keybindings along these lines:
((controlMask, xK_t), submap . M.fromList $ [ ((0, xK_r), whatever) , ((0, xK_f), whatever) ... , ((0, xK_t), <re-send the original keystroke to the focused client>) ])
so that I essentially have a "prefix" key of C-t for all my rarely used xmonad commands, but if I need to actually send a C-t to the client I can still do so by pressing C-t twice.
(I've tried searching around for an answer to this but my Google-fu seems to be lacking.)
Cheers,
-- Bardur Arantsson
- You don't exist. I've killed you. Jill Layton is dead. - Care for a little necrophilia? Sam Lowry and Jill Layton / Brazil
It is possible, but I don't think the code is written. What you want to do is construct a XKeyEvent and send it to the focused window with XSendEvent (bound in Haskell as sendEvent). Cheers, Spencer Janssen

On Thu, Sep 11, 2008 at 08:59:08AM +0200, Bárður Árantsson wrote:
Is there a way to re-insert the original keystroke as an X event for the currently focused client in response to a keybinding?
Basically I want to do a keybindings along these lines:
((controlMask, xK_t), submap . M.fromList $ [ ((0, xK_r), whatever) , ((0, xK_f), whatever) ... , ((0, xK_t), <re-send the original keystroke to the focused client>) ])
so that I essentially have a "prefix" key of C-t for all my rarely used xmonad commands, but if I need to actually send a C-t to the client I can still do so by pressing C-t twice.
(I've tried searching around for an answer to this but my Google-fu seems to be lacking.)
See the "Ratpoison key emulation" thread: http://www.haskell.org/pipermail/xmonad/2008-July/005954.html Cheers, -- Jérémy Bobbio .''`. lunar@debian.org : :Ⓐ : # apt-get install anarchism `. `'` `-

Jérémy Bobbio wrote:
On Thu, Sep 11, 2008 at 08:59:08AM +0200, Bárður Árantsson wrote:
Is there a way to re-insert the original keystroke as an X event for the currently focused client in response to a keybinding?
Basically I want to do a keybindings along these lines:
((controlMask, xK_t), submap . M.fromList $ [ ((0, xK_r), whatever) , ((0, xK_f), whatever) ... , ((0, xK_t), <re-send the original keystroke to the focused client>) ])
so that I essentially have a "prefix" key of C-t for all my rarely used xmonad commands, but if I need to actually send a C-t to the client I can still do so by pressing C-t twice.
(I've tried searching around for an answer to this but my Google-fu seems to be lacking.)
See the "Ratpoison key emulation" thread: http://www.haskell.org/pipermail/xmonad/2008-July/005954.html
Cheers,
Thanks for that link. Looks very promising, but I can't for the life of
me figure out where to get setKeyEvent from.
A search suggests that it should be in Graphics.X11.Xlib.Extras, but it
doesn't seem to be exported from there (I have the 1.4.2 version of the
X11 module installed).
Cheers,
--
Bardur Arantsson

On 2008.09.11 19:44:01 +0200, Bárður Árantsson
Jérémy Bobbio wrote:
On Thu, Sep 11, 2008 at 08:59:08AM +0200, Bárður Árantsson wrote:
Is there a way to re-insert the original keystroke as an X event for the currently focused client in response to a keybinding?
Basically I want to do a keybindings along these lines:
((controlMask, xK_t), submap . M.fromList $ [ ((0, xK_r), whatever) , ((0, xK_f), whatever) ... , ((0, xK_t), <re-send the original keystroke to the focused client>) ])
so that I essentially have a "prefix" key of C-t for all my rarely used xmonad commands, but if I need to actually send a C-t to the client I can still do so by pressing C-t twice.
(I've tried searching around for an answer to this but my Google-fu seems to be lacking.)
See the "Ratpoison key emulation" thread: http://www.haskell.org/pipermail/xmonad/2008-July/005954.html
Cheers,
Thanks for that link. Looks very promising, but I can't for the life of me figure out where to get setKeyEvent from.
A search suggests that it should be in Graphics.X11.Xlib.Extras, but it doesn't seem to be exported from there (I have the 1.4.2 version of the X11 module installed).
Cheers,
-- Bardur Arantsson
Perhaps your installation is not good? I have 1.4.2 installed as well, and it seems to exist fine: Prelude> :m Graphics.X11.Xlib.Extras Prelude Graphics.X11.Xlib.Extras> :t setKeyEvent setKeyEvent :: Graphics.X11.Xlib.Event.XEventPtr -> Graphics.X11.Types.Window -> Graphics.X11.Types.Window -> Graphics.X11.Types.Window -> Graphics.X11.Types.KeyMask -> Graphics.X11.Types.KeyCode -> Bool -> IO () gwern@craft:20746~>ghc-pkg list X11 [ 4:41PM] /usr/lib/ghc-6.8.2/package.conf: X11-1.4.2 /home/gwern/.ghc/x86_64-linux-6.8.2/package.conf: X11-1.4.2 (I suppose it's possible things were changed after the version was changed to 1.4.2, but the cabal version hasn't been bumped; I'd try installing from darcs http://darcs.haskell.org/X11 and seeing whether it changes.) -- gwern device Pox sulphate Elvis Oz. SAP 2E781 HERF H.N.P. Archives

Bárður Árantsson
Is there a way to re-insert the original keystroke as an X event for the currently focused client in response to a keybinding?
See http://thread.gmane.org/gmane.comp.lang.haskell.xmonad/5694 -- Cheers, Feri.
participants (5)
-
Bárður Árantsson
-
Ferenc Wagner
-
Gwern Branwen
-
Jérémy Bobbio
-
Spencer Janssen