The purpose of this setup is to be able to use Intellij IDEA in an Citrix Workspace with vaguely similary keyboard setup as on a Mac in order to code.
This guide is based on a setup where the hardware is a Mac with a physical Norwegian keyboard, American English as layout and the virtual device is Ubuntu 20.04. It may work on other setups.
After doing this guide it will feel like coding on a Mac. Unfortunately, not all key bindings are like the default Mac layout for Intellij IDEA. In addition, not all keys on the bottom row can be mapped correctly. Only the right Option key will act as a Command key, and only in Intellij IDEA.
-
Add keyboard layout
English (US, intl., with dead keys)on Ubuntu. -
In the Preferences of Citrix Workspace (
),
choose the double arrows in the right corner, Keyboardand set the following:This will map:
- Right ⌘ button to
Meta, which we can map in Intellij IDEA to act as the Command button. - Left Option to
Alt / Option - Left ⌘ to Super
- Right ⌘ button to
-
Map
Windowskey toMeta. This is a bit backwards, but it does the trick for giving us a key which can act as a Command key (⌘). In Intellij IDEA, do the following:
- Help -> Edit Custom Properties,
- Add
keymap.windows.as.meta=trueto the file.
-
Install the plugin macOS Keymap. This plugin adds keymap called Intellij IDEA Classic (macOS) as a keymap - please change to this mapping in Keymap settings. This mapping will have a lot of shortcuts where
Metais used. -
We must remove a few default shortcuts from Ubuntu in order to use them in Intellij. Remove with the following script:
# To find other settings, please install app Dconf-Redigering. Most settings are found within # org.gnome.desktop.wm.keybindings some within /org/gnome/mutter/ # Choosing a shortcut, right click and copy gives a setting like the one under here. Emptying the # array removes all shortcuts for that functionality # Remove shortcuts for Activities: gsettings set org.gnome.shell.extensions.dash-to-dock hot-keys false for i in $(seq 1 9); do gsettings set org.gnome.shell.keybindings switch-to-application-${i} '[]'; done # Remove Show Programs and Run Command: gsettings set org.gnome.desktop.wm.keybindings panel-main-menu "[]" # Disable Alt + F1 gsettings set org.gnome.desktop.wm.keybindings panel-run-dialog "[]" # Disable Alt + F2 # Remove showe/hide desktop (cmd + D) - enables duplicating lines gsettings set org.gnome.desktop.wm.keybindings show-desktop "[]" # Remove move window to left and right part of screen gsettings set org.gnome.mutter.keybindings toggle-tiled-left "[]" gsettings set org.gnome.mutter.keybindings toggle-tiled-right "[]" # Remove resizing shortcuts Alt + F7 / F8 gsettings set org.gnome.desktop.wm.keybindings begin-resize "[]" gsettings set org.gnome.desktop.wm.keybindings begin-move "[]" # Disable right click window menu - to enable Quick definition / peek gsettings set org.gnome.desktop.wm.keybindings activate-window-menu "[]" # Disable CMD + P shortcut for monitor switching gsettings set org.gnome.mutter.keybindings switch-monitor "[]" # Disable single press on left command button to open window switcher gsettings set org.gnome.mutter overlay-key ''
-
Disable notification-shortcut. In Ubuntu settings, go to
Tastatursnarveier, and remove shortcutVis varslingsliste. -
Disable vis oversikt-shortcut. In Ubuntu settings, go to
Tastatursnarveier, and remove shortcutVis oversikt. Then remove one frome GUI so that we can select all text in a file:Innstillinger -> Tastatursnarveier -> Vis alle programmer: Disable -
Install Frame switcher which enables hot swapping between multiple instances of Intellij IDEA. Enables opening recent projects and open projects by search.
There are two different ways to add the shortcuts:
- Alternative 1: Download the Shortcuts file and add it to
~/.config/Jetbrains/<CURRENT JETBRAINS VERSION>/keymaps. Restart the IDE and choose the keymap inSettings -> Keymap. If it does not work, please see Alternative 2 - Alternative 2: Add the shortcuts manually:
- Right click-menu keybinding. Add the following shortcut in Settings -> Keymap ->
Show Context Menu:Meta + Shift + 0. - Search for Go to, set following
Go to classinGo to by Name Actions:Ctrl + OGo to fileinGo to by Name Actions:Ctrl + Shift + O
- Search for Move statement, set following
Move statement up:Ctrl + Shift + UpMove statement down:Ctrl + Shift + Down
- Disable shortcuts for apps/mission control
Ctrl + UpandCtrl + Downon the Mac host to enable next/previous method:- System settings -> Keyboard -> Keyboard Shortcuts -> Mission Control
- Untick
Mission ControlandApplication Windows
- Disable shortcut for
Spotlight -> Show Finder search windowon the Mac host. On your mac, go toSystem Settings->Keyboard->Keyboard Shortcuts, go toSpotlightand disableShow Finder search window. - Change shortcut
Find in filestoMeta + Shift + F - Change shortcut
Replace in filestoMeta + Shift + R - Change shortcut
Close tabinEditor close actionstoMeta + W - Change shortcut
Delete lineinEditor ActionstoMeta + Backspace - Change shortcut
Show usagestoCtrl + Option + F7(RememberOptionis as described in picture above) - Change shortcut
DebuginRun/DebugtoCtrl + D - Change shortcut
Debug context configurationtoCtrl + Shift + D - Change shortcut
RuninRun/DebugtoCtrl + R - Change shortcut
Run context configurationtoCtrl + Shift + R - Change shortcut
Quick documentationtoF1 - Change shortcut
LeftinNavigatetoMeta + Ctrl + Left - Change shortcut
RightinNavigatetoMeta + Ctrl + Right - Add shortcut
Comment with line commenttoMeta + MinusorMeta + / - Change shortcut
Quick definitiontoOption + Space(Peek) - Change shortcut
RuninMain menu - RuntoCtrl + Option + R - Change shortcut
DebuginMain menu - DebugtoCtrl + Option + D - Change shortcut
Resume ProgramtoCmd + Option + R - Change shortcut
Select next tabtoCmd + Shift + Right(Choose keep the other places it is used) - Change shortcut
Select previous tabtoCmd + Shift + Left(Choose keep the other places it is used) - Change Shortcut
Extend Selection inEditor ActionstoAlt + Up` - Change Shortcut
Shrink Selection inEditor ActionstoAlt + Down`
Start/end of line:fn + Left / RightorCmd + Left / RightPage up/down:fn + Up / DownSelection for next occurence, Select/unselect:Ctrl + G / Ctrl + Shift + GMethod, Next/Previous:Ctrl + Up/DownMove method up/down:Ctrl + Shift + Up/DownError, Next/Previous:F2 / Shift + F2Selection, Increase/Decrease:Alt + Up / Alt DownFind in files:Meta + Shift + FReplace in files:Meta + Shift + RClose tab:Meta + WDelete line:Meta + BackspaceOpen scratch file:Ctrl + Shift + NShow usagestoCtrl + Option + F7Debugprevious run:Ctrl + DDebug in current context:Ctrl + Shift + DToggle line breakpoint:CMD + F8Evaluate expression:Alt + F8Quick evaluate expression:Cmd + Alt + F8Quick documentation: F1Runby showing the Run-configuration menu:Ctrl + Option + RDebugby showing the Debug-configuration menu:Ctrl + Option + DResume Program:Cmd + Option + RSelect next/previous tab:Cmd + Shift + Right/Left
App menu is hidden
- Install and start Gnome tweaks
sudo apt install gnome-tweaks gnome-tweaks
- Choose
Utvidelser - Activate with slider switch in the top.

