Cross platform key modifiers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Cross platform key modifiers

Ben Coman
Not sure what past history we inherited, but I am questioning the semantics of our key modifiers.  My understanding is that the following is industry standard... 
    OSX         Windows       Linux
    option           alt                alt
    cmd              ctrl               ctrl

with Copy being the simplest example of this...
    cmd-c           ctrl-c            ctrl-c

Supporting this view:
* "option" and "alternative" are synonyms
* "command" and "control" have similar meaning (e.g. in the army if you command someone, you control them)
* Apple say so (https://support.apple.com/kb/PH18812?locale=en_US) and indeed marks its keyboards with "alt" and "option" on the same key (http://www.apple.com/au/keyboard/)

So examining this with
    KMLog setDebug.Transcript open.

On OSX Pharo 50044 I get... 
    option+arrowLeft --> [keystroke '<Opt-left>']
    cmd+arrowLeft --> [keystroke '<Cmd-left>']
    ctrl+arrowLeft --> OS changes screens

but I am told that Windows gives...
    alt+arrowLeft --> [keystroke '<Cmd-left>']
    ctrl+arrowLeft --> [keystroke '<Ctrl-left>']

when I believe Windows should be...
    alt+arrowLeft --> [keystroke '<Opt-left>']
    ctrl+arrowLeft --> [keystroke '<Cmd-left>']


Part of the issue I think is that our keystroke mapping should be more abstract. 

When I was using Pharo on Windows, sometimes it felt like a second class citizen wrt key mappings, mapping ctrl-c to an apple-named <cmd-c>.  Perhaps what we should see is:

OSX...
    option+arrowLeft --> [keystroke '<Meta-left>']
    cmd+arrowLeft --> [keystroke '<Hotkey-left>']

Windows...
    alt+arrowLeft --> [keystroke '<Meta-left>']
    ctrl+arrowLeft --> [keystroke '<Hotkey-left>']

Otherwise there will always be the tension on windows that ctrl-c should generate [<keystroke '<Ctrl-c>] and we end up with definitions repetitively formed like... 
    PharoShortcuts>>acceptShortcut
^ $s ctrl win | $s ctrl unix | $s command mac

which opens the door for inconsistencies.  We should only need to do something like...
    PharoShortcuts>>acceptShortcut
^ $s hotkey

and leave it to the platform default or user preference the define what the hotkey actually is.   A status line in the Keymap Browser could display which actual real keys map to <Hotkey> and <Meta>.


What are you thoughts?
cheers -ben

Reply | Threaded
Open this post in threaded view
|

Re: Cross platform key modifiers

Nicolai Hess
Hi ben,

2015-05-22 17:28 GMT+02:00 Ben Coman <[hidden email]>:
Not sure what past history we inherited, but I am questioning the semantics of our key modifiers.  My understanding is that the following is industry standard... 
    OSX         Windows       Linux
    option           alt                alt
    cmd              ctrl               ctrl

Yes, this is what I expected too.
And I thought this is for what KMCommandModifier is used for.
With that, I would expect "Character arrowLeft command" maps to
Ctrl+Left for windows/linux
Meta+Left for Mac (If Meta is the Command-Key on a Mac keyboard).


 

with Copy being the simplest example of this...
    cmd-c           ctrl-c            ctrl-c

Supporting this view:
* "option" and "alternative" are synonyms
* "command" and "control" have similar meaning (e.g. in the army if you command someone, you control them)
* Apple say so (https://support.apple.com/kb/PH18812?locale=en_US) and indeed marks its keyboards with "alt" and "option" on the same key (http://www.apple.com/au/keyboard/)

So examining this with
    KMLog setDebug.Transcript open.

On OSX Pharo 50044 I get... 
    option+arrowLeft --> [keystroke '<Opt-left>']
    cmd+arrowLeft --> [keystroke '<Cmd-left>']
    ctrl+arrowLeft --> OS changes screens

but I am told that Windows gives...
    alt+arrowLeft --> [keystroke '<Cmd-left>']
    ctrl+arrowLeft --> [keystroke '<Ctrl-left>']

when I believe Windows should be...
    alt+arrowLeft --> [keystroke '<Opt-left>']
    ctrl+arrowLeft --> [keystroke '<Cmd-left>']


Part of the issue I think is that our keystroke mapping should be more abstract. 

When I was using Pharo on Windows, sometimes it felt like a second class citizen wrt key mappings, mapping ctrl-c to an apple-named <cmd-c>.  Perhaps what we should see is:

OSX...
    option+arrowLeft --> [keystroke '<Meta-left>']
    cmd+arrowLeft --> [keystroke '<Hotkey-left>']

Windows...
    alt+arrowLeft --> [keystroke '<Meta-left>']
    ctrl+arrowLeft --> [keystroke '<Hotkey-left>']

Otherwise there will always be the tension on windows that ctrl-c should generate [<keystroke '<Ctrl-c>] and we end up with definitions repetitively formed like... 
    PharoShortcuts>>acceptShortcut
^ $s ctrl win | $s ctrl unix | $s command mac

which opens the door for inconsistencies.  We should only need to do something like...
    PharoShortcuts>>acceptShortcut
^ $s hotkey


Isn't OSXs Command-key like MS-Windows "Window" or Linux "Meta" -key?

 

and leave it to the platform default or user preference the define what the hotkey actually is.   A status line in the Keymap Browser could display which actual real keys map to <Hotkey> and <Meta>.


What are you thoughts?
cheers -ben


Reply | Threaded
Open this post in threaded view
|

Re: Cross platform key modifiers

Ben Coman


On 23 May 2015 6:36 am, "Nicolai Hess" <[hidden email]> wrote:
>
> Hi ben,
>
> 2015-05-22 17:28 GMT+02:00 Ben Coman <[hidden email]>:
>>
>> Not sure what past history we inherited, but I am questioning the semantics of our key modifiers.  My understanding is that the following is industry standard... 
>>     OSX         Windows       Linux
>>     option           alt                alt
>>     cmd              ctrl               ctrl
>
>
> Yes, this is what I expected too.
> And I thought this is what KMCommandModifier is used for.
> With that, I would expect "Character arrowLeft command" maps to
> Ctrl+Left for windows/linux
> Meta+Left for Mac

> (If Meta is the Command-Key on a Mac keyboard).

No. On a Mac the "command" key is "Cmd" -- hence why I think we should not call it "command" internally, to help maintain platform independent semantics.

>>
>> with Copy being the simplest example of this...
>>     cmd-c           ctrl-c            ctrl-c
>>
>> Supporting this view:
>> * "option" and "alternative" are synonyms
>> * "command" and "control" have similar meaning (e.g. in the army if you command someone, you control them)
>> * Microsoft say so (https://support.microsoft.com/en-us/kb/970299)
>> * Apple say so (https://support.apple.com/kb/PH18812?locale=en_US) and indeed marks its keyboards with "alt" and "option" on the same key (http://www.apple.com/au/keyboard/)
>>
>> So examining this with
>>     KMLog setDebug.Transcript open.
>>
>> On OSX Pharo 50044 I get... 
>>     option+arrowLeft --> [keystroke '<Opt-left>']
>>     cmd+arrowLeft --> [keystroke '<Cmd-left>']
>>     ctrl+arrowLeft --> OS changes screens
>>
>> but I am told that Windows gives...
>>     alt+arrowLeft --> [keystroke '<Cmd-left>']
>>     ctrl+arrowLeft --> [keystroke '<Ctrl-left>']
>>
>> when I believe Windows should be...
>>     alt+arrowLeft --> [keystroke '<Opt-left>']
>>     ctrl+arrowLeft --> [keystroke '<Cmd-left>']
>>
>>
>> Part of the issue I think is that our keystroke mapping should be more abstract. 
>>
>> When I was using Pharo on Windows, sometimes it felt like a second class citizen wrt key mappings, mapping ctrl-c to an apple-named <cmd-c>.  Perhaps what we should see is:
>>
>> OSX...
>>     option+arrowLeft --> [keystroke '<Meta-left>']
>>     cmd+arrowLeft --> [keystroke '<Hotkey-left>']
>>
>> Windows...
>>     alt+arrowLeft --> [keystroke '<Meta-left>']
>>     ctrl+arrowLeft --> [keystroke '<Hotkey-left>']
>>
>> Otherwise there will always be the tension on windows that ctrl-c should generate [<keystroke '<Ctrl-c>] and we end up with definitions repetitively formed like... 
>>     PharoShortcuts>>acceptShortcut
>> ^ $s ctrl win | $s ctrl unix | $s command mac
>>
>> which opens the door for inconsistencies.  We should only need to do something like...
>>     PharoShortcuts>>acceptShortcut
>> ^ $s hotkey
>
>
>
> Isn't OSXs Command-key like MS-Windows "Window" or Linux "Meta" -key?
>

No. I know they both have nice icons, but they are not the same. You don't use the windows key to copy text.
Cheers -ben

>  
>>
>>
>> and leave it to the platform default or user preference the define what the hotkey actually is.   A status line in the Keymap Browser could display which actual real keys map to <Hotkey> and <Meta>.
>>
>>
>> What are you thoughts?
>> cheers -ben
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Cross platform key modifiers

Nicolai Hess


2015-05-23 9:52 GMT+02:00 Ben Coman <[hidden email]>:

> (If Meta is the Command-Key on a Mac keyboard).

No. On a Mac the "command" key is "Cmd" -- hence why I think we should not call it "command" internally, to help maintain platform independent semantics.

Yes and I thought this was the reason to define one Command-Modifier (Ctrl on Windows, because you use Ctrl+C for copy, Command on Mac, because you
use Cmd+C for copy on a Mac) and map. (and we are using "Command" instead of a platform independent name, because many squeak-keyshortcuts had
its history from the old first implementation for a mac. And users are used to this semantics.
 

>

No. I know they both have nice icons, but they are not the same. You don't use the windows key to copy text.
Cheers -ben


Yes, exactly, they are the same keys but used for different purposes on each platform. Windows uses the ctrl-key for copy/paste, the alt-key for the menu bar, the
Windows/Meta key for Desktop and Shell shortcuts.
Mac uses the Meta/Command key copy/paste.

-> I think we can not really use a platform independent schema, if the platform reserved the keys for its own purpose.
Reply | Threaded
Open this post in threaded view
|

Re: Cross platform key modifiers

Sean P. DeNigris
Administrator
In reply to this post by Nicolai Hess
Great OP! We should get this straight for sure...

Nicolai Hess wrote
Yes, this is what I expected too.
...
With that, I would expect "Character arrowLeft command" maps to
Ctrl+Left for windows/linux
Meta+Left for Mac (If Meta is the Command-Key on a Mac keyboard).
That makes sense to me. "command" seems like it may be the best abstract term. Hotkey already has a meaning (http://en.wikipedia.org/wiki/Keyboard_shortcut), and it seems meta is used inconsistently by the platforms - i.e. Mac uses it for commands, but Windows uses ctrl instead. IIRC we already treat #option and #alt as synonyms...
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Cross platform key modifiers

Guillermo Polito
Camillo introduced a while ago the meta modifier:

$a meta

$z meta shift

meta is sensitive to the current environment and is equivalent to what you where describing above:
  - command in mac
  - control in windows/unix

What should be done is to use it in the system :).

Guille

El lun., 25 de may. de 2015 a la(s) 2:16 p. m., Sean P. DeNigris <[hidden email]> escribió:
Great OP! We should get this straight for sure...


Nicolai Hess wrote
> Yes, this is what I expected too.
> ...
> With that, I would expect "Character arrowLeft command" maps to
> Ctrl+Left for windows/linux
> Meta+Left for Mac (If Meta is the Command-Key on a Mac keyboard).

That makes sense to me. "command" seems like it may be the best abstract
term. Hotkey already has a meaning
(http://en.wikipedia.org/wiki/Keyboard_shortcut), and it seems meta is used
inconsistently by the platforms - i.e. Mac uses it for commands, but Windows
uses ctrl instead. IIRC we already treat #option and #alt as synonyms...



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Cross-platform-key-modifiers-tp4828113p4828461.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Cross platform key modifiers

SergeStinckwich
Yes meta key come from Lisp Machine:

http://en.wikipedia.org/wiki/Meta_key

I guess we should have a look how Emacs solve this keybinding issue
regarding multiple platforms.



On Wed, May 27, 2015 at 9:29 AM, Guillermo Polito
<[hidden email]> wrote:

> Camillo introduced a while ago the meta modifier:
>
> $a meta
>
> $z meta shift
>
> meta is sensitive to the current environment and is equivalent to what you
> where describing above:
>   - command in mac
>   - control in windows/unix
>
> What should be done is to use it in the system :).
>
> Guille
>
> El lun., 25 de may. de 2015 a la(s) 2:16 p. m., Sean P. DeNigris
> <[hidden email]> escribió:
>>
>> Great OP! We should get this straight for sure...
>>
>>
>> Nicolai Hess wrote
>> > Yes, this is what I expected too.
>> > ...
>> > With that, I would expect "Character arrowLeft command" maps to
>> > Ctrl+Left for windows/linux
>> > Meta+Left for Mac (If Meta is the Command-Key on a Mac keyboard).
>>
>> That makes sense to me. "command" seems like it may be the best abstract
>> term. Hotkey already has a meaning
>> (http://en.wikipedia.org/wiki/Keyboard_shortcut), and it seems meta is
>> used
>> inconsistently by the platforms - i.e. Mac uses it for commands, but
>> Windows
>> uses ctrl instead. IIRC we already treat #option and #alt as synonyms...
>>
>>
>>
>> -----
>> Cheers,
>> Sean
>> --
>> View this message in context:
>> http://forum.world.st/Cross-platform-key-modifiers-tp4828113p4828461.html
>> Sent from the Pharo Smalltalk Developers mailing list archive at
>> Nabble.com.
>>
>



--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Every DSL ends up being Smalltalk
http://www.doesnotunderstand.org/

Reply | Threaded
Open this post in threaded view
|

Re: Cross platform key modifiers

Nicolai Hess
In reply to this post by Guillermo Polito


2015-05-27 9:29 GMT+02:00 Guillermo Polito <[hidden email]>:
Camillo introduced a while ago the meta modifier:

$a meta

$z meta shift

meta is sensitive to the current environment and is equivalent to what you where describing above:
  - command in mac
  - control in windows/unix

What should be done is to use it in the system :).

Then there is something I don't understand or I don't do it right :)

a shortcut defined like:

$b meta shift

never matches for me (on windows). But

$b ctrl shift
$b command shift
works.

(the last on matches on alt+shift+b,
but defining a keyshortcut as
$b alt shift
again does not work).






 

Guille

El lun., 25 de may. de 2015 a la(s) 2:16 p. m., Sean P. DeNigris <[hidden email]> escribió:
Great OP! We should get this straight for sure...


Nicolai Hess wrote
> Yes, this is what I expected too.
> ...
> With that, I would expect "Character arrowLeft command" maps to
> Ctrl+Left for windows/linux
> Meta+Left for Mac (If Meta is the Command-Key on a Mac keyboard).

That makes sense to me. "command" seems like it may be the best abstract
term. Hotkey already has a meaning
(http://en.wikipedia.org/wiki/Keyboard_shortcut), and it seems meta is used
inconsistently by the platforms - i.e. Mac uses it for commands, but Windows
uses ctrl instead. IIRC we already treat #option and #alt as synonyms...



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Cross-platform-key-modifiers-tp4828113p4828461.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Cross platform key modifiers

Sean P. DeNigris
Administrator
In reply to this post by SergeStinckwich
SergeStinckwich wrote
how Emacs solve this keybinding issue
For one thing, Emacs gives the underlying platform the finger and institutes the same set of unintelligible keybindings regardless of platform conventions ;)
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Cross platform key modifiers

Damien Cassou-2
In reply to this post by SergeStinckwich

Serge Stinckwich <[hidden email]> writes:

> I guess we should have a look how Emacs solve this keybinding issue
> regarding multiple platforms.

Emacs works really well in this regard and should be used as a
reference. If you have any specific question, I can have a look.

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: Cross platform key modifiers

SergeStinckwich
On Wed, May 27, 2015 at 3:56 PM, Damien Cassou <[hidden email]> wrote:
>
> Serge Stinckwich <[hidden email]> writes:
>
>> I guess we should have a look how Emacs solve this keybinding issue
>> regarding multiple platforms.
>
> Emacs works really well in this regard and should be used as a
> reference. If you have any specific question, I can have a look.

:-)

--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Every DSL ends up being Smalltalk
http://www.doesnotunderstand.org/

Reply | Threaded
Open this post in threaded view
|

Re: Cross platform key modifiers

stepharo
In reply to this post by Damien Cassou-2
I want cmd-k damien. and cmd-A and cmd-E

:)

Le 27/5/15 15:56, Damien Cassou a écrit :
> Serge Stinckwich <[hidden email]> writes:
>
>> I guess we should have a look how Emacs solve this keybinding issue
>> regarding multiple platforms.
> Emacs works really well in this regard and should be used as a
> reference. If you have any specific question, I can have a look.
>