Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
tmux.conf excerpt to toggle on/off session keybindings and prefix handling
bind -T root F12 \
set prefix None \;\
set key-table off \;\
set status-style "fg=$color_status_text,bg=$color_window_off_status_bg" \;\
set window-status-current-format "#[fg=$color_window_off_status_bg,bg=$color_window_off_status_current_bg]$separator_powerline_right#[default] #I:#W# #[fg=$color_window_off_status_current_bg,bg=$color_window_off_status_bg]$separator_powerline_right#[default]" \;\
set window-status-current-style "fg=$color_dark,bold,bg=$color_window_off_status_current_bg" \;\
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
bind -T off F12 \
set -u prefix \;\
set -u key-table \;\
set -u status-style \;\
set -u window-status-current-style \;\
set -u window-status-current-format \;\
refresh-client -S
wg_is_keys_off="#[fg=$color_light,bg=$color_window_off_indicator]#([ $(tmux show-option -qv key-table) = 'off' ] && echo 'OFF')#[default]"
set -g status-right "$wg_is_keys_off #{sysstat_cpu} | #{sysstat_mem} | #{sysstat_loadavg} | $wg_user_host"
@jasonbeach

This comment has been minimized.

Copy link

jasonbeach commented Oct 25, 2019

As an FYI, if you're on Ubuntu 16.04 (possibly only the mate desktop?) a terminal emulator called tilda uses the F12 key and intercepts it before tmux can.

@aberezin

This comment has been minimized.

Copy link

aberezin commented May 19, 2020

I get a "bad style bg= fg=" message when I hit F12 using this. Im a tmux newbie.

@NathanRV

This comment has been minimized.

Copy link

NathanRV commented May 25, 2020

I get a "bad style bg= fg=" message when I hit F12 using this. Im a tmux newbie.

You have to define the variables used with something like this :
#Variables
color_status_text="colour245"
color_window_off_status_bg="colour238"
color_light="white" #colour015
color_dark="colour232" # black= colour232
color_window_off_status_current_bg="colour254"

@bs

This comment has been minimized.

Copy link

bs commented May 28, 2020

This is amazingly useful. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.