FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » ncurses on Linux how to capture F1 key?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: ncurses on Linux how to capture F1 key? [message #178779 is a reply to message #178778] Wed, 01 August 2012 11:34 Go to previous message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma:
Senior Member
On 08/01/2012 04:43 AM, crankypuss wrote:
> On 07/31/2012 08:08 PM, Norman Peelman wrote:
>> On 07/27/2012 12:29 PM, crankypuss wrote:
>>> On 07/27/2012 05:00 AM, dickey(at)his(dot)com wrote:
>>>> On Friday, July 27, 2012 6:42:09 AM UTC-4, crankypuss wrote:
>>>> > Using the C interface the incantation is "keypad(stdscr,
>>>> > TRUE)"
>>>> >
>>>> > What is the equivalent using the PHP interface to ncurses?
>>>> >
>>>> > Pressing F1 just brings up gnome help (running in xterm under ubuntu
>>>> > 11.10).
>>>>
>>>> that sounds as if you're using one of the vte-based hacks such as
>>>> gnome-terminal,
>>>> which hijack some keys - have to fix that by undoing the item in their
>>>> respective
>>>> setup dialogs.
>>>>
>>>
>>> I'm using "xterm" and also on a cli (non-GUI) login... terminal type is
>>> either "xterm" or "linux". Less stuff grabbed as Linux console.
>>>
>>> Any additional pointers/keywords I can use to find out more about
>>> "undoing the item"?
>>>
>>> Thanks.
>>
>> You can turn off the shortcuts by going to:
>> Edit->Keyboard Shortcuts
>>
>> ...scroll down to Help->Contents and double-click the 'F1' entry and
>> press 'Backspace' to disable it. Can this be done programmatic-ally? I
>> don't know.
>
> I don't want to turn my Linux installation into a mutant, I just want to
> be able to run a mutant program on it.
>
>> As an aside if I remember correctly what little I've done in
>> (php)ncurses when checking for those 'special' keys, they return a
>> multi-byte sequence... so based on the first result you may need to do
>> another getchar (or whatever it's called) as well. I do believe the
>> arrow keys and F# keys meet this requirement.
>
> Some do, some don't. Trying to support every known obsolete terminal
> does kind of kick the ability to use current physical console hardware
> in the crotch. I foresee much reading of C-language source code and much
> swearing prior to throwing up my hands and rewriting who-knows-what, and
> I'm not liking that nightmare, done it too many times before.

Aha! This setting can be found in the GConf editor (registry):

Apps->gnome-terminal->keybindings

Setting to 'disabled' turned it off. This disabled F1 for all
'gnome-terminal's that I opened after changing the setting. The setting
is applied -on-the-fly- and is immediately reflected in (all) open
gnome-terminals.

You can script (php->exec/system) this, take a look:

http://commons.oreilly.com/wiki/index.php/Ubuntu_Hacks/The_Linux_Desktop
http://commons.oreilly.com/wiki/index.php/Ubuntu_Hacks/The_Linux_Desktop#Sc ripting_GConf
http://webnesbay.com/configure-your-gnome-desktop-environment-using-gconfto ol-in-ubuntu-linux/

That should do what you want... as for the actual grabbing of the
keys, I don't have (php)ncurses set up on this machine (or one that's
handy at the moment) to try.

There are some user notes here you may be interested in:

http://www.php.net/manual/en/function.ncurses-getch.php




--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: strip_tags function
Next Topic: Is my array understanding correct?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 04:32:29 GMT 2024

Total time taken to generate the page: 0.04156 seconds