'Rebinding tmux prefix to alt key

I'd like to change the tmux prefix from ctrl+b to a single key, specifically alt. Tried set-option -g prefix M, but it said bad key.

Anyone know how to accomplish this without having to create a macro on my entire system making alt trigger ctrl+b?

I'd settle for a macro that only triggers when inside of a tmux session.



Solution 1:[1]

A possible workaround is to use tmux's root table instead of the prefix key table (see bind-key in man page). To do this, you need to pass the -n argument to the bind-key command. This does imply that you will have to re-bind all the commands in your .tmux.conf that you want to support.

An example of how to create a window using alt+c is:

bind -n M-c new-window

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1