TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

ALT+Fn combinations - tmux VS xterm

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Unix Shell
View previous topic :: View next topic  
Author Message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Wed Aug 27, 2014 8:59 am    Post subject: ALT+Fn combinations - tmux VS xterm Reply with quote

I found out that the ALT+Fn(1-12) code returned by TinTin running on tmux is different that the one returned when running on xterm...

The strange thing is that all the other codes seems the same, F1-F12 and CTRL/SHIFT combinations, even the ones for the numeric keypad, all seems working the same, except for the ALT+Fn...

Is there a simple way, not persistent, maybe on command line to launch either xterm or tmux with the same behaviour ?

I tried to export TERM=xterm on tmux because it was set on "screen" by default, but nothing changed...

I'm using tmux on Cygwin if it can make some difference.


EDIT: just to show some example codes

--- F5 ---
xterm = \e[15~
tmux = \e[15~

--- ALT+F5 ---
xterm = \e[15;3~
tmux = \e\e[15~

EDIT: found out something

$ tmux set-window-option -g xterm-keys

xterm = \e[15;3~
tmux = \e[15;3~

Anyway I found that xterm has many configurations, and I was wrong when I told that the other combinations are the same... by default the CTRL+Fn keys are different, but if I activate "Old Function-Keys", then those codes becomes the same, but then xterm returns ALT+Fn as if was just Fn...

EDIT: Well... CTRL+F1 and CTRL+F2 are the same but not the others... what a mess...

EDIT: This works for changing keybindings on xterm at launch

Code:
$ xterm -xrm 'XTerm*VT100*translations: #override \nCtrl<Key>F5: string("\\e[28~")\n'


it show the correct code on TinTin, but it does not launch the associated macro...

EDIT: For now the working solution is like that, using tmux codes as a base, and changing accordingly the ones on xterm (anyway it's tmux/screen that create a mess when converting codes)

tmux on CygWin must be set like this "options -> Terminal -> xterm-vt220"

xterm must be launched like this (with every binding, but this code contains only CTRL+F5)
Code:
$ xterm -xrm 'XTerm*VT100*translations: #override \nCtrl<Key>F5: string(^[[28~)\n'


EDIT: ...seems like tmux uses many SHIFT+Fn combinations with the same codes of CTRL+Fn ... so you can't use both of them

EDIT: Still issues WTF !! I need a drink...

here is the complete table of Fn codes from tmux (with xterm-keys on and Cygwin terminal set on "xterm")

Code:

F1       F2       F3       F4       F5        F6        F7        F8        F9        F10       F11       F12
\eOP     \eOQ     \eOR     \eOS     \e[15~    \e[17~    \e[18~    \e[19~    \e[20~    \e[21~    \e[23~    \e[24~

SHIFT+
\e[25~   \e[26~   \e[28~   \e[29~   \e[31~    \e[32~    \e[33~    \e[34~    \e[20;2~  \e[21;2~  \e[23;2~  \e[24;2~

CTRL+
\e[1;5P  \e[1;5Q  \e[1;5R  \e[1;5S  \e[15;5~  \e[17;5~  \e[18;5~  \e[19;5~  \e[20;5~  \e[21;5~  \e[23;5~  \e[24;5~

ALT+
\e[1;3P  \e[1;3Q  \e[1;3R  \e[1;3S  \e[15;3~  \e[17;3~  \e[18;3~  \e[19;3~  \e[20;3~  \e[21;3~  \e[23;3~  \e[24;3~

CTRL+ALT+
\e[1;7P  \e[1;7Q  \e[1;7R  \e[1;7S  \e[15;7~  \e[17;7~  \e[18;7~  \e[19;7~  \e[20;7~  \e[21;7~  \e[23;7~  \e[24;7~


and here the xterm codes

Code:

F1       F2       F3       F4       F5        F6        F7        F8        F9        F10       F11       F12
\eOP     \eOQ     \eOR     \eOS     \e[15~    \e[17~    \e[18~    \e[19~    \e[20~    \e[21~    \e[23~    \e[24~

SHIFT+
\e[1;2P  \e[1;2Q  \e[1;2R  \e[1;2S  \e[15;2~  \e[17;2~  \e[18;2~  \e[19;2~  \e[20;2~  \e[21;2~  \e[23;2~  \e[24;2~

CTRL+
\e[1;5P  \e[1;5Q  \e[1;5R  \e[1;5S  \e[15;5~  \e[17;5~  \e[18;5~  \e[19;5~  \e[20;5~  \e[21;5~  \e[23;5~  \e[24;5~

ALT+
\e[1;3P  \e[1;3Q  \e[1;3R  [USED]   \e[15;3~  \e[17;3~  \e[18;3~  \e[19;3~  \e[20;3~  \e[21;3~  \e[23;3~  \e[24;3~

CTRL+ALT+
- NOT WORKING -


...now seems that only the SHIFT combinations differs... and CTRL+ALT returns nothing...

EDIT: another try...

Code:
xterm -xrm 'XTerm*VT100*translations: #override \nShift<Key>F5: string('$(echo -e "\033")'[31~)\n'


EDIT: near... but not perfect... all Fn combination codes are the same... BUT no keypad support in tmux...

both Cygwin terminals set to "xterm"

xterm
Code:
xterm -rv -xrm 'XTerm*VT100.numLock: false' -xrm 'XTerm*VT100*translations: #override \nShift<Key>F1: string('$(echo -e "\033")'[25~)\nShift<Key>F2: string('$(echo -e "\033")'[26~)\nShift<Key>F3: string('$(echo -e "\033")'[28~)\nShift<Key>F4: string('$(echo -e "\033")'[29~)\nShift<Key>F5: string('$(echo -e "\033")'[31~)\nShift<Key>F6: string('$(echo -e "\033")'[32~)\nShift<Key>F7: string('$(echo -e "\033")'[33~)\nShift<Key>F8: string('$(echo -e "\033")'[34~)\nShift<Key>F9: string('$(echo -e "\033")'[20;2~)\nShift<Key>F10: string('$(echo -e "\033")'[21;2~)\nShift<Key>F11: string('$(echo -e "\033")'[23;2~)\nShift<Key>F12: string('$(echo -e "\033")'[24;2~)\n'


tmux
Code:
echo "set-window-option -g xterm-keys" > tmuxtmp.conf;
tmux -f tmuxtmp.conf
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Unix Shell All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group