* How bind "Super" key *all by itself* to a function?
@ 2015-01-19 6:57 Chris Seberino
2015-01-19 7:16 ` Yuri Khan
[not found] ` <mailman.18124.1421651779.1147.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Chris Seberino @ 2015-01-19 6:57 UTC (permalink / raw)
To: help-gnu-emacs
I'm on a Linux machine and would like to bind
the "Super" key all by itself to a function of my choosing.
This works for Super + "b":
(global-set-key (kbd "s-b") 'backward-word)
(Source: http://ergoemacs.org/emacs/emacs_hyper_super_keys.html)
However, how would you do something similar for ONLY the Super key
ALL BY ITSELF???
I tried (global-set-key (kbd "s") 'backward-word)
but then all I'm doing is rebinding the literal "s" which isn't my intention.
(I want to bind another function besides backward-word but that's just a
hypothetical example.)
(I asked a similar question on a list regarding the converting the Windows key to a meta key which led to special problems I'm hoping to avoid now by NOT trying to make Super a meta key.)
cs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How bind "Super" key *all by itself* to a function?
2015-01-19 6:57 How bind "Super" key *all by itself* to a function? Chris Seberino
@ 2015-01-19 7:16 ` Yuri Khan
[not found] ` <mailman.18124.1421651779.1147.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Yuri Khan @ 2015-01-19 7:16 UTC (permalink / raw)
To: Chris Seberino; +Cc: help-gnu-emacs@gnu.org
On Mon, Jan 19, 2015 at 12:57 PM, Chris Seberino <cseberino@gmail.com> wrote:
> I'm on a Linux machine and would like to bind
> the "Super" key all by itself to a function of my choosing.
You are probably not going to achieve that while keeping it as the
Super key or any modifier key for that matter.
However, you can use XKB (in X) and/or loadkeys (in tty) to map the
Windows key to produce a different keycode such as F13, and then bind
that to any function you like.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How bind "Super" key *all by itself* to a function?
[not found] ` <mailman.18124.1421651779.1147.help-gnu-emacs@gnu.org>
@ 2015-01-19 7:35 ` Rusi
2015-01-19 8:25 ` Yuri Khan
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Rusi @ 2015-01-19 7:35 UTC (permalink / raw)
To: help-gnu-emacs
On Monday, January 19, 2015 at 12:46:21 PM UTC+5:30, Yuri Khan wrote:
> On Mon, Jan 19, 2015 at 12:57 PM, Chris Seberino wrote:
>
> > I'm on a Linux machine and would like to bind
> > the "Super" key all by itself to a function of my choosing.
>
> You are probably not going to achieve that while keeping it as the
> Super key or any modifier key for that matter.
>
> However, you can use XKB (in X) and/or loadkeys (in tty) to map the
> Windows key to produce a different keycode such as F13, and then bind
> that to any function you like.
Do you have a simple howto on that? [XKB]
With xmodmap it was at least conceivable
Xkb is too much of a dragon
eg Say I have a broken ~ key and I want to make F12 generate ~
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How bind "Super" key *all by itself* to a function?
2015-01-19 7:35 ` Rusi
@ 2015-01-19 8:25 ` Yuri Khan
2015-01-19 9:08 ` Yuri Khan
[not found] ` <mailman.18131.1421658484.1147.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 8+ messages in thread
From: Yuri Khan @ 2015-01-19 8:25 UTC (permalink / raw)
To: Rusi; +Cc: help-gnu-emacs@gnu.org
On Mon, Jan 19, 2015 at 1:35 PM, Rusi <rustompmody@gmail.com> wrote:
> On Monday, January 19, 2015 at 12:46:21 PM UTC+5:30, Yuri Khan wrote:
>> On Mon, Jan 19, 2015 at 12:57 PM, Chris Seberino wrote:
>>
>> > I'm on a Linux machine and would like to bind
>> > the "Super" key all by itself to a function of my choosing.
>>
>> You are probably not going to achieve that while keeping it as the
>> Super key or any modifier key for that matter.
>>
>> However, you can use XKB (in X) and/or loadkeys (in tty) to map the
>> Windows key to produce a different keycode such as F13, and then bind
>> that to any function you like.
>
> Do you have a simple howto on that? [XKB]
> With xmodmap it was at least conceivable
> Xkb is too much of a dragon
>
> eg Say I have a broken ~ key and I want to make F12 generate ~
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How bind "Super" key *all by itself* to a function?
2015-01-19 7:35 ` Rusi
2015-01-19 8:25 ` Yuri Khan
@ 2015-01-19 9:08 ` Yuri Khan
[not found] ` <mailman.18131.1421658484.1147.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 8+ messages in thread
From: Yuri Khan @ 2015-01-19 9:08 UTC (permalink / raw)
To: Rusi; +Cc: help-gnu-emacs@gnu.org
[Damn Gmail. Its Send button is too near the “show quote” button and
too high-contrast.]
On Mon, Jan 19, 2015 at 1:35 PM, Rusi <rustompmody@gmail.com> wrote:
>> However, you can use XKB (in X) and/or loadkeys (in tty) to map the
>> Windows key to produce a different keycode such as F13, and then bind
>> that to any function you like.
>
> Do you have a simple howto on that? [XKB]
> With xmodmap it was at least conceivable
> Xkb is too much of a dragon
>
> eg Say I have a broken ~ key and I want to make F12 generate ~
Not quite qualifies as “simple” but not very complicated.
* Find the XKB data directory. [Normally, this is /usr/share/X11/xkb.]
* In its “keycodes” subdirectory, create a file that is unlikely to be
overwritten by a future version of XKB (e.g. by prefixing it with your
initials). [Let’s name it “rusi” for the sake of this example.]
* In this file, paste the following:
===
xkb_keycodes "f12tilde" {
# remappings go here…
};
# you can have multiple remapping sections
# and activate any subset thereof, just add more
# xkb_keycodes "some_name" {
# # …
# };
===
Each remapping takes the form: <KEYNAME> = KEYCODE;
Refer to the existing entries in the section “default xkb_keycodes
"evdev"” for key names and codes.
For keyname, find the name of the key you want to generate. In your
case, it’s <TLDE>.
For keycode, find the numeric code of the key you want to remap. In
your case, it’s the code which is normally bound to <FK12>, namely,
96.
So:
===
<TLDE> = 96;
===
* Now that you have a keycodes section of your own, make a
corresponding option. In the rules/evdev file, find the following
header:
===
! option = keycodes
===
In that section, add something like:
===
rusi:f12tilde = +rusi(f12tilde)
===
Here, the form on the right refers to the keycodes filename and
section, and the name on the left specifies the option name.
* Next, you want your X server to pick up this option. You can do it
system-wide or per-user; I’ll describe the system-wide setup because I
find it easier and less DE-specific.
* In the /usr/share/X11/xorg.conf.d directory [or its equivalent on
your system], create a uniquely named file [e.g.
11-rusi-keycodes.conf]:
===
Section "InputClass"
Identifier "Keyboard layouts"
Driver "evdev"
Option "XkbOptions" "rusi:f12tilde"
Option "AutoServerLayout" "on"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
EndSection
===
In the XkbOptions line, refer to the option name you added to rules/evdev.
Next time you boot X or plug in a keyboard, it should use your customization.
You can check the current set of XKB options by executing the
following command in a terminal emulator within an X session:
$ setxkbmap -query
----
Legend has it that there is a possibility of using xkbcomp(1) on a
user-specific configuration file, but I never learned that;
system-wide is good enough for me.
One caveat: whenever you update the package that contains the
rules/evdev file, it may be overwritten and you might have to re-add
your option line.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How bind "Super" key *all by itself* to a function?
[not found] ` <mailman.18131.1421658484.1147.help-gnu-emacs@gnu.org>
@ 2015-01-19 13:54 ` Rusi
2015-01-19 14:33 ` Rusi
1 sibling, 0 replies; 8+ messages in thread
From: Rusi @ 2015-01-19 13:54 UTC (permalink / raw)
To: help-gnu-emacs
On Monday, January 19, 2015 at 2:38:06 PM UTC+5:30, Yuri Khan wrote:
> [Damn Gmail. Its Send button is too near the "show quote" button and
> too high-contrast.]
>
> On Mon, Jan 19, 2015 at 1:35 PM, Rusi wrote:
>
> >> However, you can use XKB (in X) and/or loadkeys (in tty) to map the
> >> Windows key to produce a different keycode such as F13, and then bind
> >> that to any function you like.
> >
> > Do you have a simple howto on that? [XKB]
> > With xmodmap it was at least conceivable
> > Xkb is too much of a dragon
> >
> > eg Say I have a broken ~ key and I want to make F12 generate ~
>
> Not quite qualifies as "simple" but not very complicated.
>
> * Find the XKB data directory. [Normally, this is /usr/share/X11/xkb.]
> * In its "keycodes" subdirectory, create a file that is unlikely to be
> overwritten by a future version of XKB (e.g. by prefixing it with your
> initials). [Let's name it "rusi" for the sake of this example.]
> * In this file, paste the following:
>
> ===
> xkb_keycodes "f12tilde" {
> # remappings go here...
> };
>
> # you can have multiple remapping sections
> # and activate any subset thereof, just add more
> # xkb_keycodes "some_name" {
> # # ...
> # };
> ===
>
> Each remapping takes the form: <KEYNAME> = KEYCODE;
>
> Refer to the existing entries in the section "default xkb_keycodes
> "evdev"" for key names and codes.
>
> For keyname, find the name of the key you want to generate. In your
> case, it's <TLDE>.
>
> For keycode, find the numeric code of the key you want to remap. In
> your case, it's the code which is normally bound to <FK12>, namely,
> 96.
>
> So:
>
> ===
> <TLDE> = 96;
> ===
>
> * Now that you have a keycodes section of your own, make a
> corresponding option. In the rules/evdev file, find the following
> header:
>
> ===
> ! option = keycodes
> ===
>
> In that section, add something like:
>
> ===
> rusi:f12tilde = +rusi(f12tilde)
> ===
>
> Here, the form on the right refers to the keycodes filename and
> section, and the name on the left specifies the option name.
>
> * Next, you want your X server to pick up this option. You can do it
> system-wide or per-user; I'll describe the system-wide setup because I
> find it easier and less DE-specific.
> * In the /usr/share/X11/xorg.conf.d directory [or its equivalent on
> your system], create a uniquely named file [e.g.
> 11-rusi-keycodes.conf]:
>
> ===
> Section "InputClass"
> Identifier "Keyboard layouts"
> Driver "evdev"
> Option "XkbOptions" "rusi:f12tilde"
> Option "AutoServerLayout" "on"
> MatchIsKeyboard "on"
> MatchDevicePath "/dev/input/event*"
> EndSection
> ===
>
> In the XkbOptions line, refer to the option name you added to rules/evdev.
>
> Next time you boot X or plug in a keyboard, it should use your customization.
>
> You can check the current set of XKB options by executing the
> following command in a terminal emulator within an X session:
>
> $ setxkbmap -query
>
> ----
>
> Legend has it that there is a possibility of using xkbcomp(1) on a
> user-specific configuration file, but I never learned that;
> system-wide is good enough for me.
>
> One caveat: whenever you update the package that contains the
> rules/evdev file, it may be overwritten and you might have to re-add
> your option line.
You are my sweetheart!
Its going to take me some time to figure this out but
as you may see from my last blog-post
http://blog.languager.org/2015/01/unicode-and-universe.html
I am currently fascinated by being able to type unicode
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How bind "Super" key *all by itself* to a function?
[not found] ` <mailman.18131.1421658484.1147.help-gnu-emacs@gnu.org>
2015-01-19 13:54 ` Rusi
@ 2015-01-19 14:33 ` Rusi
2015-01-19 15:32 ` Yuri Khan
1 sibling, 1 reply; 8+ messages in thread
From: Rusi @ 2015-01-19 14:33 UTC (permalink / raw)
To: help-gnu-emacs
On Monday, January 19, 2015 at 2:38:06 PM UTC+5:30, Yuri Khan wrote:
> [Damn Gmail. Its Send button is too near the "show quote" button and
> too high-contrast.]
>
> On Mon, Jan 19, 2015 at 1:35 PM, Rusi wrote:
>
> >> However, you can use XKB (in X) and/or loadkeys (in tty) to map the
> >> Windows key to produce a different keycode such as F13, and then bind
> >> that to any function you like.
> >
> > Do you have a simple howto on that? [XKB]
> > With xmodmap it was at least conceivable
> > Xkb is too much of a dragon
> >
> > eg Say I have a broken ~ key and I want to make F12 generate ~
>
> Not quite qualifies as "simple" but not very complicated.
>
> * Find the XKB data directory. [Normally, this is /usr/share/X11/xkb.]
> * In its "keycodes" subdirectory, create a file that is unlikely to be
> overwritten by a future version of XKB (e.g. by prefixing it with your
> initials). [Let's name it "rusi" for the sake of this example.]
> * In this file, paste the following:
>
> ===
> xkb_keycodes "f12tilde" {
> # remappings go here...
> };
>
> # you can have multiple remapping sections
> # and activate any subset thereof, just add more
> # xkb_keycodes "some_name" {
> # # ...
> # };
> ===
>
> Each remapping takes the form: <KEYNAME> = KEYCODE;
>
> Refer to the existing entries in the section "default xkb_keycodes
> "evdev"" for key names and codes.
>
> For keyname, find the name of the key you want to generate. In your
> case, it's <TLDE>.
>
> For keycode, find the numeric code of the key you want to remap. In
> your case, it's the code which is normally bound to <FK12>, namely,
> 96.
>
> So:
>
> ===
> <TLDE> = 96;
> ===
>
> * Now that you have a keycodes section of your own, make a
> corresponding option. In the rules/evdev file, find the following
> header:
>
> ===
> ! option = keycodes
> ===
>
> In that section, add something like:
>
> ===
> rusi:f12tilde = +rusi(f12tilde)
> ===
>
> Here, the form on the right refers to the keycodes filename and
> section, and the name on the left specifies the option name.
>
> * Next, you want your X server to pick up this option. You can do it
> system-wide or per-user; I'll describe the system-wide setup because I
> find it easier and less DE-specific.
> * In the /usr/share/X11/xorg.conf.d directory [or its equivalent on
> your system], create a uniquely named file [e.g.
> 11-rusi-keycodes.conf]:
>
> ===
> Section "InputClass"
> Identifier "Keyboard layouts"
> Driver "evdev"
> Option "XkbOptions" "rusi:f12tilde"
> Option "AutoServerLayout" "on"
> MatchIsKeyboard "on"
> MatchDevicePath "/dev/input/event*"
> EndSection
> ===
>
> In the XkbOptions line, refer to the option name you added to rules/evdev.
>
> Next time you boot X or plug in a keyboard, it should use your customization.
>
> You can check the current set of XKB options by executing the
> following command in a terminal emulator within an X session:
>
> $ setxkbmap -query
>
> ----
!WORKS!
So where does one get initiated into the school of black art?
ie how do I figure out what those incantations mean?
One of my problems is how to debug:
If some small thing goes wrong and it does not work... where to start looking?
>
> Legend has it that there is a possibility of using xkbcomp(1) on a
> user-specific configuration file, but I never learned that;
> system-wide is good enough for me.
>
> One caveat: whenever you update the package that contains the
> rules/evdev file, it may be overwritten and you might have to re-add
> your option line.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How bind "Super" key *all by itself* to a function?
2015-01-19 14:33 ` Rusi
@ 2015-01-19 15:32 ` Yuri Khan
0 siblings, 0 replies; 8+ messages in thread
From: Yuri Khan @ 2015-01-19 15:32 UTC (permalink / raw)
To: Rusi; +Cc: help-gnu-emacs@gnu.org
On Mon, Jan 19, 2015 at 8:33 PM, Rusi <rustompmody@gmail.com> wrote:
> !WORKS!
>
> So where does one get initiated into the school of black art?
> ie how do I figure out what those incantations mean?
Oh, I’ll tell you where. Former Soviet Union, or Bulgaria, or Greece,
or any other country with a non-Latin alphabet. Basically, until you
figure out at least how to have two layouts loaded and switch them
with a single keystroke, your computer pretty much “just does not
work”. Well, it kinda works, you just can’t type any text.
[These days, there is also ibus, which gives an illusion of easy
configuration. Avoid.]
Seriously, though, there’s Ivan Pascal’s guide[1], there’s Doug
Palmer’s Unreliable Guide to XKB Configuration[2], Michał Kosmulski’s
guide[3], and not much more. And also abstracting from existing
configuration.
[1]: http://pascal.tsu.ru/en/xkb/setup.html
[2]: http://www.charvolant.org/~doug/xkb/html/index.html
[3]: http://michal.kosmulski.org/computing/articles/custom-keyboard-layouts-xkb.html
> One of my problems is how to debug:
> If some small thing goes wrong and it does not work... where to start looking?
If some small thing goes wrong, you’re screwed :-> You boot X, are
greeted by a cryptic error message; if lucky, the base configuration
still works and you get to fix things without having to use a
different input system (e.g. switching to tty1).
I’ve got my share of such b0rks and in many cases it was something
small like a missing semicolon or a mistyped something. The kind of
mistakes you can look for and not see for hours. And, to add insult to
injury, XKB caches its compiled data, so when you fix the cause of the
problem and just re-login, it still does not work until you drop the
cache. [Hint: sudo rm /var/lib/xkb/*.xkm and then re-login.]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-01-19 15:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-19 6:57 How bind "Super" key *all by itself* to a function? Chris Seberino
2015-01-19 7:16 ` Yuri Khan
[not found] ` <mailman.18124.1421651779.1147.help-gnu-emacs@gnu.org>
2015-01-19 7:35 ` Rusi
2015-01-19 8:25 ` Yuri Khan
2015-01-19 9:08 ` Yuri Khan
[not found] ` <mailman.18131.1421658484.1147.help-gnu-emacs@gnu.org>
2015-01-19 13:54 ` Rusi
2015-01-19 14:33 ` Rusi
2015-01-19 15:32 ` Yuri Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).