diff --git a/debian/changelog b/debian/changelog index 45727201..1c2ffd80 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,13 +10,16 @@ screen-profiles (1.43) unreleased; urgency=low items that require an action (reboot, updates) * profiles/profile.skel: move reboot-required and updates-available to the early part of the status string, since these require action + * screen-profiles-status: new, central script for all status actions; + allows us to centralize some things, like enable/disable checking + and process nice-ness [ Raphaƫl Pinson and Dustin Kirkland ] * bin/battery, bin/users, bin/uptime, profiles/common, screen-profiles: added new status items for battery state, number of users, and system uptime - -- Dustin Kirkland Fri, 03 Apr 2009 12:42:53 -0500 + -- Dustin Kirkland Fri, 03 Apr 2009 13:07:57 -0700 screen-profiles (1.42-0ubuntu1) jaunty; urgency=low diff --git a/screen-profiles-status b/screen-profiles-status new file mode 100755 index 00000000..29ac2ce7 --- /dev/null +++ b/screen-profiles-status @@ -0,0 +1,44 @@ +#!/bin/sh -e +# +# select-screen-profile +# Copyright (C) 2008 Canonical Ltd. +# +# Authors: 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 . + +# Let's try to be really "nice" about gathering status: +renice 10 $$ >/dev/null 2>&1 || true +ionice -c3 -p $$ >/dev/null 2>&1 || true + +DIR="/var/lib/screen-profiles" +P="$1" + +case "$P" in + # default = on, user must override to turn off + cpu-count|cpu-freq|load-average|logo|mem-available|mem-used|menu|reboot-required|release|updates-available) + grep -qs "^$P=0$" "$HOME/.screen-profiles/status" && exit 0 + ;; + # default = off, user must override to turn on + arch|battery|ec2-cost|hostname|processes|uptime|users|whoami) + grep -qs "^$P=1$" "$HOME/.screen-profiles/status" || exit 0 + ;; + *) + exit 1 + ;; +esac + +if [ -f "$DIR"/"$P" -a -x "$DIR"/"$P" ]; then + exec "$DIR"/"$P" +fi