From 050a97d3641974046f7c378d282dc0c5838e2519 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Thu, 16 Feb 2012 23:54:13 -0600 Subject: [PATCH] * usr/lib/byobu/menu, usr/share/byobu/keybindings/common, usr/share/byobu/keybindings/f-keys, usr/share/byobu/keybindings/f- keys.tmux, usr/share/byobu/keybindings/f-keys => usr/share/byobu/keybindings/f-keys.screen, usr/share/byobu/keybindings/Makefile.am, usr/share/byobu/keybindings/screen-escape-keys => usr/share/byobu/keybindings/f-keys.screen.disable: - keybindings for screen to match tmux for consistency --- debian/changelog | 8 ++ usr/lib/byobu/menu | 6 +- usr/share/byobu/keybindings/Makefile.am | 2 +- usr/share/byobu/keybindings/common | 2 +- usr/share/byobu/keybindings/f-keys | 85 +----------------- usr/share/byobu/keybindings/f-keys.screen | 89 +++++++++++++++++++ ...reen-escape-keys => f-keys.screen.disable} | 60 ++++++++----- usr/share/byobu/keybindings/f-keys.tmux | 2 +- 8 files changed, 141 insertions(+), 113 deletions(-) create mode 100644 usr/share/byobu/keybindings/f-keys.screen rename usr/share/byobu/keybindings/{screen-escape-keys => f-keys.screen.disable} (85%) diff --git a/debian/changelog b/debian/changelog index 93b09e5d..a075f355 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,14 @@ byobu (5.12) unreleased; urgency=low - keybindings for screen to match tmux for consistency * usr/bin/byobu-ctrl-a: - fix regression in byobu-screen ctrl-a handling + * usr/lib/byobu/menu, usr/share/byobu/keybindings/common, + usr/share/byobu/keybindings/f-keys, usr/share/byobu/keybindings/f- + keys.tmux, usr/share/byobu/keybindings/f-keys => + usr/share/byobu/keybindings/f-keys.screen, + usr/share/byobu/keybindings/Makefile.am, + usr/share/byobu/keybindings/screen-escape-keys => + usr/share/byobu/keybindings/f-keys.screen.disable: + - keybindings for screen to match tmux for consistency -- Dustin Kirkland Wed, 15 Feb 2012 22:22:12 -0600 diff --git a/usr/lib/byobu/menu b/usr/lib/byobu/menu index 3bde2934..aeee3722 100755 --- a/usr/lib/byobu/menu +++ b/usr/lib/byobu/menu @@ -3,9 +3,9 @@ # menu: display the menu text # # Copyright (C) 2008 Canonical Ltd. -# Copyright (C) 2011 Dustin Kirkland +# Copyright (C) 2011-2012 Dustin Kirkland # -# Authors: Dustin Kirkland +# Authors: Dustin Kirkland # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ __menu_detail() { __menu() { local bindings esc key text [ -r "$BYOBU_CONFIG_DIR/keybindings" ] && bindings="$BYOBU_CONFIG_DIR/keybindings" || bindings="$HOME/.screenrc" - if grep -qs "^source.*screen-escape-keys$" $bindings 2>/dev/null || [ "$1" = "--disable-f-keys" ]; then + if grep -qs "^source.*screen-escape-keys$" $bindings 2>/dev/null || grep -qs "^source.*f-keys.screen.disable$" $bindings 2>/dev/null || [ "$1" = "--disable-f-keys" ]; then esc=`grep "^escape" $bindings | $BYOBU_SED "s/.*^\(.\).*/\1/"` [ -n "$esc" ] && key="^$esc-@" || key="^a-@" elif grep -qs "^source.*none$" $bindings 2>/dev/null; then diff --git a/usr/share/byobu/keybindings/Makefile.am b/usr/share/byobu/keybindings/Makefile.am index 6b6dd027..444d77f1 100644 --- a/usr/share/byobu/keybindings/Makefile.am +++ b/usr/share/byobu/keybindings/Makefile.am @@ -1,2 +1,2 @@ keybindingsdir = $(datadir)/@PACKAGE@/keybindings -keybindings_DATA = common f-keys f-keys.tmux f-keys.tmux.disable none screen-escape-keys +keybindings_DATA = common f-keys f-keys.screen f-keys.screen.disable f-keys.tmux f-keys.tmux.disable none diff --git a/usr/share/byobu/keybindings/common b/usr/share/byobu/keybindings/common index 68bf9385..a6eeea96 100644 --- a/usr/share/byobu/keybindings/common +++ b/usr/share/byobu/keybindings/common @@ -1 +1 @@ -source $BYOBU_PREFIX/share/byobu/keybindings/f-keys +source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen diff --git a/usr/share/byobu/keybindings/f-keys b/usr/share/byobu/keybindings/f-keys index 5542ba3a..a6eeea96 100644 --- a/usr/share/byobu/keybindings/f-keys +++ b/usr/share/byobu/keybindings/f-keys @@ -1,84 +1 @@ -############################################################################### -# Byobu f-key keybindings -# This configuration profile is intended to provide a useful -# keybindings using the keyboard's f-keys -# -# Copyright (C) 2008-2011 Dustin Kirkland -# Nick Barcet -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -############################################################################### - -# Byobu's escape key is ASCII Dec:94, Hex:5E, Oct:136, Char: ctrl-^ -- ctrl-caret -# which is bound to F12 -escape ^^^^ -register x "^^" # | Goes with the F12 definition - -# F-keys seem to work well in both gnome-terminal and tty consoles -bindkey -k k1 $BYOBU_BACKEND -t config 0 byobu-config # F1 | Configuration (along with F9) - # | since F1 = Help in gnome-terminal -bindkey -k k2 $BYOBU_BACKEND # F2 | Create new window -bindkey -k k3 eval 'prev' 'fit' # F3 | Previous Window -bindkey "^[[1;2D" eval 'prev' 'fit' # shift-left | Previous Window -bindkey -k k4 eval 'next' 'fit' # F4 | Next Window -bindkey "^[[1;2C" eval 'next' 'fit' # shift-right | Next Window -register r ":source $BYOBU_CONFIG_DIR/profile^M" # | Goes with F5 definition -bindkey -k k5 eval 'process x' 'process r' # F5 | Reload profile -bindkey -k k6 detach # F6 | Detach from this session -bindkey -k k7 copy # F7 | Enter copy/scrollback mode -register t "A^[OH^k^h" # | Goes with the F8 definition -bindkey -k k8 eval 'process x' 'process t' # F8 | Re-title a window -bindkey -k k9 $BYOBU_BACKEND -t config 0 byobu-config # F9 | Configuration - # F10 | 'toolbar' in gnome-terminal - # F11 | 'Full Screen' in gnome-terminal -bindkey -k F2 process x # F12 | Byobu's escape key -bind $ $BYOBU_BACKEND -t status 0 byobu-status-detail # F12 $ | show detailed status -bind @ $BYOBU_BACKEND -t config 0 byobu-config # F12 @ | Configuration -bind R process r # F12 R | Reload profile -register s "[g G$>^h" # Goes with F12 ~ definition -bind ~ eval 'process x' 'process s' 'exec $BYOBU_SED -i -e "/./,/^$/!d" $BYOBU_RUN_DIR/printscreen' '$BYOBU_BACKEND -t PRINTSCREEN view $BYOBU_RUN_DIR/printscreen' # F12 ~ | write the buffer to file, open in a new window - -# Hotkeys for splits (gnome-terminal) -bindkey "^[O1;2Q" eval 'split' 'focus down' 'next' 'focus up' 'layout save byobu' 'layout autosave' # shift-F2 | horizontal split -bindkey "^[O1;5Q" eval 'split -v' 'focus down' 'next' 'focus up' 'layout save byobu' 'layout autosave' # ctrl-F2 | vertical split -bindkey "^[O1;2R" focus up # shift-F3 | focus up -bindkey "^[O1;2S" focus down # shift-F4 | focus down -bindkey "^[[15;2~" only # shift-F5 | kill all splits -bindkey "^[[17;5~" remove # ctrl-F6 | kill this split - -# Hotkeys for splits (tty) -bindkey "^[[26~" eval 'split' 'focus down' 'next' 'focus up' # shift-F2 | horizontal split - # ctrl-F2 | sadly, does not work in tty :-( -bindkey "^[[28~" focus up # shift-F3 | focus up -bindkey "^[[29~" focus down # shift-F4 | focus down -bindkey "^[[31~" only # shift-F5 | kill all splits - # ctrl-F6 | sadly, does not work in tty :-( - -# Make it more logical how to enter scrollback -register p "^[[5~" -bindkey "^[[5;3~" eval 'msgwait 0' 'msgminwait 0' 'copy' 'process p' 'msgwait 1' 'echo "Byobu scrollback mode (alt-pgup / alt-pgdown)"' # alt-pageup | scrollback -register n "^[[6~" -bindkey "^[[6;3~" eval 'msgwait 0' 'msgminwait 0' 'copy' 'process n' 'msgwait 1' 'echo "Byobu scrollback mode (alt-pgup / alt-pgdown)"' # alt-pagedn | scrollback - -# Make socket reconnection a little easier -bindkey "^[[15;5~" eval 'process x' 'process r' 'stuff ". $BYOBU_PREFIX/bin/byobu-reconnect-sockets^M"' # ctrl-F5 | reconnect gpg/ssh/x sockets - -# Detach from an auto-launched byobu, but don't log out of the shell -bindkey "^[[17;2~" eval 'exec touch $BYOBU_RUN_DIR/no-logout' 'detach' # shift-F6 | detach, but don't logout -bindkey "^[[32~" eval 'exec touch $BYOBU_RUN_DIR/no-logout' 'detach' # shift-F6 | detach, but don't logout - -# toggle f-key keybindings off -register d ":source $BYOBU_PREFIX/share/byobu/keybindings/screen-escape-keys^M" -bind ! eval 'process x' 'process d' 'backtick 111 9999999 9999999 byobu-status menu --disable-f-keys' # F12 ! | toggle on/off f-keys - -bindkey "^A" $BYOBU_BACKEND -t ctrl-a byobu-ctrl-a +source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen diff --git a/usr/share/byobu/keybindings/f-keys.screen b/usr/share/byobu/keybindings/f-keys.screen new file mode 100644 index 00000000..13c05aa4 --- /dev/null +++ b/usr/share/byobu/keybindings/f-keys.screen @@ -0,0 +1,89 @@ +############################################################################### +# Byobu f-key keybindings +# This configuration profile is intended to provide a useful +# keybindings using the keyboard's f-keys +# +# Copyright (C) 2008-2012 Dustin Kirkland +# Nick Barcet +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +############################################################################### + +# Byobu's escape key is ASCII Dec:94, Hex:5E, Oct:136, Char: ctrl-^ -- ctrl-caret +# which is bound to F12 +escape ^^^^ +register x "^^" # | Goes with the F12 definition + +# F-keys seem to work well in both gnome-terminal and tty consoles +bindkey -k k1 $BYOBU_BACKEND -t config 0 byobu-config # F1 | Configuration (along with F9) + # | since F1 = Help in gnome-terminal +bindkey "^[O1;2P" $BYOBU_BACKEND -t help 0 $BYOBU_PAGER $BYOBU_PREFIX/share/doc/byobu/help.screen.txt # shift-F1 | help +bindkey -k k2 $BYOBU_BACKEND # F2 | Create new window +bindkey "^[O1;5Q" eval 'split -v' 'focus down' 'next' 'focus up' 'layout save byobu' 'layout autosave' # ctrl-F2 | vertical split +bindkey "^[O1;2Q" eval 'split' 'focus down' 'next' 'focus up' 'layout save byobu' 'layout autosave' # shift-F2 | horizontal split +# No ctrl-shift-F2 (new session) in Screen +bindkey -k k3 eval 'prev' 'fit' # F3 | Previous Window +bindkey -k k4 eval 'next' 'fit' # F4 | Next Window +bindkey "^[[1;6D" eval 'prev' 'fit' # ctrl-shift-left | Previous Window +bindkey "^[[1;6C" eval 'next' 'fit' # ctrl-shift-right | Next Window +# No alt-up (previous session) in Screen +# No alt-down (next session) in Screen +bindkey "^[O1;2R" focus up # shift-F3 | focus up +bindkey "^[O1;2S" focus down # shift-F4 | focus down +bindkey "^[[1;2A" focus up # shift-up | focus up +bindkey "^[[1;2B" focus down # shift-up | focus down +bindkey "^[[1;2D" focus up # shift-left | focus up +bindkey "^[[1;2C" focus down # shift-right | focus down +# No ctrl-shift-F3 (move pane) in Screen +# No ctrl-shift-F4 (move pane) in Screen +bindkey "^[[1;5A" resize +1 # ctrl-up | resize +1 +bindkey "^[[1;5B" resize -1 # ctrl-down | resize -1 +bindkey "^[[1;5D" resize -1 # ctrl-left | resize -1 +bindkey "^[[1;5C" resize +1 # ctrl-right | resize +1 +register r ":source $BYOBU_CONFIG_DIR/profile^M" # | Goes with F5 definition +bindkey -k k5 eval 'process x' 'process r' # F5 | Reload profile +bindkey "^[[15;5~" eval 'process x' 'process r' 'stuff ". $BYOBU_PREFIX/bin/byobu-reconnect-sockets^M"' # ctrl-F5 | reconnect gpg/ssh/x sockets +bindkey "^[[15;6~" $BYOBU_BACKEND -t color 0 byobu-select-profile # ctrl-shift-F5 | choose a background color +bindkey "^[[15;2~" only # shift-F5 | kill all splits +bindkey "^[[31~" only # shift-F5 | kill all splits +bindkey -k k6 detach # F6 | Detach from this session +bindkey "^[[17;2~" eval 'exec touch $BYOBU_RUN_DIR/no-logout' 'detach' # shift-F6 | detach, but don't logout +bindkey "^[[32~" eval 'exec touch $BYOBU_RUN_DIR/no-logout' 'detach' # shift-F6 | detach, but don't logout +bindkey "^[[17;5~" remove # ctrl-F6 | kill this split + # ctrl-F6 | sadly, does not work in tty :-( +bindkey -k k7 copy # F7 | Enter copy/scrollback mode +register p "^[[5~" +bindkey "^[[5;3~" eval 'msgwait 0' 'msgminwait 0' 'copy' 'process p' 'msgwait 1' 'echo "Byobu scrollback mode (alt-pgup / alt-pgdown)"' # alt-pageup | scrollback +register n "^[[6~" +bindkey "^[[6;3~" eval 'msgwait 0' 'msgminwait 0' 'copy' 'process n' 'msgwait 1' 'echo "Byobu scrollback mode (alt-pgup / alt-pgdown)"' # alt-pagedn | scrollback +register t "A^[OH^k^h" # | Goes with the F8 definition +bindkey -k k8 eval 'process x' 'process t' # F8 | Re-title a window +# No ctrl-F8 (restore layout) in Screen +# No ctrl-shift-F8 (save layout) in Screen +bindkey -k k9 $BYOBU_BACKEND -t config 0 byobu-config # F9 | Configuration + # F10 | 'toolbar' in gnome-terminal + # F11 | 'Full Screen' in gnome-terminal +# No alt-F11 (break pane) in Screen +# No ctrl-F11 (join pane) in Screen +# No shift-F11 (join pane) in Screen +bindkey -k F2 process x # F12 | Byobu's escape key +bind $ $BYOBU_BACKEND -t status 0 byobu-status-detail # F12 $ | show detailed status +bind @ $BYOBU_BACKEND -t config 0 byobu-config # F12 @ | Configuration +bind R process r # F12 R | Reload profile +register s "[g G$>^h" # Goes with F12 ~ definition +bind ~ eval 'process x' 'process s' 'exec $BYOBU_SED -i -e "/./,/^$/!d" $BYOBU_RUN_DIR/printscreen' '$BYOBU_BACKEND -t PRINTSCREEN view $BYOBU_RUN_DIR/printscreen' # F12 ~ | write the buffer to file, open in a new window + +register d ":source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen.disable^M" +bind ! eval 'process x' 'process d' 'backtick 111 9999999 9999999 byobu-status menu --disable-f-keys' # F12 ! | toggle on/off f-keys + +bindkey "^A" $BYOBU_BACKEND -t ctrl-a byobu-ctrl-a diff --git a/usr/share/byobu/keybindings/screen-escape-keys b/usr/share/byobu/keybindings/f-keys.screen.disable similarity index 85% rename from usr/share/byobu/keybindings/screen-escape-keys rename to usr/share/byobu/keybindings/f-keys.screen.disable index 2429afac..a9bb53d8 100644 --- a/usr/share/byobu/keybindings/screen-escape-keys +++ b/usr/share/byobu/keybindings/f-keys.screen.disable @@ -2,7 +2,7 @@ # Disable Byobu's f-key keybindings, define a set using Screen's escape # sequence. # -# Copyright (C) 2009 Dustin Kirkland +# Copyright (C) 2009-2012 Dustin Kirkland # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,25 +24,6 @@ escape ^Aa register x "^A" -# Disable the f-key bindings -bindkey -k k2 -bindkey -k k3 -bindkey -k k4 -bindkey -k k5 -bindkey -k k6 -bindkey -k k7 -bindkey -k k8 -bindkey -k k9 -bindkey -k F2 -bindkey "^[O1;2Q" -bindkey "^[O1;5Q" -bindkey "^[O1;2R" -bindkey "^[O1;2S" -bindkey "^[[15;2~" -bindkey "^[[17;2~" -bindkey "^[[15;5~" -bindkey "^[[17;2~" - # Use the following sequences for byobu functionality # SEQUENCE ACTION F-Key equivalent # ctrl-a-c Create a new window F2 @@ -59,9 +40,42 @@ bind @ $BYOBU_BACKEND -t config 0 byobu-config # ctrl-a-$ Show detailed status bind $ $BYOBU_BACKEND -t status 0 byobu-status-detail # ctrl-a-! Toggle f-key keybindings on -register e ":source $BYOBU_PREFIX/share/byobu/keybindings/f-keys^M" +register e ":source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen^M" bind ! eval 'process x' 'process e' 'backtick 111 9999999 9999999 byobu-status menu' -bindkey "^[[1;2C" +# Disable the f-key bindings +bindkey -k k1 +bindkey "^[O1;2P" +bindkey -k k2 +bindkey "^[O1;5Q" +bindkey "^[O1;2Q" +bindkey -k k3 +bindkey -k k4 +bindkey "^[[1;6D" +bindkey "^[[1;6C" +bindkey "^[O1;2R" +bindkey "^[O1;2S" +bindkey "^[[1;2A" +bindkey "^[[1;2B" bindkey "^[[1;2D" - +bindkey "^[[1;2C" +bindkey "^[[1;5A" +bindkey "^[[1;5B" +bindkey "^[[1;5D" +bindkey "^[[1;5C" +bindkey -k k5 +bindkey "^[[15;5~" +bindkey "^[[15;6~" +bindkey "^[[15;2~" +bindkey "^[[31~" +bindkey -k k6 +bindkey "^[[17;2~" +bindkey "^[[32~" +bindkey "^[[17;5~" +bindkey -k k7 +bindkey "^[[5;3~" +bindkey "^[[6;3~" +bindkey -k k8 +bindkey -k k9 +bindkey -k F2 +bindkey "^A" diff --git a/usr/share/byobu/keybindings/f-keys.tmux b/usr/share/byobu/keybindings/f-keys.tmux index 694c7f85..0f3707c5 100644 --- a/usr/share/byobu/keybindings/f-keys.tmux +++ b/usr/share/byobu/keybindings/f-keys.tmux @@ -1,7 +1,7 @@ ############################################################################### # byobu's tmux f-key keybindings # -# Copyright (C) 2011 Dustin Kirkland +# Copyright (C) 2011-2012 Dustin Kirkland # # Authors: Dustin Kirkland #