diff --git a/debian/changelog b/debian/changelog index 823a3bd2..755e7129 100644 --- a/debian/changelog +++ b/debian/changelog @@ -30,6 +30,20 @@ byobu (3.7) unreleased; urgency=low launch byobu * usr/bin/byobu-select-session: enable byobu-select-session to list custom session names, LP: #630673 + * debian/templates, etc/byobu/statusrc, usr/bin/byobu, usr/bin/byobu- + janitor, usr/bin/byobu-launcher, usr/bin/byobu-launcher-install, + usr/bin/byobu-launcher-uninstall, usr/bin/byobu-select-profile, + usr/bin/byobu-status, usr/lib/byobu/custom, usr/lib/byobu/disk_io, + usr/lib/byobu/ec2_cost, usr/lib/byobu/hostname, + usr/lib/byobu/ip_address, usr/lib/byobu/logo, + usr/lib/byobu/mem_available, usr/lib/byobu/menu, + usr/lib/byobu/network, usr/lib/byobu/.notify_osd, + usr/lib/byobu/reboot_required, usr/lib/byobu/services, + usr/lib/byobu/updates_available, usr/share/byobu/keybindings/f-keys, + usr/share/byobu/keybindings/screen-escape-keys, + usr/share/byobu/profiles/byoburc, usr/share/byobu/profiles/common, + usr/share/man/man1/byobu.1: + - xdg user dirs overhaul, LP: #553105 -- Dustin Kirkland Thu, 21 Oct 2010 12:09:14 -0500 diff --git a/debian/templates b/debian/templates index 27109a1b..a0fc03bd 100644 --- a/debian/templates +++ b/debian/templates @@ -7,5 +7,5 @@ _Description: Do you want to launch Byobu at shell login for all users? . If you select this option, Byobu will install a symlink in /etc/profile.d. This setting is system-wide, for all users logging into the system. - Individual users can disable this by touching ~/.byobu/disable-autolaunch, - or configuring with 'byobu-config'. + Individual users can disable this by touching + ~/.local/share/byobu/disable-autolaunch, or configuring with 'byobu-config'. diff --git a/etc/byobu/statusrc b/etc/byobu/statusrc index c4d687b6..ecd5bbfb 100644 --- a/etc/byobu/statusrc +++ b/etc/byobu/statusrc @@ -1,6 +1,6 @@ # statusrc # Byobu's default status notifications -# Override these in $HOME/.byobu/status +# Override these in $HOME/.local/share/byobu/status # # Copyright (C) 2009 Canonical Ltd. # diff --git a/usr/bin/byobu b/usr/bin/byobu index 28133607..44c36f4a 100755 --- a/usr/bin/byobu +++ b/usr/bin/byobu @@ -23,6 +23,7 @@ VERSION=3.7 export BYOBU_PREFIX [ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir" || SOCKETDIR="/var/run/screen" RUN="$SOCKETDIR/S-$USER" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" if [ ! -x "$BYOBU_PREFIX/bin/$PKG" ]; then echo "ERROR: Cannot find $BYOBU_PREFIX/bin/$PKG" 2>&1 @@ -38,7 +39,7 @@ if [ "$#" = "1" ] && [ "$1" = "-v" ]; then fi # Check if we're being autolaunched, and this user explicitly does not want it. -if [ "$0" = "/etc/profile.d/Z98-$PKG.sh" ] && [ -r "$HOME/.$PKG/disable-autolaunch" ]; then +if [ "$0" = "/etc/profile.d/Z98-$PKG.sh" ] && [ -r "$DATA/disable-autolaunch" ]; then exit 0 fi @@ -52,11 +53,11 @@ printf "\033]0;${USER}@$(hostname) - ${PKG}\007" CUSTOM_WINDOW_SET=0 if [ -r "$BYOBU_WINDOWS" ]; then CUSTOM_WINDOW_SET=1 -elif [ -r "$HOME/.$PKG/windows.$BYOBU_WINDOWS" ]; then +elif [ -r "$DATA/windows.$BYOBU_WINDOWS" ]; then CUSTOM_WINDOW_SET=1 - BYOBU_WINDOWS="$HOME/.$PKG/windows.$BYOBU_WINDOWS" + BYOBU_WINDOWS="$DATA/windows.$BYOBU_WINDOWS" elif [ "$#" = "0" ]; then - BYOBU_WINDOWS="$HOME/.$PKG/windows" + BYOBU_WINDOWS="$DATA/windows" else BYOBU_WINDOWS="/dev/null" fi @@ -70,8 +71,8 @@ $(which tput >/dev/null) && [ $(tput colors 2>/dev/null || echo 0) -eq 256 ] && # Drop a symlink to the ssh socket in $HOME, since we can ensure that exists if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then - rm -f "$HOME/.$PKG/.ssh-agent" - ln -sf "$SSH_AUTH_SOCK" "$HOME/.$PKG/.ssh-agent" + rm -f "$DATA/.ssh-agent" + ln -sf "$SSH_AUTH_SOCK" "$DATA/.ssh-agent" fi PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/byoburc" diff --git a/usr/bin/byobu-janitor b/usr/bin/byobu-janitor index b4175cbd..bd5540c7 100755 --- a/usr/bin/byobu-janitor +++ b/usr/bin/byobu-janitor @@ -20,6 +20,7 @@ # along with this program. If not, see . PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" [ -z "$BYOBU_PREFIX" ] && export BYOBU_PREFIX="/usr" [ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir" || SOCKETDIR="/var/run/screen" RUN="$SOCKETDIR/S-$USER" @@ -32,10 +33,16 @@ fi # Set the rest of the variables DEFAULT_PROFILE="light" -PROFILE="$HOME/.$PKG/profile" +PROFILE="$DATA/profile" # Use gsed on non-Linux OS's which gsed 2>/dev/null && SED="gsed" || SED="sed" +# If the old dir exists, but the xdg one doesn't, migrate +if [ -d "$HOME/.$PKG" ] && [ ! -e "$DATA" ]; then + mv -f "$HOME/.$PKG" "$DATA" + ln -sf "$DATA" "$HOME/.$PKG" +fi + # Create byobu-exchange buffer file, with secure permissions, if it doesn't exist if [ -w "$RUN" ] && [ ! -e "$RUN/$PKG-exchange" ]; then install -m 600 /dev/null "$RUN/$PKG-exchange" @@ -43,15 +50,15 @@ fi # Affects: users who launched using sudo, such that their config dir # is not writable by them -if [ -d "$HOME/.$PKG" ] && [ ! -w "$HOME/.$PKG" ]; then - echo "ERROR: [$HOME/.$PKG] is not writable by the current user" 1>&2 +if [ -d "$DATA" ] && [ ! -w "$DATA" ]; then + echo "ERROR: [$DATA] is not writable by the current user" 1>&2 exit 1 fi # Affects: First runs with no configuration # Seed the configuration -[ -d "$HOME/.$PKG" ] || mkdir -p "$HOME/.$PKG" -[ -r "$HOME/.$PKG/color" ] || printf "BACKGROUND=k\nFOREGROUND=w\nMONOCHROME=0" > "$HOME/.$PKG/color" +[ -d "$DATA" ] || mkdir -p "$DATA" +[ -r "$DATA/color" ] || printf "BACKGROUND=k\nFOREGROUND=w\nMONOCHROME=0" > "$DATA/color" [ -r "$PROFILE" ] || ln -sf $BYOBU_PREFIX/share/$PKG/profiles/common "$PROFILE" # Affects: Symlinks pointing to color profiles @@ -89,8 +96,8 @@ if [ -h "$PROFILE" ]; then esac fi -[ -s "$HOME/.$PKG/keybindings" ] || echo "source $BYOBU_PREFIX/share/$PKG/keybindings/common" > "$HOME/.$PKG/keybindings" -if [ ! -r "$HOME/.$PKG/status" ]; then +[ -s "$DATA/keybindings" ] || echo "source $BYOBU_PREFIX/share/$PKG/keybindings/common" > "$DATA/keybindings" +if [ ! -r "$DATA/status" ]; then if [ -r /etc/$PKG/statusrc ]; then skel=/etc/$PKG/statusrc elif [ -r "$BYOBU_PREFIX/share/$PKG/profiles/statusrc" ]; then @@ -98,18 +105,18 @@ if [ ! -r "$HOME/.$PKG/status" ]; then else skel=/dev/null fi - grep -A 999999 BEGIN_CUT_HERE $skel | grep -B 999999 END_CUT_HERE | grep -v CUT > "$HOME/.$PKG/status" + grep -A 999999 BEGIN_CUT_HERE $skel | grep -B 999999 END_CUT_HERE | grep -v CUT > "$DATA/status" fi -[ -r "$HOME/.$PKG/windows" ] || touch "$HOME/.$PKG/windows" +[ -r "$DATA/windows" ] || touch "$DATA/windows" [ -r "$HOME/.screenrc" ] || touch "$HOME/.screenrc" # Affects: Upgrades from <= byobu-2.11 # The status scripts used to have hyphens in their name, but now use # underscores such that we can source the file as a shell snippet; # fix existing status configuration. -$SED -i -e "s/\([^=]+\)-\([^=]+\)=/\1_\2=/g" "$HOME/.$PKG/status" -$SED -i -e "s/^disk-.*=/disk=/" "$HOME/.$PKG/status" -$SED -i -e "s/^network-.*=/network=/" "$HOME/.$PKG/status" +$SED -i -e "s/\([^=]+\)-\([^=]+\)=/\1_\2=/g" "$DATA/status" +$SED -i -e "s/^disk-.*=/disk=/" "$DATA/status" +$SED -i -e "s/^network-.*=/network=/" "$DATA/status" # Affects: Upgrades from <= byobu-2.16 # screen-launcher was renamed byobu-launcher; if the user has byobu @@ -121,8 +128,8 @@ fi # Affects: Upgrades from <= byobu-2.25 # Collapse separate status config files into the sourced config for i in disk network distro logo; do - if [ -r "$HOME/.$PKG/$i" ]; then - val=`cat $HOME/.$PKG/$i` + if [ -r "$DATA/$i" ]; then + val=`cat $DATA/$i` uc=`echo "$i" | tr "[:lower:]" "[:upper:]"` case $i in disk|network) @@ -130,8 +137,8 @@ for i in disk network distro logo; do distro|logo) key="$uc" ;; esac - echo "$key=\"$val\"" >> "$HOME/.$PKG/statusrc" - rm "$HOME/.$PKG/$i" + echo "$key=\"$val\"" >> "$DATA/statusrc" + rm "$DATA/$i" fi done @@ -149,14 +156,14 @@ fi # Affects: Upgrades from <= byobu-2.78 which might have "motd+shell" # in their window list; update this to just "shell" -if grep -qs "motd+shell" "$HOME/.$PKG/windows"; then - $SED -i -e "s/motd+shell/shell/g" "$HOME/.$PKG/windows" || true +if grep -qs "motd+shell" "$DATA/windows"; then + $SED -i -e "s/motd+shell/shell/g" "$DATA/windows" || true fi # Affects: Upgrades from <= byobu-3.6, change location of $SSH_AUTH_SOCK if [ -h "$RUN/$PKG.ssh-agent" ]; then - rm -f "$HOME/.$PKG/.ssh-agent" - mv -f "$RUN/$PKG.ssh-agent" "$HOME/.$PKG/.ssh-agent" + rm -f "$DATA/.ssh-agent" + mv -f "$RUN/$PKG.ssh-agent" "$DATA/.ssh-agent" fi # Clean up flag diff --git a/usr/bin/byobu-launcher b/usr/bin/byobu-launcher index 607d5cc6..115500a1 100755 --- a/usr/bin/byobu-launcher +++ b/usr/bin/byobu-launcher @@ -17,10 +17,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" [ -z "$BYOBU_PREFIX" ] && export BYOBU_PREFIX="/usr" export BYOBU_PREFIX -if [ ! -e "$HOME/.byobu/disable-autolaunch" ]; then +if [ ! -e "$DATA/disable-autolaunch" ]; then case "$TERM" in *screen*) # Handle nesting diff --git a/usr/bin/byobu-launcher-install b/usr/bin/byobu-launcher-install index 74aa8946..88d52fb8 100755 --- a/usr/bin/byobu-launcher-install +++ b/usr/bin/byobu-launcher-install @@ -19,6 +19,7 @@ # along with this program. If not, see . PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" install_launcher() { printf "%s\n" 'case "$-" in *i*) byobu-launcher && exit 0; esac;' >> "$1" @@ -28,7 +29,7 @@ install_launcher() { $PKG-launcher-uninstall || true # Hush login, since we will handle motd printing touch "$HOME"/.hushlogin -rm -f "$HOME/.$PKG/disable-autolaunch" +rm -f "$DATA/disable-autolaunch" # Handle bourne shells, if not set globally in /etc/profile.d if [ ! -h "/etc/profile.d/Z98-$PKG.sh" ]; then diff --git a/usr/bin/byobu-launcher-uninstall b/usr/bin/byobu-launcher-uninstall index 14ffe13c..0e8518c4 100755 --- a/usr/bin/byobu-launcher-uninstall +++ b/usr/bin/byobu-launcher-uninstall @@ -19,6 +19,7 @@ # along with this program. If not, see . PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" # Use gsed on non-Linux OS's which gsed 2>/dev/null && SED="gsed" || SED="sed" @@ -33,7 +34,7 @@ remove_launcher() { for i in ".profile" ".bashrc" ".bash_profile" ".zprofile"; do remove_launcher "$HOME/$i" done -mkdir -p "$HOME/.$PKG" -touch "$HOME/.$PKG/disable-autolaunch" +mkdir -p "$DATA" +touch "$DATA/disable-autolaunch" # install disabled motd printing; re-enable rm -f "$HOME"/.hushlogin diff --git a/usr/bin/byobu-select-profile b/usr/bin/byobu-select-profile index 9327d01b..3597cbdb 100755 --- a/usr/bin/byobu-select-profile +++ b/usr/bin/byobu-select-profile @@ -63,7 +63,7 @@ EOT # Initialize variables FILE="$HOME"/."$PKG"/color -PROFILE="$HOME/.$PKG/profile" +PROFILE="$DATA/profile" [ -r "$PROFILE" ] || ln -sf $BYOBU_PREFIX/share/$PKG/profiles/common "$PROFILE" selected=-1 color= @@ -77,9 +77,9 @@ assert_symlink() { fi } -mkdir -p "$HOME/.$PKG" +mkdir -p "$DATA" # If these files exist, they must be a symlink -assert_symlink "$HOME/.$PKG/profile" +assert_symlink "$DATA/profile" listprofiles() { # Display list of profiles, one per line @@ -184,7 +184,7 @@ setcolor() { if [ $# -eq 0 ]; then prompt "background" prompt "foreground" - screen -X at 0 source "$HOME/.$PKG/profile" + screen -X at 0 source "$DATA/profile" else while true; do case "$1" in diff --git a/usr/bin/byobu-status b/usr/bin/byobu-status index 1ac502c1..8493bb4c 100755 --- a/usr/bin/byobu-status +++ b/usr/bin/byobu-status @@ -18,13 +18,14 @@ # along with this program. If not, see . PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" [ -z "$BYOBU_PREFIX" ] && export BYOBU_PREFIX="/usr" export BYOBU_PREFIX find_script () { # Allow for local status scripts - if [ -x "$HOME/.$PKG/bin/$1" ]; then - echo "$HOME/.$PKG/bin/$1" + if [ -x "$DATA/bin/$1" ]; then + echo "$DATA/bin/$1" elif [ -x "$BYOBU_PREFIX/lib/$PKG/$1" ]; then echo "$BYOBU_PREFIX/lib/$PKG/$1" elif [ -x "$BYOBU_PREFIX/libexec/$PKG/$1" ]; then @@ -56,10 +57,10 @@ color() { } # Source configurations -[ -r "$HOME/.$PKG/color" ] && . "$HOME/.$PKG/color" +[ -r "$DATA/color" ] && . "$DATA/color" [ -r "/etc/$PKG/statusrc" ] && . "/etc/$PKG/statusrc" -[ -r "$HOME/.$PKG/status" ] && . "$HOME/.$PKG/status" -[ -r "$HOME/.$PKG/statusrc" ] && . "$HOME/.$PKG/statusrc" +[ -r "$DATA/status" ] && . "$DATA/status" +[ -r "$DATA/statusrc" ] && . "$DATA/statusrc" export P="$1" case "$P" in @@ -69,7 +70,7 @@ case "$P" in VER=$(set -- $(dpkg-query --show $PKG); echo "$2") fi printf "$PKG-$VER Detailed Status Navigation\n Expand all - zr\t\tCollapse all - zm\n Expand one - zo\t\tCollapse one - zc\n\n" - for i in "$BYOBU_PREFIX/lib/$PKG"/* "$HOME/.$PKG/bin"/*; do + for i in "$BYOBU_PREFIX/lib/$PKG"/* "$DATA/bin"/*; do i=${i##*/} [ "$i" = "menu" ] && continue script=`find_script $i` diff --git a/usr/lib/byobu/.notify_osd b/usr/lib/byobu/.notify_osd index e79294bb..d6c308d4 100755 --- a/usr/lib/byobu/.notify_osd +++ b/usr/lib/byobu/.notify_osd @@ -24,7 +24,7 @@ $PKG = "byobu"; while () { # Ensure that the notify_osd indicator is enabled my $skip = 0; - open(F, "<$ENV{HOME}/.$PKG/status"); + open(F, "<$ENV{HOME}/.local/share/$PKG/status"); foreach my $i () { if ($i =~ /notify_osd=0/) { $skip = 1; diff --git a/usr/lib/byobu/custom b/usr/lib/byobu/custom index 8a47f20a..967096e6 100755 --- a/usr/lib/byobu/custom +++ b/usr/lib/byobu/custom @@ -19,15 +19,16 @@ # along with this program. If not, see . PKG="byobu" -[ -d "$HOME/.$PKG/bin" ] || exit 0 +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" +[ -d "$DATA/bin" ] || exit 0 color 2>/dev/null || color() { true; } -[ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$HOME/.byobu" +[ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$DATA" NOW=$(date +%s) CACHE="$DIR/$PKG.custom" # Loop over custom scripts -for i in "$HOME"/.$PKG/bin/[0-9]*_*; do +for i in "$DATA/bin/[0-9]*_*; do [ -x "$i" ] || continue script=$(basename "$i") freq=$(echo "$script" | awk -F_ '{print $1}') diff --git a/usr/lib/byobu/disk_io b/usr/lib/byobu/disk_io index 570883c3..d1f55fb5 100755 --- a/usr/lib/byobu/disk_io +++ b/usr/lib/byobu/disk_io @@ -18,6 +18,7 @@ # along with this program. If not, see . PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" color 2>/dev/null || color() { true; } # Default to disk providing /, but let users override with MONITORED_DISK @@ -37,7 +38,7 @@ if [ "$1" = "--detail" ]; then exit 0 fi -[ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$HOME/.byobu" +[ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$DATA" t2=`date +%s` for i in "read" "write"; do cache="$DIR/$PKG.disk_$i" diff --git a/usr/lib/byobu/ec2_cost b/usr/lib/byobu/ec2_cost index c52380a4..f3075381 100755 --- a/usr/lib/byobu/ec2_cost +++ b/usr/lib/byobu/ec2_cost @@ -19,6 +19,7 @@ DETAIL=0 PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" [ -z "$BYOBU_PREFIX" ] && BYOBU_PREFIX="/usr" color 2>/dev/null || color() { true; } @@ -31,8 +32,8 @@ for arg in $@; do done # Get the going rates -[ -r "$HOME/.$PKG/ec2_rates" ] || ln -s $BYOBU_PREFIX/share/$PKG/ec2/rates.us_ca "$HOME/.$PKG/ec2_rates" -. "$HOME/.$PKG/ec2_rates" || exit 1 +[ -r "$DATA/ec2_rates" ] || ln -s $BYOBU_PREFIX/share/$PKG/ec2/rates.us_ca "$DATA/ec2_rates" +. "$DATA/ec2_rates" || exit 1 # Count CPUs, Memory, Architecture cpu=$(grep -c "^processor.*:" /proc/cpuinfo) || cpu=1 diff --git a/usr/lib/byobu/hostname b/usr/lib/byobu/hostname index 4a499fab..0263772c 100755 --- a/usr/lib/byobu/hostname +++ b/usr/lib/byobu/hostname @@ -18,6 +18,7 @@ # along with this program. If not, see . PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" color 2>/dev/null || color() { true; } if [ "$1" = "--detail" ]; then @@ -25,7 +26,7 @@ if [ "$1" = "--detail" ]; then exit 0 fi -. "$HOME/.$PKG/status" +. "$DATA/status" [ "$whoami" = "1" ] && at="@" printf "$(color bold2)%s%s$(color -)" "$at" $(hostname -s 2>/dev/null || hostname) diff --git a/usr/lib/byobu/ip_address b/usr/lib/byobu/ip_address index 8e0655af..bf08fee1 100755 --- a/usr/lib/byobu/ip_address +++ b/usr/lib/byobu/ip_address @@ -18,6 +18,7 @@ # along with this program. If not, see . PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" color 2>/dev/null || color() { true; } if [ "$1" = "--detail" ]; then @@ -27,11 +28,11 @@ if [ "$1" = "--detail" ]; then exit 0 fi -. "$HOME/.$PKG/status" +. "$DATA/status" [ "$hostname" = "1" ] && space=" " [ "$whoami" = "1" ] && space=" " -# Allow interface overrides in $HOME/.$PKG/statusrc +# Allow interface overrides in $DATA/statusrc if [ -n "$MONITORED_NETWORK" ]; then interface="$MONITORED_NETWORK" else diff --git a/usr/lib/byobu/logo b/usr/lib/byobu/logo index cc873d8e..e01e7a1d 100755 --- a/usr/lib/byobu/logo +++ b/usr/lib/byobu/logo @@ -94,12 +94,12 @@ print_logo() { } if [ -n "$LOGO" ]; then - # Allow users to define their own logo in $HOME/.$PKG/status + # Allow users to define their own logo in $DATA/status printf "%s" "$LOGO" && exit 0 || true fi if [ -n "$DISTRO" ]; then - # Allow manual override of distro in $HOME/.$PKG/status + # Allow manual override of distro in $DATA/status print_logo "$DISTRO" && exit 0 || true fi diff --git a/usr/lib/byobu/mem_available b/usr/lib/byobu/mem_available index 65327177..156d5b9b 100755 --- a/usr/lib/byobu/mem_available +++ b/usr/lib/byobu/mem_available @@ -18,6 +18,7 @@ # along with this program. If not, see . PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" color 2>/dev/null || color() { true; } if [ "$1" = "--detail" ]; then @@ -25,7 +26,7 @@ if [ "$1" = "--detail" ]; then exit 0 fi -. "$HOME/.$PKG/status" +. "$DATA/status" [ "$mem_used" = "1" ] && comma="," || whitespace=" " mem=`head -n1 /proc/meminfo | awk '{print $2}'` diff --git a/usr/lib/byobu/menu b/usr/lib/byobu/menu index e775e449..bc6a6caa 100755 --- a/usr/lib/byobu/menu +++ b/usr/lib/byobu/menu @@ -19,9 +19,10 @@ [ "$1" = "--detail" ] && exit 0 PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" color 2>/dev/null || color() { true; } -[ -r "$HOME/.$PKG/keybindings" ] && bindings="$HOME/.$PKG/keybindings" || bindings="$HOME/.screenrc" +[ -r "$DATA/keybindings" ] && bindings="$DATA/keybindings" || bindings="$HOME/.screenrc" if grep -qs "^source.*screen-escape-keys$" $bindings 2>/dev/null || [ "$1" = "--disable-f-keys" ]; then esc=`grep "^escape" $bindings | sed "s/^.*\(.\)$/\1/"` diff --git a/usr/lib/byobu/network b/usr/lib/byobu/network index 0e09d96e..ce8ac3fa 100755 --- a/usr/lib/byobu/network +++ b/usr/lib/byobu/network @@ -18,9 +18,10 @@ # along with this program. If not, see . PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" color 2>/dev/null || color() { true; } -# Allow interface overrides in $HOME/.$PKG/status +# Allow interface overrides in $DATA/status if [ -n "$MONITORED_NETWORK" ]; then interface="$MONITORED_NETWORK" else @@ -32,7 +33,7 @@ if [ "$1" = "--detail" ]; then exit 0 fi -[ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$HOME/.byobu" +[ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$DATA" t2=`date +%s` for i in up down; do cache="$DIR/$PKG.network_$i" diff --git a/usr/lib/byobu/reboot_required b/usr/lib/byobu/reboot_required index 00def0f4..39fdfe07 100755 --- a/usr/lib/byobu/reboot_required +++ b/usr/lib/byobu/reboot_required @@ -18,10 +18,11 @@ # along with this program. If not, see . PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" color 2>/dev/null || color() { true; } reboot="/var/run/reboot-required" -[ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$HOME/.byobu" +[ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$DATA" reload="$DIR/$PKG.reload-required" case "$1" in --detail) diff --git a/usr/lib/byobu/services b/usr/lib/byobu/services index 35804873..135a8afb 100755 --- a/usr/lib/byobu/services +++ b/usr/lib/byobu/services @@ -22,7 +22,7 @@ PKG="byobu" color 2>/dev/null || color() { true; } -# Users can define a list of SERVICES to monitor in $HOME/.byobu/status +# Users can define a list of SERVICES to monitor in $DATA/status if [ -z "$SERVICES" ]; then if [ -f "/etc/eucalyptus/eucalyptus.conf" ]; then # If the user has not defined any SERVICES, but this system is a diff --git a/usr/lib/byobu/updates_available b/usr/lib/byobu/updates_available index 489147a9..1759e779 100755 --- a/usr/lib/byobu/updates_available +++ b/usr/lib/byobu/updates_available @@ -18,6 +18,7 @@ # along with this program. If not, see . PKG="byobu" +[ -d "$XDG_DATA_HOME" ] && DATA="$XDG_DATA_HOME/$PKG" || DATA="$HOME/.local/share/$PKG" color 2>/dev/null || color() { true; } if [ "$1" = "--detail" -o "$1" = "--short" ]; then @@ -80,7 +81,7 @@ PKG="byobu" # I would welcome contributions from other distros to make this # more distro-agnostic. -[ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$HOME/.byobu" +[ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$DATA" mycache="$DIR/$PKG.updates-available" # If mycache is present, use it diff --git a/usr/share/byobu/keybindings/f-keys b/usr/share/byobu/keybindings/f-keys index 5db374b7..c40feb37 100644 --- a/usr/share/byobu/keybindings/f-keys +++ b/usr/share/byobu/keybindings/f-keys @@ -25,7 +25,7 @@ bindkey -k k1 screen -t config 0 byobu-config # F1 | Configuration (along with bindkey -k k2 screen # F2 | Create new window bindkey -k k3 prev # F3 | Previous Window bindkey -k k4 next # F4 | Next Window -register r "^a:source $HOME/.byobu/profile^M" # | Goes with F5 definition +register r "^a:source $HOME/.local/share/byobu/profile^M" # | Goes with F5 definition bindkey -k k5 eval 'fit' 'process r' # F5 | Reload profile bindkey -k k6 detach # F6 | Detach from this session bindkey -k k7 copy # F7 | Enter copy/scrollback mode diff --git a/usr/share/byobu/keybindings/screen-escape-keys b/usr/share/byobu/keybindings/screen-escape-keys index 75103c3b..49250636 100644 --- a/usr/share/byobu/keybindings/screen-escape-keys +++ b/usr/share/byobu/keybindings/screen-escape-keys @@ -37,7 +37,7 @@ bindkey -k F2 # ctrl-a-p Previous window F3 # ctrl-a-n Next window F4 # ctrl-a-R Reload profile F5 -register r "^a:source $HOME/.byobu/profile^M" +register r "^a:source $HOME/.local/share/byobu/profile^M" bind R process r # ctrl-a-d Detach from this session F6 # ctrl-a-[ Enter copy/scrollback mode F7 diff --git a/usr/share/byobu/profiles/byoburc b/usr/share/byobu/profiles/byoburc index 8305a051..9b1b749d 100644 --- a/usr/share/byobu/profiles/byoburc +++ b/usr/share/byobu/profiles/byoburc @@ -19,6 +19,6 @@ # along with this program. If not, see . ############################################################################### -source $HOME/.byobu/profile +source $HOME/.local/share/byobu/profile source $BYOBU_WINDOWS source $HOME/.screenrc diff --git a/usr/share/byobu/profiles/common b/usr/share/byobu/profiles/common index 8c146490..d56be0e2 100644 --- a/usr/share/byobu/profiles/common +++ b/usr/share/byobu/profiles/common @@ -98,9 +98,9 @@ defmonitor on activity "" # Maintain SSH_AUTH_SOCK link -setenv SSH_AUTH_SOCK $HOME/.byobu/.ssh-agent +setenv SSH_AUTH_SOCK $HOME/.local/share/byobu/.ssh-agent -source $HOME/.byobu/keybindings +source $HOME/.local/share/byobu/keybindings # Window tabs, second to last line caption always "%12`%?%-Lw%50L>%?%{=r}%n*%f %t%?(%u)%?%{-}%12`%?%+Lw%?%11` %=%12`%110`%109`%122`%111`%10`%<" diff --git a/usr/share/man/man1/byobu.1 b/usr/share/man/man1/byobu.1 index eea2c270..02ef9198 100644 --- a/usr/share/man/man1/byobu.1 +++ b/usr/share/man/man1/byobu.1 @@ -10,6 +10,8 @@ Options to \fBbyobu\fP are simply passed through \fBscreen\fP(1). .SH DESCRIPTION \fBbyobu\fP is a script that launches GNU screen in the byobu configuration. This enables the display of system information and status notifications within two lines at the bottom of the screen session. It also enables multiple tabbed terminal sessions, accessible through simple keystrokes. +Note that DATA=\fI$HOME/.local/share/byobu\fP, per XDG Base Directory Specification. + .SH STATUS NOTIFICATIONS \fBbyobu\fP supports a number of unique and interesting status notifications across the lowest two lines in the screen. Each status notification item is independently configurable, enabled and disabled by the configuration utility. The guide below helps identify each status item (in alphabetical order): @@ -20,24 +22,22 @@ Options to \fBbyobu\fP are simply passed through \fBscreen\fP(1). \fBbattery\fP \- battery information; display on the lower bar toward the right; |\-| indicates discharging, |+| indicates charging, |=| indicates fully charged; when charging or discharging, the current battery capacity as a percentage is displayed; the colours green, yellow, and red are used to give further indication of the battery's charge state -\fBservices\fP \- users can configure a list of services to monitor, define the SERVICES variable in $HOME/.byobu/status, a whitespace separated of services, each service should include the init name of the service, then a pipe, and then an abbreviated name or symbol to display when running; displayed in the lower bar toward the center in cyan on a white background - \fBcpu_count\fP \- the number of cpu's or cores on the system; displayed in the lower bar toward the right in the default text color on the default background, followed by a trailing 'x' \fBcpu_freq\fP \- the current frequency of the cpu in GHz; displayed in the lower bar toward the right in white text on a light blue background -\fBcpu_temp\fP \- the cpu temperature in Celsius (default) or Fahrenheit, configure TEMP=F or TEMP=C in \fI$HOME/.byobu/statusrc\fP; displayed in the lower bar toward the right in yellow text on a black background; you may override the detected cpu temperature device by setting MONITORED_TEMP=/proc/acpi/whatever in \fI$HOME/.byobu/statusrc\fP +\fBcpu_temp\fP \- the cpu temperature in Celsius (default) or Fahrenheit, configure TEMP=F or TEMP=C in \fI$DATA/statusrc\fP; displayed in the lower bar toward the right in yellow text on a black background; you may override the detected cpu temperature device by setting MONITORED_TEMP=/proc/acpi/whatever in \fI$DATA/statusrc\fP -\fBcustom\fP \- user defined custom scripts; must be executable programs of any kind in \fI$HOME/.byobu/bin\fP; must be named N_NAME, where N is the frequency in seconds to refresh the status indicator, and NAME is the name of the script; N should not be less than 5 seconds; the script should echo a small amount of text to standard out, standard error is discarded; the indicator will be displayed in the lower panel, in inverted colors to your current background/foreground scheme, unless you manually specify the colors in your script's output; BEWARE, cpu-intensive custom scripts may impact your overall system performance and could upset your system administrator! - Example: \fI~/.byobu/bin/1000_uname\fP +\fBcustom\fP \- user defined custom scripts; must be executable programs of any kind in \fI$DATA/bin\fP; must be named N_NAME, where N is the frequency in seconds to refresh the status indicator, and NAME is the name of the script; N should not be less than 5 seconds; the script should echo a small amount of text to standard out, standard error is discarded; the indicator will be displayed in the lower panel, in inverted colors to your current background/foreground scheme, unless you manually specify the colors in your script's output; BEWARE, cpu-intensive custom scripts may impact your overall system performance and could upset your system administrator! + Example: \fI$DATA/bin/1000_uname\fP #!/bin/sh printf "\\005{= bw}%s\\005{\-}" "$(uname -r)" \fBdate\fP \- the system date in YYYY-MM-DD formate; displayed in the lower on the far right in the default text color on the default background -\fBdisk\fP \- total disk space available and total used on / directory; displayed in the lower bar on the far right in white text on a light purple background; override the default directory by specifying an alternate mount point with MONITORED_DISK=/wherever in \fI$HOME/.byobu/statusrc\fP +\fBdisk\fP \- total disk space available and total used on / directory; displayed in the lower bar on the far right in white text on a light purple background; override the default directory by specifying an alternate mount point with MONITORED_DISK=/wherever in \fI$DATA/statusrc\fP -\fBdisk_io\fP \- instantaneous read/write througput in kB/s or MB/s over the last 3 seconds; displayed in the lower bar toward the right in white text on a light purple background with a leading '<' sign indicating 'read speed' and '>' sign indicating 'write speed'; override the default monitored disk by specifying an alternate device with MONITORED_disk=/dev/sdb in \fI$HOME/.byobu/statusrc\fP +\fBdisk_io\fP \- instantaneous read/write througput in kB/s or MB/s over the last 3 seconds; displayed in the lower bar toward the right in white text on a light purple background with a leading '<' sign indicating 'read speed' and '>' sign indicating 'write speed'; override the default monitored disk by specifying an alternate device with MONITORED_disk=/dev/sdb in \fI$DATA/statusrc\fP \fBec2_cost\fP \- an estimation of the cost of the current boot of the system in terms of the Amazon EC2 billing model; displayed in the lower bar toward the right in green text on a black background; there is a leading '~' to indicate that this is an estimation, and the monetary units are US Dollars '$' @@ -47,11 +47,11 @@ Options to \fBbyobu\fP are simply passed through \fBscreen\fP(1). \fBhostname\fP \- the hostname of the system; displayed in the upper bar on the far right in bold black text on a grey background; there is a leading '@' symbol if the username status is also enabled -\fBip_address\fP \- the IPv4 address of the system in dotted decimal form; displayed in the upper bar on the far right in bold black text on a grey background; you can override and display your IPv6 address by setting 'IPV6=1' in \fI$HOME/.byobu/statusrc\fP +\fBip_address\fP \- the IPv4 address of the system in dotted decimal form; displayed in the upper bar on the far right in bold black text on a grey background; you can override and display your IPv6 address by setting 'IPV6=1' in \fI$DATA/statusrc\fP \fBload_average\fP \- the system load average over the last 1 minute; displayed in the lower bar toward the right in black text on a yellow background -\fBlogo\fP \- an approximation of the current operating system's logo; displayed in the lower bar on the far left; you may customize this logo by setting a chosen logo in \fI$HOME/.byobu/logo\fP, or you may override this with LOGO=:-D in \fI$HOME/.byobu/statusrc\fP +\fBlogo\fP \- an approximation of the current operating system's logo; displayed in the lower bar on the far left; you may customize this logo by setting a chosen logo in \fI$DATA/logo\fP, or you may override this with LOGO=:-D in \fI$DATA/statusrc\fP \fBmail\fP \- system mail for the current user; the letter '[M]' is displayed in the lower bar toward the left in black text on a grey background @@ -61,7 +61,7 @@ Options to \fBbyobu\fP are simply passed through \fBscreen\fP(1). \fBmenu\fP \- a simple indicator directing new users to use the F9 keybinding to access the byobu menu -\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 +\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$DATA/statusrc\fP \fBnotify_osd\fP \- Send on-screen notification messages to screen's notification buffer @@ -69,7 +69,9 @@ Options to \fBbyobu\fP are simply passed through \fBscreen\fP(1). \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. -\fBrelease\fP \- distribution and version information about the release running on the current system as reported by \fBlsb_release(1)\fP or \fI/etc/issue\fP; displayed in the lower bar in bold black text toward the left on a grey background; you may override the detected release with DISTRO=Whatever in \fI$HOME/.byobu/statusrc\fP +\fBrelease\fP \- distribution and version information about the release running on the current system as reported by \fBlsb_release(1)\fP or \fI/etc/issue\fP; displayed in the lower bar in bold black text toward the left on a grey background; you may override the detected release with DISTRO=Whatever in \fI$DATA/statusrc\fP + +\fBservices\fP \- users can configure a list of services to monitor, define the SERVICES variable in \fI$DATA/status\fP, a whitespace separated of services, each service should include the init name of the service, then a pipe, and then an abbreviated name or symbol to display when running; displayed in the lower bar toward the center in cyan on a white background \fBtime\fP \- the system time in HH:MM:SS format; displayed in the lower bar on the far right in the default text and default background colors @@ -89,12 +91,12 @@ Options to \fBbyobu\fP are simply passed through \fBscreen\fP(1). Each open window in the screen session is displayed in the upper bar toward the far left. These are numbered, and include indicators as to activity in the window (see "activity" in \fBscreen\fP(1) for symbol definitions). The current active window is highlighted by inverting the background/text from the rest of the window bar. -Users can create a list of windows to launch at startup in \fI~/.byobu/windows\fP. This file is the same syntax as \fI~/.screenrc\fP, each line specifying a window using the "screen" command, as described in \fBscreen\fP(1). +Users can create a list of windows to launch at startup in \fI$DATA/windows\fP. This file is the same syntax as \fI~/.screenrc\fP, each line specifying a window using the "screen" command, as described in \fBscreen\fP(1). -User can also launch Byobu with unique window sets. Users can store these as \fI~/.byobu/windows.[NAME]\fP, and launch Byobu with the environment variable \fBBYOBU_WINDOWS\fP. +User can also launch Byobu with unique window sets. Users can store these as \fI$DATA/windows.[NAME]\fP, and launch Byobu with the environment variable \fBBYOBU_WINDOWS\fP. For example: - $ cat ~/.byobu/windows.ssh_sessions + $ cat $DATA/windows.ssh_sessions screen \-t localhost bash screen \-t aussie ssh root@aussie screen \-t beagle ssh root@beagle