Setting function keys

Asked by Timothy Kendall

Please point me to instructions about how to program ("set") function keys (Ubuntu 12.04). Thank you.

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu xkeyboard-config Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
wojox (wojox) said :
#1

Could you please be more specific Tim?

Revision history for this message
Timothy Kendall (tkendall) said :
#2

Would just like to use function keys for oft-repeated, error-prone
sequences when using the terminal CLI or editing in vim. Is there a way
to custom-load them?

Thanks; the quick reply is appreciated.

TK

On 05/22/2012 10:20 AM, wojox wrote:
> Your question #198077 on gnome-terminal in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gnome-terminal/+question/198077
>
> wojox posted a new comment:
> Could you please be more specific Tim?
>

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Does the system have a make and model?
Is it a laptop or a fancy branded keyboard with function keys?
What is the output of:

lsb_release -a; uname -a

Thanks

Revision history for this message
Timothy Kendall (tkendall) said :
#4

On 05/22/2012 12:00 PM, actionparsnip wrote:
> Your question #198077 on gnome-terminal in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gnome-terminal/+question/198077
>
> Status: Open => Needs information
>
> actionparsnip requested more information:
> Does the system have a make and model?
> Is it a laptop or a fancy branded keyboard with function keys?
> What is the output of:
>
> lsb_release -a; uname -a
Output is:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04 LTS
Release: 12.04
Codename: precise
Linux HQ-LNX-SILO1272 3.2.0-24-generic #38-Ubuntu SMP Tue May 1 16:18:50
UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

Keyboard is Microsoft "Natural Keyboard Elite"
Hardware is Dell desktop.

Thank you, the quick responses are appreciated.

TK

>
> Thanks
>

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

Why was that data not in the initial question?

If you run:

xev

and press the keys, do they generate events?

Revision history for this message
Timothy Kendall (tkendall) said :
#6

On 05/22/2012 01:45 PM, actionparsnip wrote:
> Your question #198077 on gnome-terminal in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gnome-terminal/+question/198077
>
> Status: Open => Answered
>
> actionparsnip proposed the following answer:
> Why was that data not in the initial question?
Not sure which data you're referring to; sorry, I didn't realize I was
asking something apparently so complex. It has been a long time since I
had occasion to want to try anything like this; back when I did, a way
to "load" the keys was contained in the material accompanying the machine.

>
> If you run:
>
> xev
>
> and press the keys, do they generate events?
>
Yes, two for each key-press. Here's an example from F4:

KeyPress event, serial 33, synthetic NO, window 0x5a00001,
     root 0x15a, subw 0x0, time 16274992, (1173,415), root:(3096,527),
     state 0x0, keycode 70 (keysym 0xffc1, F4), same_screen YES,
     XLookupString gives 0 bytes:
     XmbLookupString gives 0 bytes:
     XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x5a00001,
     root 0x15a, subw 0x0, time 16275152, (1173,415), root:(3096,527),
     state 0x0, keycode 70 (keysym 0xffc1, F4), same_screen YES,
     XLookupString gives 0 bytes:
     XFilterEvent returns: False

Up to now I have not been familiar with xev, and in fact I'm fairly new
to the Ubuntu environment.

TK

Revision history for this message
Sam_ (and-sam) said :
#7

Did you try custome keys in system-settings - keyboard - shortcuts.

xev works with xmodmap.
http://manpages.ubuntu.com/manpages/precise/en/man1/xmodmap.1.html

Revision history for this message
Timothy Kendall (tkendall) said :
#8

I have, but either there's no way to do what I want or else there's
something fundamental that I'm misunderstanding.

What I need to do is "pre-load" a key, say for example F2, with a string
that will appear in whatever I'm doing whenever I press the key.

I have a peculiar kind of dyslexia that results in my mis-reading (and
hence, mis-copying or mis-typing) numbers frequently: I transpose
digits, often with unfortunate results. So I want load some
frequently-used numbers into function keys. Suppose, for example, that
I wanted to put my Social Security Number into a key (I don't really
want to do this, but it's a good example for discussion purposes).

  * I go to *System-Settings-keyboard-shortcuts* and click *Custom
    Shortcuts*. The line at the bottom says *To edit a shortcut, click
    the row and hold down the new keys or press Backspace to clear.* At
    this point, there are no rows, so I try to create one by clicking *+*.

  * A pop-up appears asking for *Name *and *Command*. Into *Name* I
    type "SSN". Into *Command *(and I'm really not sure about this step)
    I type what I want to appear when the key is pressed, in this
    example *"123-45-6789*". I then click *Apply*. The pop-up closes
    and a new row appears: "*SSN Disabled*".

  * Following the instruction at the bottom, I click the row, which
    becomes "selected". Here's where the instructions leave me in the
    mist. I'm supposed to "*hold down the new key_s_*". ("Keys"? I
    only want one...). I hold down *F2* but nothing happens. If I
    click the row again, the pop-up re-appears. Finally, I discover by
    accident that I'm apparently supposed to click, not the *row*, but
    the word "*Disabled*" _on_ the row. When I do, the word "*Disabled"
    *is replaced with "*New accelerator..."* (a phrase which doesn't
    mean much to a newcomer).

  * At this point, still guessing, I press *F2 *again and "*New
    accelerator...*" is replaced with "*F2*". Clicking the whole line
    again, I get the pop-up again, with "*SSN*" and "*123-45-6789*"
    still in place. It looks as though I might have succeeded. There's
    no "*Save*" button, so I close *system-settings-keyboard-shortcuts*.l

  * I open a terminal window; to try things out, I press *F2* at the
    command-line prompt. Nothing happens. I start a vim session, go
    into "INSERT" mode, and press *F2 *again. Nothing happens.
    Finally, I try pressing *F2* in this email, here:
    (Nothing happens)

There must be something fundamental that I don't understand, or some
terminology that I haven't guessed and don't know how to look up. Years
ago I worked on a Unix machine where I could put a key-loading sequence
into the login .profile, and whatever keys I had thus loaded were
available either at the command line or in the "vi" editor. That's what
I'd like to do now, but if there's a way to do it I haven't discovered it.

I do appreciate your continued responses; thank you once again.

Timothy

On 05/23/2012 05:40 PM, Sam_ wrote:
> Your question #198077 on gnome-terminal in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gnome-terminal/+question/198077
>
> Status: Open => Answered
>
> Sam_ proposed the following answer:
> Did you try custome keys in system-settings - keyboard - shortcuts.
>
> xev works with xmodmap.
> http://manpages.ubuntu.com/manpages/precise/en/man1/xmodmap.1.html
>

Revision history for this message
Launchpad Janitor (janitor) said :
#9

This question was expired because it remained in the 'Open' state without activity for the last 15 days.