diff --git a/byobu-janitor b/byobu-janitor index 2842685c..7bbf4fc3 100755 --- a/byobu-janitor +++ b/byobu-janitor @@ -52,21 +52,42 @@ if [ -d "$HOME/.$OLDPKG" ] && [ ! -e "$HOME/.$PKG" ]; then # Rename the config dir mv -f "$HOME/.$OLDPKG" "$HOME/.$PKG" ln -sf "$HOME/.$PKG" "$HOME/.$OLDPKG" - # Fix the chosen profile symlink - if [ -h "$PROFILE" ]; then - # Determine the chosen profile color - profile=`readlink "$PROFILE" | sed "s:^.*-::"` - # Try to set that color, if it exists, otherwise set to default - byobu-select-profile -s "$profile" >/dev/null 2>&1 || byobu-select-profile -s "$DEFAULT_PROFILE" >/dev/null 2>&1 - fi # Replace all instances of the old package name with the new sed -i "s/$OLDPKG/$PKG/g" "$HOME/.$PKG"/* || true fi -# Affects: First runs with no configuration +# Affects: First runs with no configuration, or broken profile symlinks # Seed the configuration [ -d "$HOME/.$PKG" ] || mkdir -p "$HOME/.$PKG" -[ -r "$PROFILE" ] || byobu-select-profile -s "$DEFAULT_PROFILE" >/dev/null 2>&1 +if [ ! -r "$PROFILE" ]; then + # Set default colors + BG=W + FG=k + if [ -h "$PROFILE" ]; then + # Symlink is broken; try to guess chosen colors + color=$(ls -l "$PROFILE" | sed "s/^.* //") + case $color in + black|dark) BG=k; FG=W;; + dark_blue) BG=b; FG=W;; + dark_cyan) BG=c; FG=W;; + dark_green) BG=g; FG=W;; + dark_purple) BG=m; FG=W;; + dark_red) BG=r; FG=W;; + dark_yellow) BG=y; FG=W;; + light) BG=W; FG=k;; + light_blue) BG=B; FG=k;; + light_cyan) BG=C; FG=k;; + light_green) BG=G; FG=k;; + light_purple) BG=M; FG=k;; + light_red) BG=R; FG=k;; + light_yellow) BG=Y; FG=k;; + *) BG=W; FG=k;; + esac + fi + byobu-select-profile -b $BG -f $FG >/dev/null 2>&1 + rm -f "$PROFILE" 2>/dev/null + ln -s /usr/share/$PKG/profiles/common "$PROFILE" +fi [ -s "$HOME/.$PKG/keybindings" ] || echo "source /usr/share/$PKG/keybindings/common" > "$HOME/.$PKG/keybindings" [ -r "$HOME/.$PKG/status" ] || touch "$HOME/.$PKG/status" [ -r "$HOME/.$PKG/windows" ] || touch "$HOME/.$PKG/windows" diff --git a/byobu-select-profile b/byobu-select-profile index f39296dc..6ce83bf9 100755 --- a/byobu-select-profile +++ b/byobu-select-profile @@ -30,9 +30,10 @@ COLORS="black blue cyan green purple red grey yellow" usage () { cat < to activate these changes.\n\nOtherwise, exit this screen session and start a new one.'` - else - echo `gettext 'Run "byobu" to activate'` - fi - echo - break - fi - done - if [ $found -eq 0 ]; then - echo "Invalid profile" - fi -} - getletter() { + count=$(echo "$1" | wc -c) + if [ "$count" = "2" ]; then + echo "$1" + return + fi desc=$(echo "$1" | awk -F"_" '{print $1}') color=$(echo "$1" | awk -F"_" '{print $2}') COLORS="black blue cyan green purple red grey yellow" @@ -195,11 +167,6 @@ if [ $# -eq 0 ]; then else while true; do case "$1" in - -s|--set) - setprofile "$2" - shift 2 - break - ;; -b|--background) setcolor "background" "$2" shift 2 diff --git a/byobu-select-profile.1 b/byobu-select-profile.1 index 1db20472..3ee0175e 100644 --- a/byobu-select-profile.1 +++ b/byobu-select-profile.1 @@ -1,16 +1,14 @@ -.TH select\-byobu\-profile 1 "14 Dec 2008" byobu "byobu" +.TH byobu\-select\-profile 1 "4 Dec 2009" byobu "byobu" .SH NAME -select\-byobu\-profile \- Screen Profile Selector +byobu\-select\-profile \- select your Byobu foreground and background colors .SH DESCRIPTION -\fBselect\-byobu\-profile\fP is an application that lists the available byobu screen profiles on a system and prompts the user to select one. - -The selected profile will be symbolically linked into the current user's $HOME/.byobu/profile, if that file does not yet exist, or is currently a symbolic link. +\fBbyobu\-select\-profile\fP is an application that lists the available Byobu colors and allows you to select the foreground and background color. .SH "SEE ALSO" .PD 0 .TP -\fBscreen\fP(1) +\fBbyobu\fP(1) .TP \fIhttp://launchpad.net/byobu\fP diff --git a/debian/changelog b/debian/changelog index be32dce8..0a49dcdc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -32,6 +32,11 @@ byobu (2.40) unreleased; urgency=low profiles_generator/generate, profiles_generator/profile.skel, rpm/byobu.spec: get rid of the generated profiles; now, everything is handled by FOREGROUND and BACKGROUND colors, dynamically + * byobu-janitor: clean up old ~/.byobu/profile symlinks; guess the user's + colors and set them in ~/.byobu/colors + * byobu-select-profile, byobu-select-profile.1: deprecate the --set + option, only support --background and --foreground now; update the + documentation -- Dustin Kirkland Tue, 10 Nov 2009 10:18:20 -0600