You are not logged in.

#1 2011-02-28 15:15:35

spunkiie
Member
Registered: 2010-07-06
Posts: 15

[SOLVED] Xmodmap question...

Hi,

I'm trying to use 'xmodmap' so i can map 'ESCAPE' to work as ALT+F4 (close window). Google'd it a lot without success..

Anyone know if its possible ?

BTW: I know i can easily do this under GNOME/KDE, but i need to use xmodmap.

TIA

Last edited by spunkiie (2011-03-03 15:27:24)

Offline

#2 2011-03-01 03:26:40

escondida
Trusted User (TU)
Registered: 2008-04-03
Posts: 157

Re: [SOLVED] Xmodmap question...

This sounds like something better configured into your window manager's keybindings. What exactly are you trying to do that would require xmodmap for this instead?

Offline

#3 2011-03-01 13:09:55

btitus
Member
Registered: 2010-09-29
Posts: 6

Re: [SOLVED] Xmodmap question...

Not sure if xmodmap can be used to make <escape> work like Alt + another key, though you could make <escape> work like Alt OR make it work like another key.
BUT, at least in XFCE, it is possible to redefine they keys which do commands like closing windows. One place is in settings > keyboard > application shortcuts.
The other place is settings > window manager > keyboard, and here you can specify what keys will close a window, etc.

Here are some things I found useful for xmodmap, but this may not be relevant to what you want to do.
First, a good source of info = the man pages for xmodmap, i.e. type

 man xmodmap  

Once you have modified the keymap with commands in a file called (say) .xmodrc, you can load it at each boot, or load it for the current session by typing the command in a console. I use a command like this in my .xinitrc file:

xmodmap ~/.xmodrc    

Also useful: xmodmap -pke, xmodmap -pm (for modifier map) to see current mappings & modifier map. If you save the output from these, "diff" is useful for finding differences.
Clarification: these are two separate commands, like this:

xmodmap -pke
#output deleted
xmodmap -pm

For changing alt- keys, you may have to change the modifier map, perhaps like this:

clear mod1
#and later, after modifying bindings:
add mod1 = Alt_L
add mod1 = Alt_R   

You can use xev to check key bindings.
Generally, I find it less confusing to use the "keycode" command rather than keysyms.

Last edited by btitus (2011-03-01 13:44:10)

Offline

#4 2011-03-01 16:59:27

spunkiie
Member
Registered: 2010-07-06
Posts: 15

Re: [SOLVED] Xmodmap question...

I need to use only Xorg internal functions cuz i'm *not* using a DE or even a WM. I'm only running the Xorg server and the application (i.e: running application directly from xinitrc)

anyone ?

Offline

#5 2011-03-01 17:10:31

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [SOLVED] Xmodmap question...

Applications on Linux do not use Alt+F4, it is just a binding in your DE that kills the active window.

What you want is xbindkeys and put this in your .xbindkeysrc:

"xkill"
    Escape

Which turns your mouse pointer in a crosshair which will close a window.

Killing the active window is a bit trickier:

"xkill -id $(xprop -root | grep NET_ACTIVE_WINDOW\( | cut -d# -f2)"
    Escape

Last edited by Procyon (2011-03-01 17:11:14)

Offline

#6 2011-03-01 17:18:17

spunkiie
Member
Registered: 2010-07-06
Posts: 15

Re: [SOLVED] Xmodmap question...

Procyon,

Thanks for the tip.. i was trying with xvkbd without success:

"xvkbd -text "\A\[F4]" "
    m:0x0 + c:9

Will try your tip now

Offline

#7 2011-03-03 15:26:57

spunkiie
Member
Registered: 2010-07-06
Posts: 15

Re: [SOLVED] Xmodmap question...

Solved... TY guys

Offline

Board footer

Powered by FluxBB