Forum / NoMachine for Mac / Curious errors executing my .cshrc which contains an xmodmap command
Tagged: xmodmap
- This topic has 1 reply, 2 voices, and was last updated 5 years, 12 months ago by graywolf.
-
AuthorPosts
-
November 5, 2018 at 16:53 #20352MickMParticipant
I have a .cshrc file that contains this line:
xmodmap ~/.Xmodmap
When I connect via NX the terminal window that pops up shows an error and the xmodmap command didn’t work:
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 118 (X_SetModifierMapping)
Value in failed request: 0x17
Serial number of failed request: 22
Current serial number in output stream: 22
If I now manually enter the xmodmap command into the terminal window it works just fine without error. Similarly, if I remove the xmodmap line from the .cshrc then when I connect via NX the terminal window shows no errors, and when I then type in the xmodmap command it works just fine without errors and all of the keyboard remappings it defines also work just fine.
I don’t know what’s going on here – any ideas?
Other useful information:
I’m running Mac OS X 10.12.6 and NoMachine version 6.3.6 running a custom session in floating window mode
My xmodmap file contents is:
! This is my ~/.Xmodmap file for the Apple BlueTooth extended keyboard
! It brings several unresponsive numeric pad keys to life
! You can try any line interactively e.g.:
! xmodmap -e “keycode 114 = F16”
! You can execute this file by typing:
! xmodmap ~/.Xmodmap
! xmodmap is case sensitive so enter keysyms correctly!
! I use these key names for Cadence hotkeys in .cdsinit
! Use xev to determine a key’s keycode
!***********************************************************
! Enable the missing numeric pad keys
!***********************************************************
! keycode # = Keysym
keycode 114 = F16
keycode 72 = F17
keycode 87 = F18
keycode 88 = F19
! This is the “clear” key on the numeric pad
keycode 79 = KP_Separator
!***********************************************************
! Swap Control and Command modifiers
! Possible issues because the X11 menubar contains ⌘C, ⌘W etc.
!***********************************************************
! via https://www.emacswiki.org/emacs/MetaKeyProblems
! To determine your current modifier keys – enter the command “xmodmap”
! This is what resulted when I did that:
! shift Shift_L (0x40), Shift_R (0x44)
! lock Caps_Lock (0x41)
! control Control_L (0x43), Control_R (0x46)
! mod1 Alt_L (0x42), Alt_R (0x45)
! mod2 Meta_L (0x3f), Meta_R (0x47)
! mod3
! mod4
! mod5
! So the Option keys are mod1, and the Command keys are mod2
! undo any mod2 (i.e. COMMAND) keys already set
clear mod2
! undo any control keys already set
clear control
! Set the COMMAND keys (keycodes 63 & 71) to function as *control* keys
keycode 63=Control_L
keycode 71=Control_R
! Set the CONTROL keys (keycodes 67 & 70) to function as *command* keys
keycode 67=Meta_L
keycode 70=Meta_R
! Define Meta_L & Meta_R to function as the mod2 modifier
add mod2 = Meta_L Meta_R
! Define Control_L & Control_R to function as the Control modifier
add control = Control_L Control_R
! Apple Extended BlueTooth keyboard
! 65=Caps_Lock, 56=Tab
! The “fn” and Eject keys do nothing at all in xev
!_______________________________________ ________________________________________
! control ! option ! command ! ! command ! option ! control !
! Control_L ! Alt_L ! Meta_L ! ! Meta_R ! Alt_R ! Control_R !
! keycode 67 ! keycode 66 ! keycode 63 ! ! keycode 71 ! keycode 69 ! keycode 70 !
!____________!____________!____________! !____________!____________!____________!
!_____________________________________________
! F13 ! F14 ! F15 !
! F13 ! F14 ! F15 !
! keycode 113 ! keycode 115 ! keycode 121 !
!______________!______________!______________!
! fn ! home ! page up !
! nil ! Home ! Prior !
! nil ! keycode 123 ! keycode 124 !
!______________!______________!______________!
! delete ! end ! page down !
! Delete ! End ! Next !
! keycode 125 ! keycode 127 ! keycode 129 !
!______________!______________!______________!
! ________________
! ! up !
! ! UP !
! ! keycode 134 !
!______________!______________!_______________
! left ! down ! right !
! Left ! Down ! Right !
! keycode 131 ! keycode 133 ! keycode 132 !
!______________!______________!______________!
!____________________________________________________________
! F16 ! F17 ! F18 ! F19 !
! F16 ! F17 ! F18 ! F19 !
! keycode 114 ! keycode 72 ! keycode 87 ! keycode 88 !
!______________!______________!______________!______________!
! clear ! = ! / ! * !
! KP_Separator ! KP_Equal ! KP_Divide ! KP_Multiply !
! keycode 79 ! keycode 89 ! keycode 83 ! keycode 75 !
!______________!______________!______________!______________!
! 7 ! 8 ! 9 ! – !
! KP_7 ! KP_8 ! KP_9 ! KP_Subtract !
! keycode 97 ! keycode 99 ! keycode 100 ! keycode 86 !
!______________!______________!______________!______________!
! 4 ! 5 ! 6 ! + !
! KP_4 ! KP_5 ! KP_6 ! KP_Add !
! keycode 94 ! keycode 95 ! keycode 96 ! keycode 77 !
!______________!______________!______________!______________!
! 1 ! 2 ! 3 ! !
! KP_1 ! KP_2 ! KP_3 ! !
! keycode 91 ! keycode 92 ! keycode 93 ! Enter !
!______________!______________!______________! KP_Enter !
! 0 ! . ! keycode 84 !
! KP_0 ! KP_Decimal ! !
! keycode 90 ! keycode 73 ! !
!_____________________________!______________!______________!
November 9, 2018 at 17:02 #20415graywolfParticipantHello.
Likely the xmodmap command is launched before the keybord setup is completed in the remote session. Some key is already defined as modifier (e.g. Meta_L could be in use as Mod1) so the “add” expression fails.
You could take in account and change the script accordingly, but I think it’d be better if .cshrc is modified to avoid launching xmodmap in the case of remote NoMachine session, i.e.
if ( ! $?NX_SESSION_ID ) xmodmap ~/.Xmodmap
In the remote NoMachine session you can instruct NoMachine to run a custom script: use UserScriptAfterSessionStart and UserScriptAfterSessionReconnect in node.cfg.
Here you find some examples to create a custom script: Some examples to use custom scripts triggered on server and node events
-
AuthorPosts
This topic was marked as solved, you can't post.