From 90a7b74f9fc648822ca62e5cc9a6d8336a0e3fcf Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Tue, 2 Nov 2010 16:18:27 -0500 Subject: [PATCH] usr/lib/byobu/.notify_osd, usr/lib/byobu/notify_osd, usr/share/byobu/profiles/common: separate the perl into a script of its own --- debian/changelog | 3 +++ usr/lib/byobu/.notify_osd | 31 +++++++++++++++++++++++++++++++ usr/lib/byobu/notify_osd | 11 +++++------ usr/share/byobu/profiles/common | 2 +- 4 files changed, 40 insertions(+), 7 deletions(-) create mode 100755 usr/lib/byobu/.notify_osd diff --git a/debian/changelog b/debian/changelog index fce93cec..11ddf6e4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,9 @@ byobu (3.7) unreleased; urgency=low usr/lib/byobu/notify_osd, usr/share/byobu/profiles/common, usr/share/man/man1/byobu.1: - add notify_osd support to byobu, LP: #669189 + * usr/lib/byobu/.notify_osd, usr/lib/byobu/notify_osd, + usr/share/byobu/profiles/common: separate the perl into a script of + its own -- Dustin Kirkland Thu, 21 Oct 2010 12:09:14 -0500 diff --git a/usr/lib/byobu/.notify_osd b/usr/lib/byobu/.notify_osd new file mode 100755 index 00000000..96adcc4f --- /dev/null +++ b/usr/lib/byobu/.notify_osd @@ -0,0 +1,31 @@ +#!/usr/bin/perl +# +# .notify_osd: perform some string manipulation on notify-osd messages +# and then send to the screen message window +# 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 . + +$/ = "\n\n"; +while () { + $msg = $_; + $msg =~ s/\[[^,]*, //; + $msg =~ s/ \] /: /; + $msg =~ s/\s+/ /g; + $msg =~ s/\s+$//g; + $msg =~ s/^\s+//g; + system("/usr/bin/screen", "-X", "at", "0", "echo", "[$msg]"); +} diff --git a/usr/lib/byobu/notify_osd b/usr/lib/byobu/notify_osd index 0fb89db3..ceb60df5 100755 --- a/usr/lib/byobu/notify_osd +++ b/usr/lib/byobu/notify_osd @@ -27,9 +27,8 @@ 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 \"$_\""); - }' +if ! ps -ef | grep -qs "^$USER .*tail -n 0 -F \"$LOG\"$"; then + tail -n 0 -F "$LOG" | /usr/lib/byobu/.notify_osd +else + exit 0 +fi diff --git a/usr/share/byobu/profiles/common b/usr/share/byobu/profiles/common index de8de4f4..a9455d95 100644 --- a/usr/share/byobu/profiles/common +++ b/usr/share/byobu/profiles/common @@ -23,7 +23,7 @@ # Now, let's override with our customizations startup_message off vbell off -msgwait 1 +msgwait 5 defutf8 on # Define status commands