From 02ae6fc4d535b1ef9ee00c3e58dc9893d82c5755 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Sun, 31 Oct 2010 14:31:32 -0400 Subject: [PATCH] * etc/byobu/statusrc, usr/bin/byobu-config, usr/lib/byobu/Makefile.am, usr/lib/byobu/notify_osd, usr/share/byobu/profiles/common, usr/share/man/man1/byobu.1: - add notify_osd support to byobu, LP: #669189 --- debian/changelog | 4 ++++ etc/byobu/statusrc | 1 + usr/bin/byobu-config | 1 + usr/lib/byobu/Makefile.am | 2 +- usr/lib/byobu/notify_osd | 35 +++++++++++++++++++++++++++++++++ usr/share/byobu/profiles/common | 1 + usr/share/man/man1/byobu.1 | 2 ++ 7 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 usr/lib/byobu/notify_osd diff --git a/debian/changelog b/debian/changelog index 97c1447b..b3d3c0bc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,10 @@ byobu (3.7) unreleased; urgency=low * usr/lib/byobu/ec2_cost, usr/share/byobu/ec2/rates.eu_ie, usr/share/byobu/ec2/rates.us_ca, usr/share/byobu/ec2/rates.us_va: - add ec2_cost support for t1.micro instances + * etc/byobu/statusrc, usr/bin/byobu-config, usr/lib/byobu/Makefile.am, + usr/lib/byobu/notify_osd, usr/share/byobu/profiles/common, + usr/share/man/man1/byobu.1: + - add notify_osd support to byobu, LP: #669189 -- Dustin Kirkland Thu, 21 Oct 2010 12:09:14 -0500 diff --git a/etc/byobu/statusrc b/etc/byobu/statusrc index 1d9a821f..3191d193 100644 --- a/etc/byobu/statusrc +++ b/etc/byobu/statusrc @@ -41,6 +41,7 @@ mem_available=1 mem_used=1 menu=1 network=0 +notify_osd=1 processes=0 rcs_cost=0 reboot_required=1 diff --git a/usr/bin/byobu-config b/usr/bin/byobu-config index fb9d9a5b..31ec7969 100755 --- a/usr/bin/byobu-config +++ b/usr/bin/byobu-config @@ -305,6 +305,7 @@ def readstatus(): status["mem_used"]=1 status["menu"]=1 status["network"]=0 + status["notify_osd"]=1 status["processes"]=0 status["rcs_cost"]=0 status["reboot_required"]=1 diff --git a/usr/lib/byobu/Makefile.am b/usr/lib/byobu/Makefile.am index 6c4eb6be..ecffe2ab 100644 --- a/usr/lib/byobu/Makefile.am +++ b/usr/lib/byobu/Makefile.am @@ -1,3 +1,3 @@ libdirdir = $(prefix)/lib/@PACKAGE@ -libdir_SCRIPTS = apport arch battery cpu_count cpu_freq cpu_temp custom date disk disk_io ec2_cost fan_speed hostname ip_address load_average logo mail mem_available mem_used menu network processes rcs_cost reboot_required release services time time_utc updates_available uptime users whoami wifi_quality +libdir_SCRIPTS = apport arch battery cpu_count cpu_freq cpu_temp custom date disk disk_io ec2_cost fan_speed hostname ip_address load_average logo mail mem_available mem_used menu network notify_osd processes rcs_cost reboot_required release services time time_utc updates_available uptime users whoami wifi_quality diff --git a/usr/lib/byobu/notify_osd b/usr/lib/byobu/notify_osd new file mode 100644 index 00000000..0fb89db3 --- /dev/null +++ b/usr/lib/byobu/notify_osd @@ -0,0 +1,35 @@ +#!/bin/sh -e +# +# notify_osd: print notify-osd messages in screen's notification buffer +# Copyright (C) 2010 Canonical Ltd. +# +# Authors: Dustin Kirkland +# with help from Mathias Gug +# +# 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 . + +LOG="$HOME"/.cache/notify-osd.log + +if [ "$1" = "--detail" ]; then + cat "$LOG" + exit 0 +fi + +# This line operates basically as a daemon, watching the notify-osd log file, +# processing new messages and sending them to screen +tail -n 0 -F "$LOG" | perl -e ' + $/ = "\n\n"; + while () { + $_ =~ s/^.*\]//; + system("/usr/bin/screen -X at 0 echo \"$_\""); + }' diff --git a/usr/share/byobu/profiles/common b/usr/share/byobu/profiles/common index a2e15d97..de8de4f4 100644 --- a/usr/share/byobu/profiles/common +++ b/usr/share/byobu/profiles/common @@ -36,6 +36,7 @@ defutf8 on backtick 10 9999999 9999999 byobu-janitor backtick 11 9999999 9999999 printf "\005-1=" backtick 12 9999999 9999999 byobu-status color +backtick 13 0 0 byobu-status notify_osd backtick 99 9999999 9999999 byobu-status logo backtick 100 599 599 byobu-status release backtick 101 7 7 byobu-status updates_available diff --git a/usr/share/man/man1/byobu.1 b/usr/share/man/man1/byobu.1 index b55a0049..a629dca3 100644 --- a/usr/share/man/man1/byobu.1 +++ b/usr/share/man/man1/byobu.1 @@ -58,6 +58,8 @@ byobu \- wrapper script for seeding a user's byobu configuration and launching s \fBnetwork\fP \- instantaneous upload/download bandwidth in [GMk]bps over the last 3 seconds; displayed in the lower bar toward the right in white text on a purple background with a leading '^' sign indicating 'up' and 'v' sign indicating 'down'; override the default interface by specifying an alternate interface with MONITORED_NETWORK=eth1, and override the default units (bits) with NETWORK_UNITS=bytes in \fI$HOME/.byobu/statusrc\fP +\fBnotify_osd\fP \- Send on-screen notification messages to screen's notification buffer + \fBprocesses\fP \- total number of processes running on the system; displayed in the lower bar in white text on a dark yellow background with a trailing '&' indicating 'background processes' \fBreboot_required\fP \- symbol present if a reboot is required following a system update; displayed in the lower bar white text on a blue background by the symbol '(R)'; additionally, reboot_required will print '' in white text on a blue background, if Byobu requires you to reload your profile to affect some changes.