Repository navigation
Replies: 1 comment 2 replies
|
Thank you for the feedback, I would investigate |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Background
Hello,
I normally work on Windows machines and use various SSH tools to connect to Linux servers. After moving to macOS, I wanted to keep the Windows keyboard habits I have used for years, especially when using an external Windows keyboard.
I use a standard external Windows/Turkish Q keyboard with my Mac.
On Windows, I am used to:
macOS normally uses:
To preserve my Windows muscle memory, I changed the macOS modifier keys under:
System Settings → Keyboard → Keyboard Shortcuts → Modifier Keys
My configuration is essentially:
With this configuration, my external Windows keyboard behaves the way I am used to in normal macOS applications:
This works very well in Chrome, Finder, and other normal macOS applications.
Problem inside Electerm
The problem appears when I use Electerm for SSH sessions.
In a terminal,
Ctrlis not just a GUI shortcut modifier. It is a fundamental part of Unix/Linux terminal interaction.For example:
Because my physical
Ctrlkey is mapped to macOSCommand, pressing physicalCtrl+Cinside Electerm does not send a real terminal^C.For example:
Then pressing physical:
does not stop the command.
The same happens with
Ctrl+D.For example, inside PostgreSQL
psql, physicalCtrl+Ddoes not behave as EOF/exit.Other Control-based shortcuts in Bash, Nano, Vim, etc. are affected as well.
Remote Linux configuration is correct
I verified the terminal configuration on the remote Linux system:
The relevant settings were correct:
So the remote system correctly expects:
This confirms that the issue is not caused by SSH, Linux, PostgreSQL, or the remote
sttyconfiguration.It is caused by the interaction between macOS modifier-key remapping and Electerm's terminal keyboard handling.
Interesting behavior on the MacBook keyboard
My macOS modifier configuration also contains:
Because of this, pressing physical
Command+Ccan behave like realControl+Cinside Electerm.This helped identify the problem:
The terminal needs a real Control modifier, but the physical key I normally use as Ctrl has already been converted to Command by macOS.
What I looked for inside Electerm
I checked:
Settings → Shortcuts
Electerm provides shortcuts for tabs, search, window management, zoom, etc.
However, configuring individual shortcuts such as
Ctrl+C,Ctrl+D,Ctrl+R,Ctrl+X, etc. is not really the solution.What is needed is a terminal-specific modifier mapping such as:
while outside Electerm:
I could not find an option such as:
or:
or:
Workaround using Karabiner-Elements
I was able to solve the problem using Karabiner-Elements.
First I confirmed Electerm's bundle identifier:
osascript -e 'id of app "Electerm"'Result:
I then created a Karabiner rule using:
for:
This allows the special modifier behavior to apply only while Electerm is the active application.
The intended behavior is:
Normal macOS applications
Electerm
After this workaround, terminal shortcuts started working correctly:
Karabiner VirtualHIDKeyboard complication
Enabling Karabiner introduced another complication.
Karabiner sends keyboard events through a virtual keyboard:
This virtual keyboard appeared separately under macOS:
System Settings → Keyboard → Keyboard Shortcuts → Modifier Keys
Its default modifier configuration caused my normal Windows-style
Ctrl+C / Ctrl+Vbehavior to stop working in desktop applications.I therefore also had to configure the Karabiner virtual keyboard:
After doing this:
worked again in normal macOS applications, while the Electerm-specific Karabiner rule still provided real terminal Control behavior.
Shift+Insert paste
Another common Windows/Linux terminal shortcut is:
This is particularly useful while working over SSH with tools such as:
In my configuration,
Shift+Insertdid not paste clipboard contents inside Electerm.I therefore had to add another Electerm-specific Karabiner mapping:
For example:
I can now use
Shift+Inserton my external Windows keyboard to paste clipboard content.Built-in MacBook keyboard
I also use the MacBook's built-in keyboard when the external keyboard is disconnected.
After introducing the Karabiner mappings, I also needed to preserve normal macOS clipboard shortcuts inside Electerm:
The final behavior is now approximately:
Ctrl+C / Ctrl+V= Copy/PasteCtrl+C / Ctrl+D / Ctrl+R...= real terminal ControlShift+Insert= PasteCommand+C / Command+V= Copy/PasteThe workaround works, but it requires a significant amount of system-level customization.
Why built-in Electerm support would help
I do not think this use case is unique.
Many users spend years working on Windows machines with SSH clients and later move to macOS while continuing to use an external Windows keyboard.
Some users preserve their Windows muscle memory by configuring macOS like this:
This works extremely well for normal GUI applications.
However, terminals are different because the real
Controlmodifier is part of Unix terminal and shell interaction.This creates two different requirements.
Normal macOS applications
Terminal
If Electerm could handle these two cases internally, users would not need a system-wide third-party solution such as Karabiner-Elements.
Feature request
It would be very useful if Electerm on macOS provided something like:
Terminal Modifier Mapping
For example:
Clipboard shortcuts could be configured independently:
Another possibility would be a predefined option:
with settings such as:
A more advanced implementation could support different behavior for:
This would allow users to keep the built-in MacBook keyboard in the standard macOS layout while using an external Windows keyboard with Windows-style behavior.
Conclusion
I have successfully solved the problem using Karabiner-Elements, and Electerm now works correctly with both my external Windows keyboard and the built-in MacBook keyboard.
However, achieving this required:
frontmost_application_ifrulesCommand+C / Command+VbehaviorShift+Insertpaste mappingFor something fundamentally related to keyboard handling inside a terminal emulator, this is a fairly complex system-level workaround.
I think built-in support for terminal modifier mapping / Windows keyboard compatibility on macOS would be very useful for system administrators, DBAs, DevOps engineers, developers, and other users who frequently work over SSH and have moved from Windows to macOS.
I would appreciate it if this use case could be considered for a future Electerm update.
Thank you.
All reactions