From 2462d47e90728c5217710b87896fd3dc940d78ac Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Thu, 16 Jan 2014 17:45:56 -0600 Subject: [PATCH] * usr/lib/byobu/session, usr/share/byobu/keybindings/f-keys.screen, usr/share/byobu/keybindings/f-keys.screen.disable, usr/share/byobu/status/status: LP: #1255139 - add support for screen session names in the status item - only display when more than one session in tmux, always displayed by default in screen, where we have more real estate - support the Ctrl-F8 hotkey in screen too, to rename session --- debian/changelog | 7 ++++++ usr/lib/byobu/session | 24 ++++++++++++++----- usr/share/byobu/keybindings/f-keys.screen | 4 +++- .../byobu/keybindings/f-keys.screen.disable | 1 + usr/share/byobu/status/status | 4 ++-- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index 32974432..05fc076b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,13 @@ byobu (5.70) unreleased; urgency=low - change the rarely used Ctrl-F8 keybinding to rename the current session - move the restore-a-split-layout to Shift-Alt-F8 + * usr/lib/byobu/session, usr/share/byobu/keybindings/f-keys.screen, + usr/share/byobu/keybindings/f-keys.screen.disable, + usr/share/byobu/status/status: LP: #1255139 + - add support for screen session names in the status item + - only display when more than one session in tmux, always displayed by + default in screen, where we have more real estate + - support the Ctrl-F8 hotkey in screen too, to rename session -- Dustin Kirkland Tue, 17 Dec 2013 14:27:43 -0700 diff --git a/usr/lib/byobu/session b/usr/lib/byobu/session index 3d33d6a4..fffeb172 100755 --- a/usr/lib/byobu/session +++ b/usr/lib/byobu/session @@ -24,12 +24,24 @@ __session_detail() { __session() { # Note: This will only work in byobu-tmux - local count=$(tmux list-sessions 2>/dev/null | wc -l) - if [ $count -gt 1 ]; then - color u W k; printf "$ICON_SESSION#S"; color -- - else - echo - fi + case "$BYOBU_BACKEND" in + tmux) + local count=$(tmux list-sessions 2>/dev/null | wc -l) + if [ $count -gt 1 ]; then + color u W k; printf "${ICON_SESSION}#S"; color -- + else + echo + fi + ;; + screen) + local count=$(screen -ls | grep "^ .*\)$" | wc -l) + if [ $count -gt 1 ]; then + color u W k; printf "${ICON_SESSION}%S"; color -- + else + echo + fi + ;; + esac } # vi: syntax=sh ts=4 noexpandtab diff --git a/usr/share/byobu/keybindings/f-keys.screen b/usr/share/byobu/keybindings/f-keys.screen index 3294b803..9c1ba1b5 100644 --- a/usr/share/byobu/keybindings/f-keys.screen +++ b/usr/share/byobu/keybindings/f-keys.screen @@ -68,7 +68,9 @@ 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 +register u ":sessionname " # | Goes with the Ctrl-F8 definition +bindkey "^[[19;5~" eval 'process x' 'process u' # Ctrl-F8 | Re-title a session +# No alt-shift-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 register s "[g G$>^h" # Goes with Shift-F7 and F12 ~ definition diff --git a/usr/share/byobu/keybindings/f-keys.screen.disable b/usr/share/byobu/keybindings/f-keys.screen.disable index 9f67985f..3c9ce9a8 100644 --- a/usr/share/byobu/keybindings/f-keys.screen.disable +++ b/usr/share/byobu/keybindings/f-keys.screen.disable @@ -77,5 +77,6 @@ bindkey "^[[18;2~" bindkey "^[[5;3~" bindkey "^[[6;3~" bindkey -k k8 +bindkey "^[[19;5~" bindkey -k k9 bindkey -k F2 diff --git a/usr/share/byobu/status/status b/usr/share/byobu/status/status index f5ffc21f..25f3ec13 100644 --- a/usr/share/byobu/status/status +++ b/usr/share/byobu/status/status @@ -25,11 +25,11 @@ # Screen has two status lines, with 4 quadrants for status screen_upper_left="color" screen_upper_right="color whoami hostname ip_address menu" -screen_lower_left="color logo distro release #arch" +screen_lower_left="color logo distro release #arch session" screen_lower_right="color network #disk_io custom #entropy raid reboot_required updates_available #apport #services #mail users uptime #ec2_cost #rcs_cost #fan_speed #cpu_temp battery wifi_quality #processes load_average cpu_count cpu_freq memory #swap #disk #time_utc date time" # Tmux has one status line, with 2 halves for status -tmux_left="logo #distro release #arch #session" +tmux_left="logo #distro release #arch session" # You can have as many tmux right lines below here, and cycle through them using Shift-F5 tmux_right="#network #disk_io #custom #entropy raid reboot_required updates_available #apport #services #mail #users uptime #ec2_cost #rcs_cost #fan_speed #cpu_temp #battery #wifi_quality #processes load_average cpu_count cpu_freq memory #swap #disk #whoami #hostname #ip_address #time_utc date time" #tmux_right="network #disk_io #custom entropy raid reboot_required updates_available #apport #services #mail users uptime #ec2_cost #rcs_cost fan_speed cpu_temp battery wifi_quality #processes load_average cpu_count cpu_freq memory #swap #disk whoami hostname ip_address #time_utc date time"