HEX
Server: Apache
System: Linux vmi318001.contaboserver.net 6.8.0-117-generic #117-Ubuntu SMP PREEMPT_DYNAMIC Tue May 5 19:26:24 UTC 2026 x86_64
User: boxelikax (1004)
PHP: 8.2.33
Disabled: NONE
Upload Files
File: /home/boxelikax/public_html/demoltec.com/byobu.zip
PK�]��-1��datenuȯ��#!/bin/sh -e
#
#    date: print the date in YYYY-MM-DD format
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__date_detail() {
	date
}

__date() {
	case "$BYOBU_BACKEND" in
		screen)
			color none; printf "\005Y-\005m-\005d"; color --
		;;
	esac
}

# vi: syntax=sh ts=4 noexpandtab
PK�]�t�SSlogonuȯ��#!/bin/sh -e
#
#    logo: determine which logo to use
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2023 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__logo_detail() {
	MARKUP="false"
	__logo
}

__logo() {
	local logo=
	if [ -n "$LOGO" ]; then
		# Allow users to define their own logo in $BYOBU_CONFIG_DIR/status
		printf "%s" "$LOGO"
		return
	fi
	local distro="$(printf "%s" "$BYOBU_DISTRO" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"
	case "$distro" in
		*ubuntu*)
			if $MARKUP; then
				if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
					if [ ! "$VTE_CJK_WIDTH" = "1" ] && [ !  "$VTE_CJK_WIDTH" = "wide" ] ; then
						# color "colour202" "colour255" ; printf " u "; color -
						# Ubuntu's logo doesn't display anywhere, except for on Ubuntu itself, which has the Ubuntu font with the logo
						# which breaks when you ssh into Ubuntu from elsewhere (Windows, Debian, Mac)
						color "colour202" "colour255" ; printf " u "; color -
					else
						color m W; printf " u "; color -
					fi
				else
					color m W; printf " u "; color -
				fi
			else
				printf " u "
			fi
		;;
		*alpine*)
			logo=" /\\\\\\\\ "
			$MARKUP && printf "$(color b b W)%s$(color -)" "$logo" || printf "$logo"
		;;
		*altlinux*)
			logo="alt"
			$MARKUP && printf "$(color Y k)%s$(color -)" "$logo" || printf "$logo"
		;;
	 	*arch*)
			logo=" A "
			$MARKUP && printf "$(color b w b)%s$(color -)" "$logo" || printf "$logo"
		;;
		*centos*)
			if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
				logo="※ "
				$MARKUP && printf "$(color w m)※ $(color -)" || printf "$logo"
			else
				$MARKUP && printf "$(color g w)*$(color -)$(color m w)*$(color -)$(color y w)*$(color -)$(color b w)*$(color -)" || printf "$logo"
			fi
		;;
		*debian*)
			logo=" @ "
			$MARKUP && printf "$(color w r)%s$(color -)" "$logo" || printf "$logo"
		;;
		*fedora*)
			logo=" f "
			$MARKUP && printf "$(color b w)%s$(color -)" "$logo" || printf "$logo"
		;;
		*foresight*)
			logo="<@>"
			$MARKUP && printf "$(color b W g)%s$(color -)" "$logo" || printf "$logo"
		;;
		*gentoo*)
			logo=" > "
			$MARKUP && printf "$(color b c w)%s$(color -)" "$logo" || printf "$logo"
		;;
		*glinux*)
			logo=" G "
			# Green: 3cba54=71, Yellow: f4c20d=214, Red: db3236=167, Blue: 4885ed=69
			$MARKUP && printf "$(color colour0 colour69)██$(color colour0 colour167)■$(color colour0 colour214)■$(color colour0 colour69)▄$(color colour0 colour71)█$(color colour0 colour167)■$(color -)" || printf "$logo"
		;;
		*mac*|*darwin*)
			if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
				# The Apple option character
				#logo=" ⌘  "
				# The Apple logo -- only visible from Mac terminals
				logo="  "
			else
				logo=" X "
			fi
			$MARKUP && printf "$(color w k)%s$(color -)" "$logo" || printf "$logo"
		;;
		*mandriva*)
			logo=" (* "
			$MARKUP && printf "$(color b k c) ($(color -)$(color b k y)*$(color -) " || printf "$logo"
		;;
		*mint*)
			logo=" lm "
			$MARKUP && printf "$(color g w)$logo$(color -)$(color g w)$(color -) " || printf "$logo"
		;;
		*openwrt*)
			logo="OWrt"
			$MARKUP && printf "$(color b colour66 W)%s$(color -)" "$logo" || printf "$logo"
		;;
		*raspbian*)
			logo=" @ "
			$MARKUP && printf "$(color colour125 colour15)%s$(color -)" "$logo" || printf "$logo"
		;;
		*red*hat*|*rhel*)
			logo=" RH "
			$MARKUP && printf "$(color R k)%s$(color -)" "$logo" || printf "$logo"
		;;
		*rockhopper*)
			logo="palm"
			$MARKUP && printf "$(color k w)%s$(color -)" "$logo" || printf "$logo"
		;;
		*slackware*)
			logo=".S "
			$MARKUP && printf "$(color u B k)%s$(color -)" "$logo" || printf "$logo"
		;;
		*suse*)
			logo="SUSE"
			$MARKUP && printf "$(color W g)%s$(color -)" "$logo" || printf "$logo"
		;;
		*wolfi*)
			logo=" * "
			$MARKUP && printf "$(color m W)%s$(color -)" "$logo" || printf "$logo"
		;;
		*xandros*)
			logo=" X "
			$MARKUP && printf "$(color W r)%s$(color -)" "$logo" || printf "$logo"
		;;
		*)
			if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
				logo="〣"
			else
				logo="[B]"
			fi
			$MARKUP && printf "$(color b k W)%s$(color -)" "$logo" || printf " $logo "
		;;
	esac
	printf " "
}

# vi: syntax=sh ts=4 noexpandtab
PK�]��&���hostnamenuȯ��#!/bin/sh -e
#
#    hostname: report a host's name
#
#    Copyright (C) 2008-2011 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__hostname_detail() {
	hostname -f 2>/dev/null
}

__hostname() {
	local h=
	if eval $BYOBU_TEST hostname >/dev/null 2>&1; then
		h=$(hostname -s 2>/dev/null || hostname)
	elif [ -r /proc/sys/kernel/hostname ]; then
		read h < /proc/sys/kernel/hostname
	fi
	if metadata_available; then
		local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/hostname"
		# Background a retrieval of our public hostname
		timeout 0.2 wget -q -O- http://169.254.169.254/latest/meta-data/public-hostname </dev/null >"$cache" 2>/dev/null &
		sleep 0.02
		[ -s "$cache" ] && read h < "$cache"
	fi
	[ -n "$h" ] || return
	color bold2; printf "%s" "$h"; color --
}

# vi: syntax=sh ts=4 noexpandtab
PK�]fQ99mailnuȯ��#!/bin/sh -e
#
#    mail: notify the user if they have system mail
#
#    Copyright (C) 2009 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

MAILFILE="/var/spool/mail/$USER"

__mail_detail() {
	[ ! -d "$MAILFILE" ] && [ -s "$MAILFILE" ] && ls -alF "$MAILFILE" 2>&1
	[ -d "$MAILFILE/new" ] && ls -AlF "$MAILFILE/new" 2>&1
}

__mail() {
	if [ -f "$MAILFILE" ] && [ -s "$MAILFILE" ]; then
		 color b; printf "%s" "$ICON_MAIL"; color --
	elif [ -d "$MAILFILE/new" ] && "$(ls -A "$MAILFILE/new" 2>/dev/null)"; then
		 color b; printf "%s" "$ICON_MAIL"; color --
	else
		rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/mail"*
	fi
}

# vi: syntax=sh ts=4 noexpandtab
PK�]h���swapnuȯ��#!/bin/sh -e
#
#    mem_swap: show the current swap available and used
#
#    Copyright (C) 2010 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__swap_detail() {
	cat /proc/meminfo
}

__swap() {
	local stotal="" sfree="" name="" val="" unit="" mem="" f="";
	while read name val unit; do
		if [ "$name" = "SwapTotal:" ]; then
			stotal="$val"
		elif [ "$name" = "SwapFree:" ]; then
			sfree="$val"
		else
			continue
		fi
		[ -n "$stotal" -a -n "$sfree" ] && break;
	done < /proc/meminfo
	if [ "${stotal:-0}" = "0" ]; then
		printf ""
		rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/swap"
	else
		mem=${stotal}
		f=$(((100*($stotal-$sfree))/$stotal))
		if [ $mem -ge 1048576 ]; then
		fpdiv "${mem}" 1048576 1
			mem=${_RET}
			unit="$ICON_GB"
		elif [ $mem -ge 1024 ]; then
			fpdiv "${mem}" 1024 0
			mem=${_RET}
			unit="$ICON_MB"
		else
			mem="$mem"
			unit="$ICON_KB"
		fi
		[ -n "$mem" ] || return
		color b G k; printf "s%s" "$mem"; color -; color G k; printf "%s" "$unit"; color -;
		color b G k; printf "%s" "$f"; color -; color G k; printf "%s" "$PCT"; color --
	fi
}

# vi: syntax=sh ts=4 noexpandtab
PK�]"����customnuȯ��#!/bin/sh -e
#
#    custom: run the user's custom status scripts
#
#    Copyright (C) 2009 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__custom_detail() {
	return
}

__custom() {
	local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/custom"
	local i= output=
	for i in "$BYOBU_CONFIG_DIR/bin/"[0-9]*_*; do
		# Loop over custom scripts
		# Ensure executable
		[ -x "$i" ] || continue
		# Ignore vim backup files ending in ~
		case "$i" in
			*~) continue ;;
		esac
		local now="$(date +%s)"
		local script=${i##*/}
		local freq=${script%%_*}
		freq=${freq#0}
		local lastrun=
		[ -r "$cache.$script.last" ] && read lastrun < "$cache.$script.last" || lastrun=0
		local expiration=$(($lastrun+$freq))
		if [ $now -ge $expiration ]; then
			"$i" > "$cache.$script" 2>/dev/null
			printf "%s\n" "${now}" > "$cache.$script.last"
		fi
		readfile < "$cache.$script"
		local str="${_RET}"
		case "$str" in
			*"$ESC{"*)
				# User has formatted the colors
				output="$output$(printf "$str")"
			;;
			*)
				# Default coloring
				output="$output$str "
			;;
		esac
	done
	if [ -z "$output" ]; then
		rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/custom"*
		return
	fi
	printf "$output" | $BYOBU_SED ':a;N;$!ba;s/\n//g'
}

# vi: syntax=sh ts=4 noexpandtab
PK�]��!,��time_utcnuȯ��#!/bin/sh -e
#
#    time_utc: print UTC time in HH:MM
#
#    Copyright (C) 2010 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__time_utc_detail() {
	date -u
}

__time_utc() {
	d=$(date -u +%H:%M)
	color invert; printf "%sUTC" "$d"; color --
}

# vi: syntax=sh ts=4 noexpandtab
PK�]c3�x��packagesnuȯ��#!/bin/sh -e
#
#    packages: count the number of packages installed
#
#    Copyright (C) 2023 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__packages_detail() {
	if eval $BYOBU_TEST dpkg >/dev/null 2>&1; then
		dpkg -l | grep ^ii
	fi
	if eval $BYOBU_TEST snap >/dev/null 2>&1; then
		snap list
	fi
	if eval $BYOBU_TEST apk >/dev/null 2>&1; then
		apk info
	fi
	return
}

__packages() {
	local packages=0
	if eval $BYOBU_TEST dpkg >/dev/null 2>&1; then
		count=$(dpkg -l | grep -c ^ii)
		packages=$((packages+count))
	fi
	if eval $BYOBU_TEST snap >/dev/null 2>&1; then
		count=$(snap list | grep -c -v "^Name\s")
		packages=$((packages+count))
	fi
	if eval $BYOBU_TEST apk >/dev/null 2>&1; then
		count=$(apk info | wc -l)
		packages=$((packages+count))
	fi
	[ -n "$packages" ] || return
	color w y; printf "[%s]" "$count"; color --;

}

# vi: syntax=sh ts=4 noexpandtab
PK�]�Q��99timenuȯ��#!/bin/sh -e
#
#    time: print the time in HH:MM:SS format
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__time_detail() {
	date
}

__time() {
	local secs=1
	[ -n "$TIME_SECONDS" ] && secs=$TIME_SECONDS
	case "$BYOBU_BACKEND" in
		screen)
			format="\0050c"
			[ "$secs" != "0" ] && format="$format:\005s"
			printf $format
		;;
	esac
}

# vi: syntax=sh ts=4 noexpandtab
PK�]U�7j��trashnuȯ��#!/bin/sh -e
#
#    trash: show icon (and optionally count) if entries in trash.
#
#    Copyright (C) 2011 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: James Hunt <james.hunt@canonical.com>
#             Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

TRASH_DIR="$HOME/.local/share/Trash/files"

__trash_detail() {
	find "$TRASH_DIR"
}

__trash() {
	local count
	[ -d "$TRASH_DIR" ] || return
	count=$(ls $dir|wc -l)
	[ "$count" = "0" ] && return
	printf "%s[%s]" "$ICON_TRASH" "$count"
}

# vi: syntax=sh ts=4 noexpandtab
PK�]Ĩ�s
s
memorynuȯ��#!/bin/sh -e
#
#    mem_available: grab the current memory and usage
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__memory_detail() {
	free
}

__memory() {
	local free="" total="" buffers="" cached=""
	local kb_main_used=0 buffers_plus_cached=0 fo_buffers=0 fo_cached=0
	if [ -r /proc/meminfo ]; then
		while read tok val unit; do
			case "$tok" in
				MemTotal:) total=${val};;
				MemFree:) free=${val};;
				Buffers:) buffers=${val};;
				Cached:) cached=${val};;
			esac
			[ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;
		done < /proc/meminfo
	elif eval $BYOBU_TEST vm_stat >/dev/null 2>&1; then
		# MacOS support
		# calculation borrowed from http://apple.stackexchange.com/a/48195/18857
		free_blocks=$(vm_stat | grep free | awk '{ print $3 }' | sed -e 's/\.//')
		inactive_blocks=$(vm_stat | grep inactive | awk '{ print $3 }' | sed -e 's/\.//')
		speculative_blocks=$(vm_stat | grep speculative | awk '{ print $3 }' | sed -e 's/\.//')
		free=$((($free_blocks+speculative_blocks)*4))
		inactive=$(($inactive_blocks*4))
		total=$((($free+$inactive)))
		buffers=0
		cached=0
	fi
        kb_main_used=$(($total-$free))
        buffers_plus_cached=$(($buffers+$cached))
        # "free output" buffers and cache (output from 'free')
        fo_buffers=$(($kb_main_used - $buffers_plus_cached))
        fpdiv $((100*${fo_buffers})) "${total}" 0;
        usage=${_RET}
	if [ $total -ge 1048576 ]; then
		fpdiv "$total" 1048567 1
		total=${_RET}
		unit="$ICON_GB"
	elif [ $total -ge 1024 ]; then
		fpdiv "$total" 1024 0
		total=${_RET}
		unit="$ICON_MB"
	else
		unit="$ICON_KB"
	fi
	if [ $usage -gt 90 ]; then
		# Change foreground to yellow, if usage over 90%
		fg="Y"
	else
		fg="W"
	fi
	[ -n "$total" ] || return
	color b g W; printf "%s" "$total"; color -; color g W; printf "%s" "$unit"; color -; color b g "$fg"; printf "%s" "$usage"; color -; color g "$fg"; printf "%s" "$PCT"; color --
}

# vi: syntax=sh ts=4 noexpandtab
PK�]�oyg	cpu_countnuȯ��#!/bin/sh -e
#
#    cpu_count: count cpu's on a systems
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__cpu_count_detail() {
	grep -i "^model name" /proc/cpuinfo
}

__cpu_count() {
	local c
	c=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo)
	[ "$c" = "1" ] || printf "%sx" "$c"
}

# vi: syntax=sh ts=4 noexpandtab
PK�]��	��disk_ionuȯ��#!/bin/sh -e
#
#    disk_io: calculate the disk io rate
#
#    Copyright (C) 2010 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__disk_io_detail() {
	if eval $BYOBU_TEST iostat >/dev/null; then
		iostat -d -m -h
	else
		printf "%s\n" "Please install iostat if you want detailed information on your disk throughput"
	fi
}


getdisk() {
	local t=""
	if [ -L "${1}" ]; then
		t=$($BYOBU_READLINK -f "$1")
	else
		t="$1"
	fi
	t="${t##*/}";
	[ -h "/sys/block/$t" ] && _RET="$t" || rtrim "$t" "0-9"
}

__disk_io() {
	local part= i=
	# Default to disk providing /, but let users override with MONITORED_DISK
	[ -z "$MONITORED_DISK" ] && mount_point="/" ||  mount_point="$MONITORED_DISK"
	# By default, we won't bug the user with the display of network traffic
	# below DISK_IO_THRESHOLD in kB/s; override in $BYOBU_CONFIG_DIR/status
	[ -n "$DISK_IO_THRESHOLD" ] || DISK_IO_THRESHOLD=50
	case "$mount_point" in
		/dev/*) part="${mount_point}";;
		*) part=$(awk '$2 == mp { print $1 ; exit(0); }' "mp=$mount_point" /etc/mtab);;
	esac
	[ -e "$part" ] || return
	getdisk "$part"
	local disk=${_RET}
	local t2=$(date +%s) t1=
	for i in "read" "write"; do
		local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/disk.$i"
		t1=$(stat -c %Y "$cache") 2>/dev/null || t1=0
		local unit="kB/s"
		local rate=0 x1=0 x2=0 symbol= unit=
		if [ $t2 -le $t1 ]; then
			rate=0
		else
			[ -r "$cache" ] && read x1 < "$cache"
			local a1= a2= a3= a4= a5= a6= a7= a8= a9= a10=
			read a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 other < "/sys/block/$disk/stat"
			if [ "$i" = "read" ]; then
				symbol="$ICON_RD"
				[ -n "$a3" ] && x2="$a3" || x2=0
			else
				symbol="$ICON_WR"
				[ -n "$a7" ] && x2="$a7" || x2=0
			fi
			printf "%s" "$x2" > "$cache"
			rate=$((($x2 - $x1) / ($t2 - $t1) * 512 / 1024))
			if [ $rate -lt $DISK_IO_THRESHOLD ]; then
				# Below threshold, don't print
				continue
			elif [ "$rate" -lt 0 ]; then
				rate=0
			elif [ "$rate" -gt 1048576 ]; then
				unit="GB/s"
				fpdiv "$rate" 1048576 0
				rate=${_RET}
			elif [ "$rate" -gt 1024 ]; then
				unit="MB/s"
				fpdiv "$rate" 1024 0
				rate=${_RET}
			else
				unit="kB/s"
			fi
		fi
		if [ -z "$rate" ] || [ "$rate" = "0" ]; then
			rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/disk_io"*
		else
			color b M W; printf "%s%s" "$symbol" "$rate"; color -; color M W; printf "%s" "$unit"; color --
		fi
	done
}

# vi: syntax=sh ts=4 noexpandtab
PK�]�?t�wifi_qualitynuȯ��#!/bin/sh -e
#
#    wifi_quality: display wifi signal quality
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

___get_dev_list() {
	if [ -n "$MONITORED_NETWORK" ]; then
		echo "$MONITORED_NETWORK"
	else
		iw dev | grep Interface | cut -f2 -d\ 
	fi
}

__wifi_quality_detail() {
	if eval $BYOBU_TEST iw >/dev/null 2>&1; then
		local dev
		for dev in $(___get_dev_list); do
			iw dev "$dev" info
			iw dev "$dev" link
			echo
		done
	elif eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then
		iwconfig 2>/dev/null
	fi
}

__wifi_quality() {
	local out bitrate quality
	if eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then
		# iwconfig is expected to output lines like:
		#    Bit Rate=54 Mb/s   Tx-Power=15 dBm
		#    Link Quality=60/70  Signal level=-50 dBm
		# the awk below tokenizes the output and prints shell evalable results
		out=`iwconfig $MONITORED_NETWORK 2>/dev/null |
			awk '$0 ~ /[ ]*Link Quality./ {
			    sub(/.*=/,"",$2); split($2,a,"/");
			    printf "quality=%.0f\n", 100*a[1]/a[2] };
			    $0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); }
			    '`
		eval "$out"
	elif eval $BYOBU_TEST iw >/dev/null 2>&1; then
		local dev
		for dev in $(___get_dev_list); do
			# iw is expected to output lines like:
			#     signal: -50 dBm
			#     rx bitrate: 216.0 MBit/s MCS 13 40MHz
			# signal to quality: https://superuser.com/a/1360447
			out=`iw dev "$dev" link 2>/dev/null |
				awk '$0 ~ /^\s*signal:/ { a = 100 * ($2 + 110) / 70;
				    printf "quality=%.0f\n", (a > 100) ? 100 : ((a < 0) ? 0 : a); }
				    $0 ~ /^\s*rx bitrate:/ { printf "bitrate=%s\n", $3; }
				    '`
			eval "$out"
			[ -z "$bitrate" ] || [ -z "$quality" ] || break
		done
	fi
	[ -n "$bitrate" ] || bitrate=0
	[ -n "$quality" ] || quality=0
	if [ "$bitrate" -gt 0 ] && [ "$quality" -gt 0 ]; then
		printf "${ICON_WIFI}"; color b C k; printf "%s" "$bitrate"; color -; color C k; printf "%s" "$ICON_MBPS"; color -; color b C k; printf "%s" "$quality"; color -; color C k; printf "%s" "$PCT"; color --
	else
		rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/wifi_quality"*
	fi
}

# vi: syntax=sh ts=4 noexpandtab
PK�]��`+hhnetworknuȯ��#!/bin/sh -e
#
#    network: calculate the network up/down rates
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__network_detail() {
	get_network_interface; local interface="$_RET"
	LC_ALL=C /sbin/ip addr show "$interface" | $BYOBU_SED 's/\s*$//'
}

__network() {
	get_network_interface; local interface="$_RET"
	local x1=0 x2=0 tx1=0 i= t= unit= symbol= cache= rate=
	status_freq network
	t="$_RET"
	# By default, we won't bug the user with the display of network traffic
	# below NETWORK_THRESHOLD in kbps; override in $BYOBU_CONFIG_DIR/status
	[ -n "$NETWORK_THRESHOLD" ] || NETWORK_THRESHOLD=20
	for i in up down; do
		unit="kb"
		case $i in
			up) symbol="$ICON_UP" ;;
			down) symbol="$ICON_DN" ;;
		esac
		cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/network.$i"
		[ -r "$cache" ] && read x1 < "$cache" || tx1=0
		local iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed
		cat /proc/net/dev > "$cache".dev
		while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do
			case "$iface" in
				${interface}:)
					[ "$i" = "up" ] && x2=${tbytes} || x2=${rbytes}
					break;
				;;
				${interface}:*)
					# Interface and tbytes got munged together
					[ "$i" = "up" ] && x2=${rmulticast##*:} || x2=${iface##*:}
					break;
				;;
			esac
		done < "$cache".dev
		printf "%s" "$x2" > "$cache"
		rate=$((8*($x2 - $x1) / $t / 1024))  # in kbps
		[ "$rate" -lt 0 ] && rate=0
		if [ $rate -gt $NETWORK_THRESHOLD ]; then
			case "$NETWORK_UNITS" in
				bytes)
					rate=$(($rate/8))
					if [ "$rate" -gt 1048576 ]; then
						fpdiv "$rate" 1048576 1
						rate=${_RET}
						unit="GB/s"
					elif [ "$rate" -gt 1024 ]; then
						fpdiv "$rate" 1024 1
						rate=${_RET}
						unit="MB/s"
					else
						unit="kB/s"
					fi
				;;
				*)
					# Default to bps
					# Why 1000 and not 1024?  http://en.wikipedia.org/wiki/Data_rate_units
					if [ "$rate" -gt 1000000 ]; then
						fpdiv "$rate" 1000000 1
						rate=${_RET}
						unit="Gb"
					elif [ "$rate" -gt 1000 ]; then
						fpdiv "$rate" 1000 1
						rate=${_RET}
						unit="Mb"
					fi
				;;
			esac
			[ -n "$rate" ] || continue
			color b m w; printf "%s%s" "$symbol" "$rate"; color -; color m w; printf "%s" "$unit"; color --
		else
			rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/network"*
		fi
	done
}

# vi: syntax=sh ts=4 noexpandtab
PK�]퍽zZZcpu_freqnuȯ��#!/bin/sh -e
#
#    cpu_freq: calculate current cpu frequency
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__cpu_freq_detail() {
	cat /proc/cpuinfo
}

__cpu_freq() {
	local hz freq count
	if [ -r "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" ]; then
		read hz < /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
		fpdiv $hz "1000000" 1 # 1Ghz
		freq="$_RET"
	elif [ -r "/proc/cpuinfo" ]; then
		if egrep -q -s -i -m 1 "^cpu MHz|^clock" /proc/cpuinfo; then
			freq=$(egrep -i -m 1 "^cpu MHz|^clock" /proc/cpuinfo | awk -F"[:.]" '{ printf "%01.1f", $2 / 1000 }')
		else
			# Must scale frequency by number of processors, if counting bogomips
			count=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo)
			freq=$(egrep -i -m 1 "^bogomips" /proc/cpuinfo | awk -F"[:.]" '{ print $2 }')
			freq=$(printf "%s %s" "$freq" "$count" | awk '{printf "%01.1f\n", $1/$2/1000}')
		fi
	elif hz=$(sysctl -n hw.cpufrequency 2>/dev/null); then
		fpdiv $hz "1000000000" 1 # 1Ghz
		freq="$_RET"
	fi
	[ -n "$freq" ] || return
	color b c W; printf "%s" "$freq"; color -; color c W; printf "%s" "$ICON_GHz"; color --
}

# vi: syntax=sh ts=4 noexpandtab
PK�]/�zz	processesnuȯ��#!/bin/sh -e
#
#    processes: report number of running processes
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__processes_detail() {
	ps -ej 2>/dev/null
}

__processes() {
	local count=
	if [ -r /proc ]; then
		count=$(ls -d /proc/[0-9]* 2>/dev/null | wc -l)
	else
		count=$(ps -ef | wc -l)
	fi
	[ -n "$count" ] || return
	color b y w; printf "%s" "$count"; color -; color y w; printf "&"; color --
}

# vi: syntax=sh ts=4 noexpandtab
PK�]p7�%%colornuȯ��#!/bin/sh -e
#
#    color: print the background/foreground color escape codes
#
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__color_detail() {
	true
}

__color() {
	[ -z "$FOREGROUND" ] && FOREGROUND="w"
	[ -z "$BACKGROUND" ] && BACKGROUND="k"
	case "$BYOBU_BACKEND" in
		tmux)
			true
		;;
		screen)
			printf "\005{= $BACKGROUND$FOREGROUND}"
		;;
	esac
}

# vi: syntax=sh ts=4 noexpandtab
PK�]%���usersnuȯ��#!/bin/sh -e
#
#    users: print the number of remote users on the machine
#
#    Copyright (C) 2009 Raphaël Pinson.
#    Copyright (C) 2009 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Raphaël Pinson <raphink@ubuntu.com>
#             Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__users_detail() {
	ps -ef 2>/dev/null | grep "sshd:.*@" | grep -v grep
}

__users() {
	local count=0
	if [ "$USERS_DISTINCT" = "1" ]; then
		count=$(pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l)
	else
		# Note: we'd like to use pgrep -c, however, this isn't available in
		# busybox and some distro's pgrep (and it doesn't exit non-zero).
		count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l) || return
	fi
	if [ $count -gt 0 ]; then
		color b w r; printf "%d" "$count"; color -; color w r; printf "##"; color --
	else
		rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"*
	fi
}

# vi: syntax=sh ts=4 noexpandtab
PK�]���ff	fan_speednuȯ��#!/bin/sh -e
#
#    fan_speed: speed of the cpu or case fan
#
#    Copyright (C) 2009 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__fan_speed_detail() {
	# Nothing interesting to say here about fan speed
	return
}

__fan_speed() {
	local i="" speed=0
	# Let's check a few different probes for fan speed
	# This seems to cover most of them:
	for i in $FAN /sys/class/hwmon/*/*/fan1_input /sys/class/hwmon/*/device/hwmon/*/fan1_input; do
		[ -f "$i" ] || continue
		read speed < "$i"
		if [ -n "$speed" ] && [ "$speed" -gt 0 ]; then
			color bold1; printf "%s" "$speed"; color -; color none; printf "rpm"; color --
			return 0
		fi
	done

	# But others (e.g. Dell Inspirons) seem to be here:
	if [ -r /proc/i8k ]; then
		local line=""
		read line < /proc/i8k
		set -- $line
		for speed in $7 $8; do
			if [ -n "$speed" ] && [ "$speed" -gt 0 ]; then
				# I8K_FAN_MULT defaults to 30 (buggy BIOS workaround?),
				# use `modprobe i8k fan_mult=1` to disable if unneeded,
				# resulting in nonsensical speeds
				[ "$speed" -gt 10000 ] && speed=$((${speed} / 30))
				color bold1; printf "%s" "$speed"; color -; color none; printf "rpm"; color --
				return 0
			fi
		done
	fi
}

# vi: syntax=sh ts=4 noexpandtab
PK�].�S�bbservicesnuȯ��#!/bin/sh -e
#
#    services: show what services are running on this server (configurable)
#
#    Copyright (C) 2009 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__services_detail() {
	return
}

service_running() {
	if [ -f "/etc/init/$1.conf" ]; then
		# Use upstart
		case "$(status $1 2>/dev/null)" in
			*running*)
				true
			;;
			*)
				false
			;;
		esac
	elif [ -f "/etc/init.d/$1" ]; then
		# Fall back to sysvinit
		/etc/init.d/$1 status >/dev/null 2>&1
	else
		false
	fi
}

__services() {
	local services="$SERVICES"
	# Users can define a list of services to monitor in $BYOBU_CONFIG_DIR/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
			# UEC system, default to the list of Ubuntu Enterprise Cloud Services
			services="eucalyptus-cloud|CLC eucalyptus-walrus|WC eucalyptus-cc|CC eucalyptus-sc|SC eucalyptus-nc|NC"
		fi
	fi
	output=
	for i in $services; do
		service=${i%|*}
		nick=${i#*|}
		case "$service" in
			eucalyptus-nc)
				if service_running $service; then
					# This is a node controller, determine VM usage
					. /etc/eucalyptus/eucalyptus.conf
					count=$(pgrep -c -f /usr/bin/kvm || true)
					output="$output,NC:$count"
				fi
			;;
			*)
				service_running $service && output="$output,$nick"
			;;
		esac
	done
	[ -n "$output" ] || return
	color w c; printf "%s" ${output#,}; color --
}

# vi: syntax=sh ts=4 noexpandtab
PK�]����archnuȯ��#!/bin/sh -e
#
#    arch: print the machine architecture
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__arch_detail() {
	uname -a
}

__arch() {
	printf "%s " $(uname -m)
}

# vi: syntax=sh ts=4 noexpandtab
PK�]H?���
ip_addressnuȯ��#!/bin/sh -e
#
#    ip_address: report a host's ip address
#
#    Copyright (C) 2008-2011 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__ip_address_detail() {
	if [ -x /sbin/ip ]; then
		/sbin/ip -4 addr list
		/sbin/ip -6 addr list
	fi
}

__ip_address() {
	local interface ipaddr cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/ip_address"
	# Allow interface overrides in $BYOBU_CONFIG_DIR/statusrc
	if [ -n "$MONITORED_NETWORK" ]; then
		interface="$MONITORED_NETWORK"
	else
		case "$IPV6" in
			1|true|yes) interface=$(awk '$10 != "lo" { iface=$10 ; }; END { print iface; }' /proc/net/ipv6_route);;
			*) get_network_interface; interface="$_RET";;
		esac
	fi
	case "$IPV6" in
		1|true|yes)
			if [ "$IP_EXTERNAL" = "1" ]; then
				# Background an update
				timeout 1 wget -q -O- http://v6.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
				sleep 0.02
			else
				# Background an update
				if [ -x /sbin/ip ]; then
					LC_ALL=C /sbin/ip -6 addr list dev "$interface" scope global </dev/null >"$cache" 2>/dev/null &
				elif eval $BYOBU_TEST ifconfig >/dev/null 2>&1; then
					LC_ALL=c ifconfig "$interface" | grep "inet6 " | awk '{print $2}' | sed -e "s/%.*//" >"$cache" 2>/dev/null &

				fi
			fi
			[ -s "$cache" ] && read ipaddr < "$cache"
			# Print 'None' if we have no global address
			[ -z "$ipaddr" ] && ipaddr="None"
			ipaddr=${ipaddr#* inet6 }
			ipaddr=${ipaddr%%/*}
		;;
		*)
			if [ "$IP_EXTERNAL" = "1" ]; then
				timeout 1 wget -q -O- http://v4.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
				sleep 0.02
				[ -s "$cache" ] && read ipaddr < "$cache"
			elif metadata_available; then
				# We're in EC2, so get our public IP address
				timeout 0.2 wget -q -O- http://169.254.169.254/latest/meta-data/public-ipv4 </dev/null >"$cache" 2>/dev/null &
				sleep 0.02
				[ -s "$cache" ] && read ipaddr < "$cache"
			else
				if [ -x /sbin/ip ]; then
					ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global 2>/dev/null)
					ipaddr=${ipaddr#* inet }
					ipaddr=${ipaddr%%/*}
				elif eval $BYOBU_TEST ifconfig >/dev/null 2>&1; then
					ipaddr=$(ifconfig "$interface" | grep "inet " | awk '{print $2}')
				fi
			fi
		;;
	esac
	if [ -n "$ipaddr" ]; then
		if [ "$1" = "t" ]; then
			printf "%s" "$ipaddr"
		else
			color b w k; printf "%s" "$ipaddr"; color --
		fi
	fi
}

# vi: syntax=sh ts=4 noexpandtab
PK�]m[��

whoaminuȯ��#!/bin/sh -e
#
#    whoami: report current logged in user
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

___get_user() {
	if eval $BYOBU_TEST whoami >/dev/null 2>&1; then
		whoami
	elif eval $BYOBU_TEST id >/dev/null 2>&1; then
		id -un
	fi
}

__whoami_detail() {
	local user=$(___get_user)
	[ -n "$user" ] || return
	if eval $BYOBU_TEST getent >/dev/null 2>&1; then
		getent -- passwd "$user"
	else
		grep "^$user:" /etc/passwd
	fi
}

__whoami() {
	local user=$(___get_user)
	[ -n "$user" ] || return
	color bold2; printf "%s@" "$user"; color -
}

# vi: syntax=sh ts=4 noexpandtab
PK�]i€))sessionnuȯ��#!/bin/sh -e
#
#    session: tmux session name
#
#    Copyright (C) 2013-2014 Dustin Kirkland <kirkland@byobu.org>
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__session_detail() {
	tmux list-sessions
}

__session() {
	# Note: This will only work in byobu-tmux
	case "$BYOBU_BACKEND" in
		tmux)
			local count=$(tmux list-sessions 2>/dev/null | grep -v "^_" | wc -l)
			if [ $count -gt 1 ]; then
				color u W k; printf "${ICON_SESSION}#S"; color --
			else
				echo
			fi
		;;
		screen)
			local count=$(screen -ls | grep "^\s\+.*)$" | wc -l)
			if [ $count -gt 1 ]; then
				color u W k; printf "${ICON_SESSION}%S"; color --
			else
				echo
			fi
		;;
	esac
}

# vi: syntax=sh ts=4 noexpandtab
PK�])/���include/commonnuȯ��#!/bin/sh
#
#    common: common stuff sourced by all scripts
#
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

if [ -z "${BYOBU_INCLUDED_LIBS}" ]; then
	# Needed to set up $BYOBU_CONFIG_DIR
	. "${BYOBU_PREFIX}/lib/${PKG}/include/dirs"

	# Find command/type/which
	for BYOBU_TEST in "command -v" "type" "which"; do
		eval $BYOBU_TEST ls >/dev/null 2>&1 && break || true
	done

	# If the backend is already set (eg. running `byobu-tmux`), do nothing.
	if [ -z "${BYOBU_BACKEND}" ]; then
		[ -r "/etc/$PKG/backend" ] && . "/etc/$PKG/backend"
		[ -r "$BYOBU_CONFIG_DIR/backend" ] && . "$BYOBU_CONFIG_DIR/backend"
		# Just in case there's no config file at all
		if [ -z "${BYOBU_BACKEND}" ]; then
			# New byobu configuration, default to tmux
			if eval $BYOBU_TEST tmux >/dev/null; then
				BYOBU_BACKEND="tmux"
			elif eval $BYOBU_TEST screen >/dev/null; then
				BYOBU_BACKEND="screen"
			else
				printf "%s\n" "ERROR: $PKG won't work without tmux or screen installed" 1>&2
			fi
		fi
  	fi

	# Creating backend cache
	[ -d "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND"

	. "${BYOBU_PREFIX}/lib/${PKG}/include/shutil"
	. "${BYOBU_PREFIX}/lib/${PKG}/include/constants"
	get_distro || true
	export BYOBU_DISTRO="$_RET"
	BYOBU_INCLUDED_LIBS=1
fi
PK�]��Ļ�&include/tmux-send-command-to-all-panesnuȯ��#!/bin/sh
#
#    tmux-send-command-to-all-panes
#    Copyright (C) 2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

w=$(tmux list-windows | grep "\*" | awk -F: '{print $1}')
for p in $(tmux list-panes | $BYOBU_SED -e "s/:.*//"); do
	tmux send-keys -t $w.$p "$@" || true
	tmux send-keys -t $w.$p Enter || true
done
PK�]ih=;;*include/tmux-detach-all-but-current-clientnuȯ��#!/bin/sh
#
#    tmux-detach-all-but-current-client
#    Copyright (C) 2013-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

a1=
a2=
tty1=
tty2=
# List all clients, ordered by most recent activity descending
for c in $(tmux list-clients -F "#{client_activity}___#{client_tty}" | sort -n -r); do
	if [ -z "$a1" ]; then
		a1=${c%%___*}
		tty1=${c##*___}
	elif [ -z "$a2" ]; then
		a2=${c%%___*}
		tty2=${c##*___}
	fi
	if [ -n "$a1" ] && [ -n "$a2" ]; then
		if [ "$a1" = "$a2" ]; then
			# Activity timestamps match in top 2 attached clients
			# Let's not detach anyone here!
			tmux display-message "Multiple active attached clients detected, refusing to detach" >/dev/null 2>&1
		elif [ -n "$tty1" ]; then
			# Detach all but the current client, iterating across each
			# Tempting to use detach-client -a -t here, but there's a bug
			# in there, keeping that from working properly
			tmux detach-client -t "$tty2" >/dev/null 2>&1
			a2=
		fi
	fi
done
PK�]�qq(include/tmux-send-command-to-all-windowsnuȯ��#!/bin/sh
#
#    tmux-send-command-to-all-windows
#    Copyright (C) 2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

for w in $(tmux list-windows | $BYOBU_SED -e "s/:.*//"); do
	tmux send-keys -t :$w "$@"
	tmux send-keys -t :$w Enter
done
PK�]/+��include/notify_osdnuȯ��#!/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 <kirkland@byobu.org>
#             with help from Mathias Gug <mathias.gug@canonical.com>
#
#    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 <http://www.gnu.org/licenses/>.

$/ = "\n\n";
$PKG = "byobu";
$sleep = 5;
while (<STDIN>) {
	# Ensure that the notify_osd indicator is enabled
	my $skip = 0;
	open(F, "<$ENV{BYOBU_CONFIG_DIR}/status");
	foreach my $i (<F>) {
		if ($i =~ /notify_osd=0/) {
			$skip = 1;
		}
	}
	close(F);
	if ($skip == 1) {
		next;
	}
	$msg = $_;
	$msg =~ s/\[[^,]*, //;		# strip the leading "[timestamp, "
	$msg =~ s/\] /: /;		# replace the " ] " following the indicator name, with ":"
	$msg =~ s/\s+/ /g;		# collapse multi-whitespace into one
	$msg =~ s/\s+$//g;		# strip trailing whitespace
	$msg =~ s/^\s+//g;		# strip leading whitespace
	system("/usr/bin/screen", "-X", "-S", "$ARGV[0]", "at", "*", "msgwait", "$sleep");
	system("/usr/bin/screen", "-X", "-S", "$ARGV[0]", "at", "*", "echo", "[$msg]");
	sleep($sleep);
	system("/usr/bin/screen", "-X", "-S", "$ARGV[0]", "at", "*", "msgwait", "0");
}
PK�]��include/colorsnuȯ��#!/bin/sh
#
#    colors: some color values needed by all library status scripts
#
#    Copyright (C) 2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

# Default colors
# Inspired by http://design.ubuntu.com/brand/colour-palette

# Cool grey
export BYOBU_DARK="\#333333"

# Warm white
export BYOBU_LIGHT="\#EEEEEE"

# Aubergine
export BYOBU_ACCENT="\#75507B"

# Ubuntu orange
export BYOBU_HIGHLIGHT="\#DD4814"
PK�]���YY
include/iconsnuȯ��#!/bin/sh
#
#    icons: some icon characters for status scripts
#
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

PKG="byobu"

# UTF-8 support in the hardstatus is coming one day in Screen
if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
	#ICON_C="℃"
	#ICON_F="℉"
	ICON_C="C"
	ICON_F="F"
	ICON_RD="◂"
	ICON_WR="▸"
	ICON_MAIL="⍌"
	ICON_UP="▴"
	ICON_DN="▾"
	ICON_TRASH="♸"
	ICON_WIFI=
	ICON_REBOOT="⟳"
	ICON_UPDATES="!"
	ICON_UPGRADE="⚠"
	ICON_SECURITY="‼"
	#ICON_KB="㎅"
	#ICON_MB="㎆"
	#ICON_GB="㎇"
	ICON_KB="K"
	ICON_MB="M"
	ICON_GB="G"
	ICON_TB="T"
	#ICON_KHz="㎑"
	#ICON_MHz="㎒"
	#ICON_GHz="㎓"
	ICON_KHz="KHz"
	ICON_MHz="MHz"
	ICON_GHz="GHz"
	#ICON_MBPS="㏔㎰"
	ICON_MBPS="Mb"
	ICON_SESSION="〣"
	ICON_LIVEPATCHED="🗹 "
else
	# Only use 0-127 ANSI: http://ascii-table.com/ascii.php
	ICON_C="C"
	ICON_F="F"
	ICON_RD="<"
	ICON_WR=">"
	ICON_MAIL="[M]"
	ICON_UP="^"
	ICON_DN="v"
	ICON_TRASH="T"
	ICON_WIFI=
	ICON_REBOOT="(R)"
	ICON_UPDATES="!"
	ICON_UPGRADE="/!\\\\\\"
	ICON_SECURITY="!!"
	ICON_KB="KB"
	ICON_MB="MB"
	ICON_GB="GB"
	ICON_TB="TB"
	ICON_KHz="kHz"
	ICON_MHz="MHz"
	ICON_GHz="GHz"
	ICON_MBPS="Mbps"
	ICON_SESSION="|"
	ICON_LIVEPATCHED="[/]"
fi
PK�]03�	�	include/dirsnuȯ��#!/bin/sh
#
#    dirs: some dirs needed by all library status scripts
#
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

PKG="byobu"

# Some users build and install byobu themselves, rather than from a distro
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -n "$BYOBU_PREFIX" ] || BYOBU_PREFIX="/usr"

# Create and export the user configuration directory
# BYOBU_CONFIG_DIR if set, ~/.byobu if it exists, otherwise XDG_CONFIG_HOME/byobu
if [ -z "$BYOBU_CONFIG_DIR" ]; then
	if [ -d "$HOME/.$PKG" ]; then
		export BYOBU_CONFIG_DIR="$HOME/.$PKG"
	else
		_xdg="${XDG_CONFIG_HOME:-"$HOME"/.config}"
		# Spec says XDG_CONFIG_HOME must not be world-readable
		[ -d "$_xdg" ] || mkdir -p -m 700 "$_xdg"
		export BYOBU_CONFIG_DIR="$_xdg/$PKG"
		unset _xdg
	fi
fi
[ -d "$BYOBU_CONFIG_DIR/bin" ] || mkdir -p "$BYOBU_CONFIG_DIR/bin"

# Grab the global, then local socket directory
[ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir"
[ -r "$BYOBU_CONFIG_DIR/socketdir" ] && . "$BYOBU_CONFIG_DIR/socketdir"

# Create and export the runtime cache directory
if [ -w /dev/shm ]; then
	# Use shm for performance, if possible
	for i in /dev/shm/$PKG-$USER-*; do
		if [ -d "$i" ] && [ -O "$i" ]; then
			export BYOBU_RUN_DIR="$i"
			break
		fi
	done
	# Still empty, make a new one
	if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ]; then
		export BYOBU_RUN_DIR=$(mktemp -d /dev/shm/$PKG-$USER-XXXXXXXX)
	fi
fi
if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ] || [ ! -w "$BYOBU_RUN_DIR" ]; then
	# For distros that don't have a /dev/shm, use local disk
	if [ -d "$XDG_CACHE_HOME" ]; then
		# Use XDG, as some users insist on such nonsense :-)
		export BYOBU_RUN_DIR="$XDG_CACHE_HOME/$PKG"
	else
		# But if not, we'll use a cache directory
		export BYOBU_RUN_DIR="$HOME/.cache/$PKG"
	fi
fi
PK�]s(�K��include/mondriannuȯ��#!/bin/bash
# N.B.: Use bash for $RANDOM
#
#    mondrian: randomly generate some Modrian art in tmux
#
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

trap "tput reset" EXIT HUP INT QUIT TERM KILL ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM

# Special mode, argv[1]="color", paint the screen
if [ "$1" = "color" ] && [ -n "$2" ]; then
	i=0
	out=
	sleep 0.2
	count=$(stty size | awk '{print $1*$2}')
	perl -e "print color 'reset'; printf \"\x1b[48;5;${2}m%${count}s\", \" \";";
	head -n1
	tmux kill-window -t mondrian
	exit 0
fi

get_random_direction() {
	if [ $((RANDOM % 2)) -eq 0 ]; then
		echo "-v"
	else
		echo "-h"
	fi
}

get_random_numbers() {
	local max="$1" R=0 B=0 Y=0
	R=$((RANDOM % max + 1))
	B=$((RANDOM % max + 1))
	Y=$((RANDOM % max + 1))
	while [ "$B" = "$R" ] || [ "$B" = "$Y" ]; do
		B=$((RANDOM % max + 1))
	done
	while [ "$Y" = "$R" ] || [ "$Y" = "$B" ]; do
		Y=$((RANDOM % max + 1))
	done
	_RET="$R $B $Y"
}

red_color=196
yellow_color=226
blue_color=57
white_color=231

tmux kill-window -t mondrian
tmux new-window -n mondrian "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	set-option -g pane-active-border-style bg=colour231 \; \
	set-option -g pane-active-border-style fg=black \; \
	set-option -g pane-border-style bg=colour231 \; \
	set-option -g pane-border-style fg=black \; \
	split-window $(get_random_direction) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 2)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 3)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 4)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $red_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 5)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 6)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $yellow_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 7)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 8)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $blue_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 9)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 9)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 10)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 11)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 12)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 13)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 14)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 15)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 16)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 17)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 18)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 19)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
	split-window $(get_random_direction) -t $((RANDOM % 20)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \

exit 0
PK�]1���
�
include/constantsnuȯ��#!/bin/sh
#
#    constants: some constant values needed by all library status scripts
#
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

PKG="byobu"

. "${BYOBU_PREFIX}/lib/${PKG}/include/icons"
. "${BYOBU_PREFIX}/lib/${PKG}/include/colors"

PCT="%"

# Some shell(s) don't set the USER environment value (looking at you, ash)
[ -z "$USER" ] && export USER=$(whoami)

# Support two different backends (screen/tmux)
if [ -z "$BYOBU_BACKEND" ]; then
	[ -r "/etc/byobu/backend" ] && . "/etc/byobu/backend"
	[ -r "$BYOBU_CONFIG_DIR/backend" ] && . "$BYOBU_CONFIG_DIR/backend"
fi
case "$BYOBU_BACKEND" in
	tmux)
		export BYOBU_BACKEND
		BYOBU_ARG_VERSION="-V"
		ESC=
	;;
	screen)
		export BYOBU_BACKEND
		BYOBU_ARG_VERSION="-v"
		ESC="\005"
	;;
esac

# MacOS Support
eval $BYOBU_TEST gsed >/dev/null 2>&1 && export BYOBU_SED="gsed" || export BYOBU_SED="sed"
eval $BYOBU_TEST greadlink >/dev/null 2>&1 && export BYOBU_READLINK="greadlink" || export BYOBU_READLINK="readlink"
eval $BYOBU_TEST sensible-pager >/dev/null 2>&1 && export BYOBU_PAGER="sensible-pager" || export BYOBU_PAGER="less"
eval $BYOBU_TEST sensible-editor >/dev/null 2>&1 && export BYOBU_EDITOR="sensible-editor" || export BYOBU_EDITOR="$EDITOR"
eval $BYOBU_TEST "$BYOBU_EDITOR" >/dev/null 2>&1 || export BYOBU_EDITOR="vim"


# Check sed's follow-symlinks feature
$BYOBU_SED --follow-symlinks "s///" /dev/null 2>/dev/null && BYOBU_SED_INLINE="$BYOBU_SED -i --follow-symlinks" || BYOBU_SED_INLINE="$BYOBU_SED -i"

# Determine if we have ulimit support
eval $BYOBU_TEST ulimit >/dev/null 2>&1 && export BYOBU_ULIMIT="ulimit" || export BYOBU_ULIMIT="false"

# Find a suitable python interpreter, if undefined
if [ -z "$BYOBU_PYTHON" ]; then
	if python3 -c "import snack" >/dev/null 2>&1; then
		export BYOBU_PYTHON="python3"
	elif python2 -c "import snack" >/dev/null 2>&1; then
		export BYOBU_PYTHON="python2"
	elif python -c "import snack" >/dev/null 2>&1; then
		export BYOBU_PYTHON="python"
	fi
fi

export BYOBU_WINDOW_NAME="-"
export BYOBU_DATE="%Y-%m-%d "
export BYOBU_TIME="%H:%M:%S"
PK�]6�6��)�)include/config.pynuȯ��#! /usr/bin/python3
#
#    config.py
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2008-2014 Dustin Kirkland <kirkland@byobu.org>

#
#    Authors: Nick Barcet <nick.barcet@ubuntu.com>
#             Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

# If you change any strings, please generate localization information with:
#       ./debian/rules get-po

from __future__ import print_function
import sys
import os
import os.path
import time
import string
import subprocess
import gettext
import glob


def error(msg):
	print("ERROR: %s" % msg)
	sys.exit(1)


try:
	import snack
	from snack import *
except Exception:
	error("Could not import the python snack module")


PKG = "byobu"
HOME = os.getenv("HOME")
USER = os.getenv("USER")
BYOBU_CONFIG_DIR = os.getenv("BYOBU_CONFIG_DIR", HOME + "/.byobu")
BYOBU_RUN_DIR = os.getenv("BYOBU_RUN_DIR", HOME + "/.cache/byobu")
BYOBU_BACKEND = os.getenv("BYOBU_BACKEND", "tmux")
BYOBU_SOCKETDIR = os.getenv("SOCKETDIR", "/var/run/screen")
BYOBU_PREFIX = os.getenv("BYOBU_PREFIX", "/usr")
SHARE = BYOBU_PREFIX + '/share/' + PKG
DOC = BYOBU_PREFIX + '/share/doc/' + PKG
if not os.path.exists(SHARE):
	SHARE = BYOBU_CONFIG_DIR + "/" + SHARE
if not os.path.exists(DOC):
	DOC = BYOBU_PREFIX + '/share/doc/packages/' + PKG
if not os.path.exists(DOC):
	DOC = BYOBU_CONFIG_DIR + "/" + DOC
DEF_ESC = "A"
RELOAD = "If you are using the default set of keybindings, press\n<F5> or <ctrl-a-R> to activate these changes.\n\nOtherwise, exit this session and start a new one."
RELOAD_FLAG = "%s/reload-required" % (BYOBU_RUN_DIR)
ESC = ''
snack.hotkeys[ESC] = ord(ESC)
snack.hotkeys[ord(ESC)] = ESC
gettext.bindtextdomain(PKG, SHARE + '/po')
gettext.textdomain(PKG)
_ = gettext.gettext


def ioctl_GWINSZ(fd):
	# Discover terminal width
	try:
		import fcntl
		import termios
		import struct
		import os
		cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
	except Exception:
		return None
	return cr


def reload_required():
	try:
		if not os.path.exists(BYOBU_CONFIG_DIR):
			# 493 (decimal) is 0755 (octal)
			# Use decimal for portability across all python versions
			os.makedirs(BYOBU_CONFIG_DIR, 493)
		f = open(RELOAD_FLAG, 'w')
		f.close()
		if BYOBU_BACKEND == "screen":
			subprocess.call([BYOBU_BACKEND, "-X", "at", "0", "source", "%s/profile" % BYOBU_CONFIG_DIR])
	except Exception:
		True


def terminal_size():
	# decide on some terminal size
	cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
	# try open fds
	if not cr:
		# ...then ctty
		try:
			fd = os.open(os.ctermid(), os.O_RDONLY)
			cr = ioctl_GWINSZ(fd)
			os.close(fd)
		except Exception:
			pass
	if not cr:
		# env vars or finally defaults
		try:
			cr = (env['LINES'], env['COLUMNS'])
		except Exception:
			cr = (25, 80)
	# reverse rows, cols
	return int(cr[1] - 5), int(cr[0] - 5)


def menu(snackScreen, size, isInstalled):
	if isInstalled:
		installtext = _("Byobu currently launches at login (toggle off)")
	else:
		installtext = _("Byobu currently does not launch at login (toggle on)")
	li = Listbox(height=6, width=60, returnExit=1)
	li.append(_("Help -- Quick Start Guide"), 1)
	li.append(_("Toggle status notifications"), 2)
	li.append(_("Change escape sequence"), 3)
	li.append(installtext, 4)
	bb = ButtonBar(snackScreen, (("Exit", "exit", ESC),), compact=1)
	g = GridForm(snackScreen, _(" Byobu Configuration Menu"), 1, 2)
	g.add(li, 0, 0, padding=(4, 2, 4, 2))
	g.add(bb, 0, 1, padding=(1, 1, 0, 0))
	if bb.buttonPressed(g.runOnce()) == "exit":
		return 0
	else:
		return li.current()


def messagebox(snackScreen, width, height, title, text, scroll=0, buttons=((_("Okay"), "okay"), (_("Cancel"), "cancel", ESC))):
	t = Textbox(width, height, text, scroll=scroll)
	bb = ButtonBar(snackScreen, buttons, compact=1)
	g = GridForm(snackScreen, title, 1, 2)
	g.add(t, 0, 0, padding=(0, 0, 0, 0))
	g.add(bb, 0, 1, padding=(1, 1, 0, 0))
	return bb.buttonPressed(g.runOnce())


def help(snackScreen, size):
	f = open(DOC + '/help.' + BYOBU_BACKEND + '.txt')
	text = f.read()
	f.close()
	text = text.replace("<esckey>", getesckey(), 1)
	t = Textbox(67, 16, text, scroll=1, wrap=1)
	bb = ButtonBar(snackScreen, ((_("Menu"), "menu", ESC),), compact=1)
	g = GridForm(snackScreen, _("Byobu Help"), 2, 4)
	g.add(t, 1, 0)
	g.add(bb, 1, 1, padding=(1, 1, 0, 0))
	button = bb.buttonPressed(g.runOnce())
	return 100


def readstatus():
	status = {}
	glo = {}
	loc = {}
	for f in [SHARE + '/status/status', BYOBU_CONFIG_DIR + '/status']:
		if os.path.exists(f):
			try:
				exec(open(f).read(), glo, loc)
			except Exception:
				error("Invalid configuration [%s]" % f)
			if BYOBU_BACKEND == "tmux":
				items = "%s %s" % (loc["tmux_left"], loc["tmux_right"])
			else:
				items = "%s %s %s %s" % (loc["screen_upper_left"], loc["screen_upper_right"], loc["screen_lower_left"], loc["screen_lower_right"])
			for i in items.split():
				if i.startswith("#"):
					i = i.replace("#", "")
					status[i] = "0"
				else:
					status[i] = "1"
	li = []
	keys = list(status.keys())
	for i in sorted(keys):
		window = [int(status[i]), i]
		li.append(window)
	return li


def genstatusstring(s, status):
	new = ""
	glo = {}
	loc = {}
	exec(open(SHARE + '/status/status').read(), glo, loc)
	for i in loc[s].split():
		if i.startswith("#"):
			i = i.replace("#", "")
		if status[i] == 1:
			new += " " + i
		else:
			new += " #" + i
	return new


def writestatus(items):
	status = {}
	path = BYOBU_CONFIG_DIR + '/status'
	for i in items:
		status[i[1]] = i[0]
	for key in ["tmux_left", "tmux_right", "screen_upper_left", "screen_upper_right", "screen_lower_left", "screen_lower_right"]:
		if key.startswith(BYOBU_BACKEND):
			try:
				f = open(path, "r")
			except Exception:
				f = open(SHARE + '/status/status', "r")
			lines = f.readlines()
			f.close()
			try:
				f = open(path, "w")
			except Exception:
				f = open(path, "a+")
			for l in lines:
				if l.startswith("%s=" % key):
					val = genstatusstring(key, status)
					f.write("%s=\"%s\"\n" % (key, val))
				else:
					f.write(l)
			f.close


def togglestatus(snackScreen, size):
	itemlist = readstatus()
	rl = Label("")
	r = CheckboxTree(12, scroll=1)
	count = 0
	for item in itemlist:
		if item[0] != -1:
			r.append(item[1], count, selected=item[0])
		count = count + 1
	bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact=1)
	g = GridForm(snackScreen, _("Toggle status notifications"), 2, 4)
	g.add(rl, 0, 0, anchorLeft=1, anchorTop=1, padding=(4, 0, 0, 1))
	g.add(r, 1, 0)
	g.add(bb, 1, 1, padding=(4, 1, 0, 0))
	if bb.buttonPressed(g.runOnce()) != "cancel":
		count = 0
		for item in itemlist:
			if item[0] != -1:
				item[0] = r.getEntryValue(count)[1]
			count = count + 1
		writestatus(itemlist)
		reload_required()
	return 100


def install(snackScreen, size, isInstalled):
	out = ""
	if isInstalled:
		if subprocess.call(["byobu-launcher-uninstall"]) == 0:
			out = _("Byobu will not be launched next time you login.")
		button = messagebox(snackScreen, 60, 2, _("Message"), out, buttons=((_("Menu"), )))
		return 101
	else:
		if subprocess.call(["byobu-launcher-install"]) == 0:
			out = _("Byobu will be launched automatically next time you login.")
		button = messagebox(snackScreen, 60, 2, "Message", out, buttons=((_("Menu"), )))
		return 100


def appendtofile(p, s):
	f = open(p, 'a')
	try:
		f.write(s)
	except IOError:
		f.close()
		return
	f.close()
	return


def getesckey():
	line = ""
	if BYOBU_BACKEND == "tmux":
		path = BYOBU_CONFIG_DIR + '/keybindings.tmux'
		if os.path.exists(path):
			for l in open(path):
				if l.startswith("set -g prefix "):
					line = l
		else:
			return DEF_ESC
	else:
		path = BYOBU_CONFIG_DIR + '/keybindings'
		if os.path.exists(path):
			for l in open(path):
				if l.startswith("escape "):
					line = l
		else:
			return DEF_ESC
	if line == "":
		return DEF_ESC
	esc = line[line.find('^') + 1]
	if esc == "`":
		esc = " "
	return esc


def setesckey(key):
	if key.isalpha():
		# throw away outputs in order that the view isn't broken
		nullf = open(os.devnull, "w")
		subprocess.call(["byobu-ctrl-a", "screen", key], stdout=nullf)
		nullf.close()


def chgesc(snackScreen, size):
	esc = Entry(2, text=getesckey(), returnExit=1)
	escl = Label(_("Escape key: ctrl-"))
	bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact=1)
	g = GridForm(snackScreen, _("Change escape sequence"), 2, 4)
	g.add(escl, 0, 0, anchorLeft=1, padding=(1, 0, 0, 1))
	g.add(esc, 1, 0, anchorLeft=1)
	g.add(bb, 1, 1)
	g.setTimer(100)
	loop = 1
	while loop:
		which = g.run()
		if which == "TIMER":
			val = esc.value()
			if len(val) > 1:
				esc.set(val[1])
			# Ensure that escape sequence is not \ or /
			if val == '/' or val == '\\':
				esc.set(DEF_ESC)
			# Ensure that the escape sequence is not set to a number
			try:
				dummy = int(esc.value())
				esc.set(DEF_ESC)
			except Exception:
				# do nothing
				dummy = "foo"
		else:
			loop = 0
	snackScreen.popWindow()
	button = bb.buttonPressed(which)
	if button != "cancel":
		setesckey(esc.value())
		reload_required()
		if button == "exit":
			return 0
	return 100


def autolaunch():
	if os.path.exists(BYOBU_CONFIG_DIR + "/disable-autolaunch"):
		return 0
	try:
		for line in open("%s/.profile" % HOME):
			if "byobu-launch" in line:
				return 1
	except Exception:
		return 0
	if os.path.exists("/etc/profile.d/Z97-%s.sh" % PKG):
		return 1
	return 0


def main():
	"""This is the main loop of our utility"""
	size = terminal_size()
	snackScreen = SnackScreen()
	snackScreen.drawRootText(1, 0, _('Byobu Configuration Menu'))
	snackScreen.pushHelpLine(_('<Tab> between elements | <Enter> selects | <Esc> exits'))
	isInstalled = autolaunch()
	tag = 100
	while tag > 0:
		tag = menu(snackScreen, size, isInstalled)
		if tag == 1:
			tag = help(snackScreen, size)
		elif tag == 2:
			tag = togglestatus(snackScreen, size)
		elif tag == 3:
			tag = chgesc(snackScreen, size)
		elif tag == 4:
			tag = install(snackScreen, size, isInstalled)
			isInstalled = autolaunch()
	snackScreen.finish()
	sys.exit(0)


if __name__ == "__main__":
	main()
PK�]�����include/toggle-utf8nuȯ��#!/bin/sh -e
#
#    toggle-utf8
#    Copyright (C) 2013-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
[ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc"

if [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
	if grep -qs "^BYOBU_CHARMAP=" $BYOBU_CONFIG_DIR/statusrc 2>/dev/null; then
		sed -i -e "s/^BYOBU_CHARMAP=.*/BYOBU_CHARMAP=x/" $BYOBU_CONFIG_DIR/statusrc
	else
		echo "BYOBU_CHARMAP=x" >> $BYOBU_CONFIG_DIR/statusrc
	fi
	export BYOBU_CHARMAP=x
else
	if grep -qs "^BYOBU_CHARMAP=" $BYOBU_CONFIG_DIR/statusrc 2>/dev/null; then
		sed -i -e "s/^BYOBU_CHARMAP=.*/BYOBU_CHARMAP=UTF-8/" $BYOBU_CONFIG_DIR/statusrc
	else
		echo "BYOBU_CHARMAP=UTF-8" >> $BYOBU_CONFIG_DIR/statusrc
	fi
	export BYOBU_CHARMAP=UTF-8
fi
if [ -n "$TMUX" ]; then
	RC_FILE=$(echo "$SHELL" | $BYOBU_SED "s:.*/::")
	tmux send-keys " export BYOBU_CHARMAP=$BYOBU_CHARMAP ; . ~/.${RC_FILE}rc" \; send-keys Enter
fi

# vi: syntax=sh ts=4 noexpandtab
PK�]�?���"�"include/shutilnuȯ��#!/bin/sh
#
#    shutil: some shared utilities used by all status scripts
#
#    Copyright (C) 2011-2023 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#             Scott Moser <smoser@ubuntu.com>
#
#    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 <http://www.gnu.org/licenses/>.

# Define colors
color_screen() {
	ESC="\005"
	case "$1" in
		"") return 0 ;;
		-)   printf "$ESC{-}" ;;
		--)   printf "$ESC{-} " ;;
		esc)    printf "$ESC" ;;
		bold1)  printf "$ESC{=b }" || printf "$ESC{= }" ;;
		bold2)  printf "$ESC{+b }" || printf "$ESC{= }" ;;
		none)   printf "$ESC{= }" ;;
		invert) printf "$ESC{=r }" ;;
		*)
			local attr fg bg
			case $# in
				2)
					attr= ; fg=$1 ; bg=$2
				;;
				3)
					attr=$1 ; fg=$2 ; bg=$3
				;;
			esac
			if [ "$MONOCHROME" = "1" ]; then
				fg=
				bg=
			fi
			printf "$ESC{=$attr $fg$bg}"
		;;
	esac
}

color_map() {
	case "$1" in
		"k") _RET="black" ;;
		"r") _RET="red" ;;
		"g") _RET="green" ;;
		"y") _RET="yellow" ;;
		"b") _RET="blue" ;;
		"m") _RET="magenta" ;;
		"c") _RET="cyan" ;;
		"w") _RET="white" ;;
		"d") _RET="black" ;;
		"K") _RET="brightblack" ;;
		"R") _RET="brightred" ;;
		"G") _RET="brightgreen" ;;
		"Y") _RET="brightyellow" ;;
		"B") _RET="brightblue" ;;
		"M") _RET="brightmagenta" ;;
		"C") _RET="brightcyan" ;;
		"W") _RET="brightwhite" ;;
		*) _RET="$1" ;;
	esac
}

attr_map() {
	case "$1" in
		"d") _RET=,dim ;;
		"u") _RET=,underscore ;;
		"b") _RET=,bold ;;
		"r") _RET=,reverse ;;
		"s") _RET=,standout ;;
		"B") _RET=,blinking ;;
		"h") _RET=,hidden ;;
		"i") _RET=,italics ;;
		*) _RET= ;;
	esac
}

color_tmux() {
	local back fore attr
	case "$1" in
		"") return 0 ;;
		-)      printf "#[default]#[fg=$BYOBU_LIGHT,bg=$BYOBU_DARK]" ;;
		--)     printf "#[default]#[fg=$BYOBU_LIGHT]#[bg=$BYOBU_DARK] " ;;
		esc)    printf "" ;;
		bold*)  printf "#[default]#[fg=bold]" ;;
		none)   printf "#[default]#[fg=$BYOBU_LIGHT,bg=$BYOBU_DARK]" ;;
		invert) printf "#[default]#[reverse]" ;;
		*)
			if [ "$#" = "2" ]; then
				color_map "$1"; back="$_RET"
				color_map "$2"; fore="$_RET"
			else
				attr_map "$1";  attr="$_RET"
				color_map "$2"; back="$_RET"
				color_map "$3"; fore="$_RET"
			fi
			[ "$MONOCHROME" = "1" ] && printf "#[default]" || printf "#[default]#[fg=$fore$attr,bg=$back]"
		;;
	esac
}

color() {
	case "$BYOBU_BACKEND" in
		tmux)
			color_tmux "$@"
		;;
		screen)
			color_screen "$@"
		;;
	esac
}

# uncommented_lines(char=#)
# does the standard input have lines that do not start with 'char'?
uncommented_lines() {
	local line chr="${1:-#}"
	while read line; do
		[ "${line#${chr}}" = "${line}" ] && return 0;
	done
	return 1
}

# newest(file,file,file..)
# return the newest file in the list
newest() {
	local c="$1" i
	for i in "$@"; do [ "$i" -nt "$c" ] && c="$i"; done
	[ -e "$c" ] && _RET="$c"
}

error() {
	printf "%s\n" "ERROR: " "$@" 1>&2
}

fail() {
	[ $# -eq 0 ] || error "$@"; exit 1;
}

find_script() {
	# Allow for local status scripts
	if [ -x "$BYOBU_CONFIG_DIR/bin/$1" ]; then
		_RET="$BYOBU_CONFIG_DIR/bin/$1"
	elif [ -x "$BYOBU_PREFIX/lib/$PKG/$1" ]; then
		_RET="$BYOBU_PREFIX/lib/$PKG/$1"
	elif [ -x "$BYOBU_PREFIX/libexec/$PKG/$1" ]; then
		_RET="$BYOBU_PREFIX/libexec/$PKG/$1"
	else
		_RET="/dev/null"
	fi
}

# divide 2 integers and return a floating point number
# third argument indicates how many digits after the decimal
fpdiv() {
	local a=$1 b=$2 pres=${3:-3}
	local i=0 mp="10" whole="" part="" chunk="" n=0
	while i=$(($i+1)) && [ $i -le $pres ]; do
		mp="${mp}0"
		chunk="${chunk}?"
	done

	n=$(((${mp}*${a})/${b}))

	# round up if necessary
	[ $((($n-5)/10)) = $(($n/10)) ] && n=$(($n+5))

	# drop the last digit, which was only there for rounding
	n=${n%?}
	whole=${n%${chunk}}
	part=${n#${whole}}
	_RET=${whole:-0}${part:+.${part}}
	return
}

# rtrim(string,chars)
rtrim() {
	local tab=' ' cr="
"
	local cur="${1}" set="[${2:- ${tab}${cr}}]" n=""
	while n=${cur%${set}} && [ "$n" != "$cur" ]; do cur=${n}; done
	_RET=${cur}
}

readfile() {
	local c="" r="" cr="
"
	OIFS="$IFS"; IFS="";
	while read c; do
		r="$r${cr}$c"
	done
	IFS=$OIFS
	_RET=${r}
	return 0
}

metadata_available() {
	# This is really ugly.  We need a reliable, fast way of determining
	# if a metadata service is available, that does NOT slow down non-ec2
	# machines.
	local x=0 cache="$BYOBU_CONFIG_DIR/.metadata_available"
	# First, check the cache
	if [ -s "$cache" ]; then
		# Metadata is non-empty, so we have metadata available
		x=1
	else
		# Must seed the cache
		if [ -e /etc/ec2_version ] || [ -e /usr/sbin/update-grub-legacy-ec2 ]; then
			# This *looks* like a machine with metadata, so background a potentially slow check
			timeout 1 wget -q -O- --tries=1 http://169.254.169.254 </dev/null >"$cache" 2>/dev/null &
			sleep 0.02
			[ -s "$cache" ] && x=1
		fi
	fi
	[ "$x" = "1" ]
}

status_freq() {
# Define status frequencies
#   Use prime number intervals, to decrease collisions, which
#   yields some less expensive status updates.
#   ~86000 ~1 day
#   ~600   ~10 minutes
#   ~180   ~3 minutes
#   ~60    ~1 minute
	case "$1" in
		apport)		_RET=67 ;;
		arch)		_RET=9999991 ;;
		battery)	_RET=61 ;;
		color)		_RET=9999991 ;;
		cpu_count)	_RET=5 ;;
		cpu_freq)	_RET=2 ;;
		cpu_temp)	_RET=19 ;;
		custom)		_RET=5 ;;
		date)		_RET=9999991 ;;
		disk)		_RET=13 ;;
		disk_io)	_RET=3 ;;
		distro)		_RET=9999991 ;;
		entropy)	_RET=5 ;;
		fan_speed)	_RET=23 ;;
		hostname)	_RET=607 ;;
		ip_address)	_RET=127 ;;
		load_average)	_RET=2 ;;
		logo)		_RET=9999991 ;;
		mail)		_RET=5 ;;
		memory)		_RET=13 ;;
		menu)		_RET=9999991 ;;
		network)	_RET=3 ;;
		notify_osd)	_RET=9999991 ;;
		packages)	_RET=211 ;;
		processes)	_RET=7 ;;
		raid)		_RET=59 ;;
		reboot_required) _RET=5 ;;
		release)	_RET=599 ;;
		services)	_RET=53 ;;
		session)	_RET=9999991 ;;
		swap)		_RET=19 ;;
		time)		_RET=9999991 ;;
		time_binary)	_RET=23 ;;
		time_utc)	_RET=11 ;;
		trash)		_RET=9999991 ;;
		updates_available) _RET=7 ;;
		uptime)		_RET=29 ;;
		users)		_RET=11 ;;
		whoami)		_RET=86029 ;;
		wifi_quality)	_RET=17 ;;
		*)		_RET=9999991 ;;
	esac
}

get_now() {
	if [ -r /proc/uptime ]; then
		# return the integer part of the first item in /proc/uptime
		local s c
		read s c < /proc/uptime
		_RET=${s%.*}
	else
		_RET=$(date +%s);
	fi
}

get_network_interface() {
        if [ -n "$MONITORED_NETWORK" ]; then
		# Manual override
                _RET="$MONITORED_NETWORK"
        elif [ -e /proc/net/route ]; then
		# Linux systems, read route and interface from procfs
		local Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
		while read Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT; do
			[ "$Mask" = "00000000" ] && break
		done < /proc/net/route
		_RET="$Iface"
	elif eval $BYOBU_TEST route >/dev/null 2>&1; then
		# Route command on path
		_RET=$(route get default|grep interface:|awk '{print $2}')
	elif [ -x "/sbin/route" ]; then
		# Mac OSX, shell out to the route command
		_RET=$(/sbin/route get default|grep interface:|awk '{print $2}')
	fi
}

get_distro() {
	local distro="${DISTRO}"
	if [ -n "$DISTRO" ]; then
		# user defined
		true
	elif [ -r "/etc/os-release" ]; then
		distro=$(. /etc/os-release && echo "$NAME")
		case "$distro" in
			Debian*)
				[ -r /etc/lsb-release ] && distro=$(. /etc/lsb-release && [ -n "$GOOGLE_ID" ] && echo "gLinux" || echo "Debian")
			;;
			*)
				# assume first field is what we want
				distro="${distro%% *}";
			;;
		esac
	elif [ -r "/etc/issue" ]; then
		# lsb_release is *really* slow;  try to use /etc/issue first
		local issue
		IFS="" read issue < /etc/issue
		case "$issue" in
			Ubuntu*)
				distro="Ubuntu";
			;;
			Debian*)
				distro="Debian"
			;;
			Red\ Hat\ Enterprise*)
				distro="RHEL"
			;;
			*)
				# assume first field is what we want
				distro="${issue%% *}";
			;;
		esac
	elif eval $BYOBU_TEST lsb_release >/dev/null 2>&1; then
		# If lsb_release is available, use it
		local r=$(lsb_release -s -d)
		case "$r" in
			Ubuntu*)
				# Use the -d if an Ubuntu LTS
				distro="Ubuntu"
			;;
			*)
				# But for other distros the description
				# is too long, so build from -i and -r
				distro=$(lsb_release -s -i)
			;;
		esac
	elif eval $BYOBU_TEST sw_vers >/dev/null 2>&1; then
		distro="$(sw_vers -productName)"
	elif eval $BYOBU_TEST uname >/dev/null 2>&1; then
		distro="$(uname -s)"
	else
		distro="Byobu"
	fi
	_RET="$distro"
}

# vi: syntax=sh ts=4 noexpandtab
PK�]�?�,ccinclude/cycle-statusnuȯ��#!/bin/sh
#
#    cycle-status: cycle the status bar through multiple configurations
#
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.


# Find line number of the enabled tmux_right
current=$(grep -n "^tmux_right=" "$BYOBU_CONFIG_DIR/status" | awk -F: '{print $1}' | tail -n1)

# Find next line number to enable
all=$(grep -n "tmux_right=" "$BYOBU_CONFIG_DIR/status" | awk -F: '{print $1}')
next=
for i in $all $all; do
	if [ "$next" = "flagged" ]; then
		next="$i"
		break
	elif [ "$i" = "$current" ]; then
		next="flagged"
	fi
done

# Disable all
sed -i -e "s/^tmux_right=/#tmux_right=/" "$BYOBU_CONFIG_DIR/status"

# Enable the next one
sed -i -e "${next}s/^#tmux_right=/tmux_right=/" "$BYOBU_CONFIG_DIR/status"
PK�]��⬥�include/select-session.pynuȯ��#! /usr/bin/python3
#
#    select-session.py
#    Copyright (C) 2010 Canonical Ltd.
#    Copyright (C) 2012-2014 Dustin Kirkland <kirkland@byobu.org>
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#             Ryan C. Thompson <rct@thompsonclan.org>
#
#    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 <http://www.gnu.org/licenses/>.


import os
import re
import sys
import subprocess
try:
	# For Python3, try and import input from builtins
	from builtins import input
except Exception:
	# But fall back to using the default input
	True


PKG = "byobu"
SHELL = os.getenv("SHELL", "/bin/bash")
HOME = os.getenv("HOME")
BYOBU_CONFIG_DIR = os.getenv("BYOBU_CONFIG_DIR", HOME + "/.byobu")
BYOBU_BACKEND = os.getenv("BYOBU_BACKEND", "tmux")
choice = -1
sessions = []
text = []
reuse_sessions = os.path.exists("%s/.reuse-session" % (BYOBU_CONFIG_DIR))

BYOBU_UPDATE_ENVVARS = ["DISPLAY", "DBUS_SESSION_BUS_ADDRESS", "SESSION_MANAGER", "GPG_AGENT_INFO", "XDG_SESSION_COOKIE", "XDG_SESSION_PATH", "GNOME_KEYRING_CONTROL", "GNOME_KEYRING_PID", "GPG_AGENT_INFO", "SSH_ASKPASS", "SSH_AUTH_SOCK", "SSH_AGENT_PID", "WINDOWID", "UPSTART_JOB", "UPSTART_EVENTS", "UPSTART_SESSION", "UPSTART_INSTANCE"]


def get_sessions():
	sessions = []
	i = 0
	output = False
	if BYOBU_BACKEND == "screen":
		try:
			output = subprocess.Popen(["screen", "-ls"], stdout=subprocess.PIPE).communicate()[0]
		except subprocess.CalledProcessError as cpe:
			# screen -ls seems to always return 1
			if cpe.returncode != 1:
				raise
			else:
				output = cpe.output
		if sys.stdout.encoding is None:
			output = output.decode("UTF-8")
		else:
			output = output.decode(sys.stdout.encoding)
		if output:
			for s in output.splitlines():
				s = re.sub(r'\s+', ' ', s)
				# Ignore hidden sessions (named sessions that start with a "." or a "_")
				if s and s != " " and (s.find(" ") == 0 and len(s) > 1 and s.count("..") == 0 and s.count("._") == 0):
					text.append("screen: %s" % s.strip())
					items = s.split(" ")
					sessions.append("screen____%s" % items[1])
					i += 1
	if BYOBU_BACKEND == "tmux":
		output = subprocess.Popen(["tmux", "list-sessions"], stdout=subprocess.PIPE).communicate()[0]
		if sys.stdout.encoding is None:
			output = output.decode("UTF-8")
		else:
			output = output.decode(sys.stdout.encoding)
		if output:
			for s in output.splitlines():
				# Ignore hidden sessions (named sessions that start with a "_")
				if s and not s.startswith("_") and s.find("-") == -1:
					text.append("tmux: %s" % s.strip())
					sessions.append("tmux____%s" % s.split(":")[0])
					i += 1
	return sessions


def cull_zombies(session_name):
	# When using tmux session groups, closing a client will leave
	# unattached "zombie" sessions that will never be reattached.
	# Search for and kill any unattached hidden sessions in the same group
	if BYOBU_BACKEND == "tmux":
		output = subprocess.Popen(["tmux", "list-sessions"], stdout=subprocess.PIPE).communicate()[0]
		if sys.stdout.encoding is None:
			output = output.decode("UTF-8")
		else:
			output = output.decode(sys.stdout.encoding)
		if not output:
			return

		# Find the master session to extract the group name. We use
		# the group number to be extra sure the right session is getting
		# killed. We don't want to accidentally kill the wrong one
		pattern = "^%s:.+\\((group [^\\)]+)\\).*$" % session_name
		master = re.search(pattern, output, re.MULTILINE)
		if not master:
			return

		# Kill all the matching hidden & unattached sessions
		pattern = "^_%s-\\d+:.+\\(%s\\)$" % (session_name, master.group(1))
		for s in re.findall(pattern, output, re.MULTILINE):
			subprocess.Popen(["tmux", "kill-session", "-t", s.split(":")[0]])


def update_environment(session):
	backend, session_name = session.split("____", 2)
	for var in BYOBU_UPDATE_ENVVARS:
		value = os.getenv(var)
		if value:
			if backend == "tmux":
				cmd = ["tmux", "setenv", "-t", session_name, var, value]
			else:
				cmd = ["screen", "-S", session_name, "-X", "setenv", var, value]
			subprocess.call(cmd, stdout=open(os.devnull, "w"))


def attach_session(session):
	update_environment(session)
	backend, session_name = session.split("____", 2)
	cull_zombies(session_name)
	# must use the binary, not the wrapper!
	if backend == "tmux":
		if reuse_sessions:
			os.execvp("tmux", ["tmux", "-u", "attach", "-t", session_name])
		else:
			os.execvp("tmux", ["tmux", "-u", "new-session", "-t", session_name, ";", "set-option", "destroy-unattached"])
	else:
		os.execvp("screen", ["screen", "-AOxRR", session_name])


sessions = get_sessions()

show_shell = os.path.exists("%s/.always-select" % (BYOBU_CONFIG_DIR))
if len(sessions) > 1 or show_shell:
	sessions.append("NEW")
	text.append("Create a new Byobu session (%s)" % BYOBU_BACKEND)
	sessions.append("SHELL")
	text.append("Run a shell without Byobu (%s)" % SHELL)

if len(sessions) > 1:
	sys.stdout.write("\nByobu sessions...\n\n")
	tries = 0
	while tries < 3:
		i = 1
		for s in text:
			sys.stdout.write("  %d. %s\n" % (i, s))
			i += 1
		try:
			try:
				user_input = input("\nChoose 1-%d [1]: " % (i - 1))
			except Exception:
				user_input = ""
			if not user_input or user_input == "":
				choice = 1
				break
			try:
				choice = int(user_input)
			except Exception:
				choice = int(eval(user_input))
			if choice >= 1 and choice < i:
				break
			else:
				tries += 1
				choice = -1
				sys.stderr.write("\nERROR: Invalid input\n")
		except KeyboardInterrupt:
			sys.stdout.write("\n")
			sys.exit(0)
		except Exception:
			if choice == "" or choice == -1:
				choice = 1
				break
			tries += 1
			choice = -1
			sys.stderr.write("\nERROR: Invalid input\n")
elif len(sessions) == 1:
	# Auto-select the only session
	choice = 1

if choice >= 1:
	if sessions[choice - 1] == "NEW":
		# Create a new session
		if BYOBU_BACKEND == "tmux":
			os.execvp("byobu", ["byobu", "new-session", SHELL])
		else:
			os.execvp("byobu", ["byobu", SHELL])
	elif sessions[choice - 1] == "SHELL":
		os.execvp(SHELL, [SHELL])
	else:
		# Attach to the chosen session; must use the binary, not the wrapper!
		attach_session(sessions[choice - 1])

# No valid selection, default to the youngest session, create if necessary
if BYOBU_BACKEND == "tmux":
	os.execvp("tmux", ["tmux"])
else:
	os.execvp("screen", ["screen", "-AOxRR"])
PK�]����d!d!2include/__pycache__/select-session.cpython-312.pycnu�[����

h��e���:�ddlZddlZddlZddlZ	ddlmZdZejdd�Z	ejd�Z
ejde
dz�Zejd	d
�ZdZ
gZgZej j#dez�Zgd
�Zd�Zd�Zd�Zd�Ze�Zej j#dez�Zee�dkDserJej5d�ej5dez�ej5d�ej5de	z�ee�dkDr�ej6j9d�dZedkr�dZeD]'Zej6j9deefz�edz
Z�)		ededz
z�Z e re dk(rdZ
nK	e!e �Z
e
dk\re
ekrn7edz
ZdZ
ejFj9d�	edkr��n
ee�dk(rdZ
e
dk\rkee
dz
dk(r2ed
k(rejLddde	g�nDejLdde	g�n.ee
dz
dk(rejLe	e	g�neee
dz
�ed
k(rejLd
d
g�yejLddd g�y#e$rY��hwxYw#e$rdZ Y��wxYw#e$re!e"e ��Z
Y��wxYw#e$$r1ej6j9d�ejJd�Y��e$r5e
dk(se
dk(rdZ
Y��edz
ZdZ
ejFj9d�Y��UwxYw)!�N)�input�byobu�SHELLz	/bin/bash�HOME�BYOBU_CONFIG_DIRz/.byobu�
BYOBU_BACKEND�tmux���z%s/.reuse-session)�DISPLAY�DBUS_SESSION_BUS_ADDRESS�SESSION_MANAGER�GPG_AGENT_INFO�XDG_SESSION_COOKIE�XDG_SESSION_PATH�GNOME_KEYRING_CONTROL�GNOME_KEYRING_PIDr�SSH_ASKPASS�
SSH_AUTH_SOCK�
SSH_AGENT_PID�WINDOWID�UPSTART_JOB�UPSTART_EVENTS�UPSTART_SESSION�UPSTART_INSTANCEc��g}d}d}tdk(�rf	tjddgtj��j	�d}tjj�|jd�}n)|jtjj�}|r�|j�D]�}tjdd	|�}|s�|d	k7s�#|jd	�dk(s�8t!|�dkDs�G|j#d
�dk(s�\|j#d�dk(s�qt$j'd|j)�z�|j+d	�}|j'd
|dz�|dz
}��tdk(�rtjddgtj��j	�d}tjj�|jd�}n)|jtjj�}|r�|j�D]}}|s�|j-d�r�|jd�dk(s�-t$j'd|j)�z�|j'd|j+d�dz�|dz
}�|S#tj
$r'}|jdk7r�|j}Yd}~���d}~wwxYw)NrF�screenz-ls��stdout��UTF-8z\s+� z..z._z
screen: %szscreen____%sr	�
list-sessions�_�-r
ztmux: %sz
tmux____%s�:)r�
subprocess�Popen�PIPE�communicate�CalledProcessError�
returncode�output�sysr�encoding�decode�
splitlines�re�sub�find�len�count�text�append�strip�split�
startswith)�sessions�ir,�cpe�s�itemss      �(/usr/lib/byobu/include/select-session.py�get_sessionsrA0sM������
���X������h��.�z���G�S�S�U�VW�X�6�	�Z�Z��� ��M�M�'�"�6��M�M�#�*�*�-�-�.�6�������q�
���v�s�A��A��Q�#�X�1�6�6�#�;�!�+��A���
�q�w�w�t�}�PQ�?Q�VW�V]�V]�^b�Vc�gh�Vh�	�[�[�����	�)�*�
�W�W�S�\�U�
�_�_�^�e�A�h�.�/��!�V�Q���V�����V�_�5�j�o�o�N�Z�Z�\�]^�_�&��Z�Z��� ��M�M�'�"�6��M�M�#�*�*�-�-�.�6�������q�����c�"�q�v�v�c�{�b�'8�	�[�[��a�g�g�i�'�(�
�_�_�\�A�G�G�C�L��O�3�4��!�V�Q��	���A
�	&�	&��	�n�n���	�
�Z�Z�F���s�8J"�"K�5K�Kc	�n�tdk(�r+tjddgtj��j	�d}t
jj�|jd�}n)|jt
jj�}|syd|z}tj||tj�}|syd|�d|jd	��d
�}tj||tj�D]-}tjddd|jd
�dg��/yy)Nr	r"rrr z^%s:.+\((group [^\)]+)\).*$z^_z	-\d+:.+\(rz\)$zkill-session�-tr%)rr&r'r(r)r-rr.r/r1�search�	MULTILINE�group�findallr9)�session_namer,�pattern�masterr>s     r@�cull_zombiesrKZs����V�����V�_�5�j�o�o�N�Z�Z�\�]^�_�&��Z�Z��� ��M�M�'�"�6��M�M�#�*�*�-�-�.�6�	�	�

-�|�;�'�
�9�9�W�f�b�l�l�3�&�	�	�
�(4�V�\�\�!�_�E�'�
�:�:�g�v�r�|�|�4�E�a�
���V�^�T�1�7�7�3�<��?�C�D�E�'�c��|jdd�\}}tD]`}tj|�}|s�|dk(r	ddd|||g}n	dd|dd||g}t	j
|t
tjd	��
��by)N�____�r	�setenvrCrz-Sz-X�wr)r9�BYOBU_UPDATE_ENVVARS�os�getenvr&�call�open�devnull)�session�backendrH�var�value�cmds      r@�update_environmentr]us}�� ���v�q�1���,� �6�S�
�)�)�C�.�%�
�
����8�T�<��e�
<�C��T�<��x��e�
D�C�
�?�?�3�t�B�J�J��4�5�6rLc��t|�|jdd�\}}t|�|dk(rAtrt	j
ddddd|g�yt	j
ddddd|dd	d
g�yt	j
ddd|g�y)
NrNrOr	z-u�attachrC�new-session�;z
set-optionzdestroy-unattachedr�-AOxRR)r]r9rK�reuse_sessionsrS�execvp)rXrYrHs   r@�attach_sessionre�s����G�� ���v�q�1���,�
�l���v����9�9�V�f�d�H�d�L�A�B��9�9�V�f�d�M�4��s�L�Zn�o�p��)�)�H�x��<�8�9rLz%s/.always-selectr�NEWzCreate a new Byobu session (%s)zRun a shell without Byobu (%s)z
Byobu sessions...

�z	  %d. %s
z
Choose 1-%d [1]: �z
ERROR: Invalid input
�
r`rrb)'rSr1r-r&�builtinsr�	Exception�PKGrTrrrr�choicer;r6�path�existsrcrRrArKr]re�
show_shellr4r7r�write�triesr<r>�
user_input�int�eval�stderr�KeyboardInterrupt�exitrd�rLr@�<module>rzs��.
�	�
��������	�	�'�;�'���r�y�y�����2�9�9�/��	�1A�B����	�	�/�6�2�
�	��
��	������� 3�7G� H�I��S��'�TE�6	6�:��>��
�W�W�^�^�/�3C�D�
E�
��x�=�1��
�	��������
.��
>�?�	��������
-��
5�6��x�=�1�������+�,�	
���q�y��!��
�a��:�:���L�A�q�6�)�*���6�1�
�0���,��A��6�7�J��
�b�(�
�F�	�#�
��_�F�
��k�f�q�j�	�	�Q�J�E�
�F��J�J���/�0�-
�q�y�B	��]�a��
��	�Q�;��V�a�Z��E�!��f���2�9�9�W�w�
�u�5�6��2�9�9�W�w��&�'��v��z��g�%��"�)�)�E�E�7����&�1�*�%�&��F��
����6�F�8��
����8�h��)�*��g�����J���J����#�
��j�!�
"�F�#��
���:�:���D���3�8�8�A�;�	�0���l�f��l�
�F�	��A�:�5��6��:�:���.�/�
0�sw�I8�5J�	J,�J�
J,�!"J,�8J�J�J�J,�J�J,�J)�%J,�(J)�)J,�,2L�!L�4"L�LPK�]��~�E�E*include/__pycache__/config.cpython-312.pycnu�[����

h��e�)���ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	d�Z
	ddlZddl�dZ
ejd�Zejd�Zejd	ed
z�Zejdedz�Zejd
d�Zejdd�Zejdd�Zedze
zZedze
zZej0j3e�sedzezZej0j3e�sedze
zZej0j3e�sedzezZdZdZdezZdZee�ej>e<eej>ee�<ej@e
edz�ejBe
�ejZ"d�Z#d�Z$d�Z%d�Z&de"d �d!fe"d"�d#efffd$�Z'd%�Z(d&�Z)d'�Z*d(�Z+d)�Z,d*�Z-d+�Z.d,�Z/d-�Z0d.�Z1d/�Z2d0�Z3e4d1k(re3�yy#e$re
d�Y���wxYw)2�)�print_functionNc�J�td|z�tjd�y)Nz	ERROR: %s�)�print�sys�exit)�msgs � /usr/lib/byobu/include/config.py�errorr%s���{�S������!��)�*z(Could not import the python snack module�byobu�HOME�USER�BYOBU_CONFIG_DIRz/.byobu�
BYOBU_RUN_DIRz
/.cache/byobu�
BYOBU_BACKEND�tmux�	SOCKETDIRz/var/run/screen�BYOBU_PREFIXz/usrz/share/z/share/doc/�/z/share/doc/packages/�Az�If you are using the default set of keybindings, press
<F5> or <ctrl-a-R> to activate these changes.

Otherwise, exit this session and start a new one.z%s/reload-required�z/poc��	ddl}ddl}ddl}ddl}|j	d|j||jd��}|S#t$rYywxYw)Nr�hh�1234)�fcntl�termios�struct�os�unpack�ioctl�
TIOCGWINSZ�	Exception)�fdrrrr �crs      r
�ioctl_GWINSZr'LsQ�������
�}�}�T�5�;�;�r�7�+=�+=�v�F�G�"�	���	��	
��s�=A�	A
�A
c	�>�	tjjt�stjtd�ttd�}|j�tdk(r'tjtdddddtzg�yy#t$rYywxYw)	Ni��w�screenz-X�at�0�sourcez
%s/profile)r �path�existsr�makedirs�open�RELOAD_FLAG�closer�
subprocess�callr$)�fs r
�reload_requiredr7Ys|��
�	�����(�	)��;�;���%�
�;���!��'�'�)��h��
�?�?�M�4��s�H�l�M]�>]�^�_�������s�BB�	B�Bc��td�xstd�xstd�}|sW	tjtj�tj�}t|�}tj
|�|s	tdtdf}t|ddz
�t|ddz
�fS#t$rY�BwxYw#t$rd}Y�>wxYw)Nrr��LINES�COLUMNS)��P�)	r'r r1�ctermid�O_RDONLYr3r$�env�int)r&r%s  r
�
terminal_sizerCgs����1�o�;��a��;�L��O��
��
����
�
��b�k�k�*�2��R��2��8�8�B�<�	��	�W��s�9�~�&�2�	�B�q�E�A�I���B�q�E�A�I��&�&��
�����
���2��s$�AB6�C�6	C�C�C�Cc�*�|rtd�}ntd�}tddd��}|jtd�d�|jtd�d	�|jtd
�d�|j|d�t|d
dtffd��}t|td�dd	�}|j
|ddd��|j
|ddd��|j|j��dk(ry|j�S)Nz.Byobu currently launches at login (toggle off)z4Byobu currently does not launch at login (toggle on)��<r)�height�width�
returnExitzHelp -- Quick Start Guide�Toggle status notificationsr9�Change escape sequence���Exitr��compactz Byobu Configuration Menur)rMr9rMr9��padding�rrrr)
�_�Listbox�append�	ButtonBar�ESC�GridForm�add�
buttonPressed�runOnce�current)�snackScreen�size�isInstalled�installtext�li�bb�gs       r
�menure}s�����B�C�+��H�I�+�
�Q�b�Q�/�����1�
(�)�1�-����1�
*�+�Q�/����1�
%�&��*����;�����v�v�s�3�5�q�A��
�k�1�8�9�1�a�@�����r�1�a���&����r�1�a���&����Q�Y�Y�[�!�V�+�	
�	����r�Okay�okay�Cancel�cancelc���t||||��}t||d��}t||dd�}	|	j|ddd��|	j|ddd��|j	|	j��S)	N��scrollrrOr9r)rrrrrQrS)�TextboxrWrYrZr[r\)
r^rHrG�title�textrl�buttons�trcrds
          r
�
messageboxrr�so���U�F�D��0����W�a�0��
�k�5�!�Q�'�����q�!�Q���%����r�1�a���&�
�������%�%rc���ttdztzdz�}|j�}|j	�|jdt
�d�}tdd|dd��}t|td�d	tffd�
�}t|td�dd
�}|j|dd�|j|ddd��|j|j��}y)Nz/help.z.txtz<esckey>r�C�)rl�wrap�MenurerOz
Byobu Helpr9rMrrSrQ�d)r1�DOCr�readr3�replace�	getesckeyrmrWrTrXrYrZr[r\)r^r_r6rorqrcrd�buttons        r
�helpr~�s���	�#��.�=�
(�6�
1�2��	������������Z���a�0���R��T�!�!�,����q��y�&�#�6�8�!�D��
�k�1�\�?�A�q�1�����q�!�Q�����r�1�a���&�
�
�
�1�9�9�;�
'��rc	��i}i}i}tdztdzfD]�}tjj	|�s�#	tt
|�j�||�tdk(r|d�d|d��}n|d�d|d	�d|d
�d|d��}|j�D]0}|jd�r|jdd
�}d||<�,d||<�2��g}t|j��}t!|�D]#}t#||�|g}|j%|��%|S#t$rtd|z�Y��wxYw)N�/status/status�/statuszInvalid configuration [%s]r�	tmux_left� �
tmux_right�screen_upper_left�screen_upper_right�screen_lower_left�screen_lower_right�#�r,�1)�SHARErr r.r/�execr1rzr$rr�split�
startswithr{�list�keys�sortedrBrV)	�status�glo�locr6�items�irbr��windows	         r
�
readstatusr��s^��
��	��	���#�#�%5�	�%A�
B��Q��W�W�^�^�A��,���a������c�"��v���;�'��\�):�;�E� �!4�5�s�;O�7P�RU�Vi�Rj�lo�qE�mF�
G�E��K�K�M��q��|�|�C��	
���3��	�Q��V�A�Y��V�A�Y��� 	���V�[�[�]���
��,��Q���q�	�N�A��&��)�)�F���	���#�,�	�
&��
*�+�,�s�$D$�$D>�=D>c��d}i}i}tttdz�j�||�||j	�D]>}|jd�r|j
dd�}||dk(r	|d|zz
}�7|d|zz
}�@|S)Nr�r�r�rr�z #)r�r1r�rzr�r�r{)�sr��newr�r�r�s      r
�genstatusstringr��s���	��	��	���d�5�#�#�$�)�)�+�S�#�6�

�a�&�,�,�.��Q��\�\�#���y�y��b��1��A�Y�!�^��#��'�>�3��$��(�?�3�
�	�rc��i}tdz}|D]
}|d||d<�dD]�}|jt�s�	t|d�}|j
�}|j�	t|d�}|D]K}|jd	|z�r$t||�}|j|�d
|�d���;|j|��M|j��y#t$rtt
dzd�}Y��wxYw#t$rt|d�}Y��wxYw)Nr�rr)r�r�r�r�r�r��rr�r)za+z%s=z="z"
)
rr�rr1r$r��	readlinesr3r��write)	r�r�r.r��keyr6�lines�l�vals	         r
�writestatusr��s��
���9�$��
��Q��1��&��1��,��}��S��^�^�M�"�,��T�3��A�
�;�;�=�5��7�7�9���T�3��A�
��q��|�|�E�C�K� ��3��'�S��W�W�c�3�
'�(��W�W�Q�Z���7�7�%���,��U�%�
%�s�+�A�,�����T�4��A��s#�C�'C4�C1�0C1�4D�Dc�r�t�}td�}tdd��}d}|D])}|ddk7r|j|d||d��|dz}�+t	|td�d	ftd
�dtffd��}t|td
�dd�}|j|ddddd��|j|dd�|j|ddd��|j|j��dk7rBd}|D]&}|ddk7r|j|�d|d<|dz}�(t|�t�y)Nr��rrkr���)�selected�Apply�applyrhrirOrJr9rM)rMrrr)�
anchorLeft�	anchorToprR)rMrrrrQrx)r��Label�CheckboxTreerVrWrTrXrYrZr[r\�
getEntryValuer�r7)	r^r_�itemlist�rlr��count�itemrcrds	         r
�togglestatusr��sF���L���B�i���"�Q���	
��
��T�	�!�W��]��8�8�D��G�U�T�!�W�8�-�
�!�)�%����q��z�7�3�a��k�8�S�5Q�R�\]�^��
�k�1�:�;�Q��B�����r�1�a�A��L��A����q�!�Q�����r�1�a���&����Q�Y�Y�[�!�X�-�
�%���d�
�1�g��m��o�o�e�$�Q�'�D��G��1�9�5���h����rc
��d}|rItjdg�dk(rtd�}t|ddtd�|td�f�	�}y
tjdg�dk(rtd�}t|ddd|td�f�	�}y
)Nr�zbyobu-launcher-uninstallrz/Byobu will not be launched next time you login.rFr9�Messagerw)rp�ezbyobu-launcher-installz9Byobu will be launched automatically next time you login.rx)r4r5rTrr)r^r_r`�outr}s     r
�installr�s���	����_�_�0�1�2�a�7�	
�<�	=�3��k�2�q�!�I�,��q��y�m�U�&�	��_�_�.�/�0�A�5�	
�F�	G�3��k�2�q�)�S�A�f�I�=�R�&�	rc��t|d�}	|j|�|j�y#t$r|j�YywxYw)N�a)r1r��IOErrorr3)�pr�r6s   r
�appendtofiler�sH��	�!�S�\��	��'�'�!�*�������		�	��'�'�)��	�s�0�A�Ac��d}tdk(rStdz}tjj	|�r%t|�D]}|j
d�s�|}�nYtStdz}tjj	|�r%t|�D]}|j
d�s�|}�ntS|dk(rtS||jd�dz}|d	k(rd
}|S)Nr�rz/keybindings.tmuxzset -g prefix z/keybindingszescape �^r�`r�)	rrr r.r/r1r��DEF_ESC�find)�liner.r��escs    r
r|r|s���
���V��	�/�	/�$��W�W�^�^�D����J��q��|�|�$�%�
�T���>�	�N�	*�$��W�W�^�^�D����J��q��|�|�I��
�T���>��B�J�	�.��D�I�I�c�N�Q�����3�J��#��rc��|j�rEttjd�}t	j
dd|g|��|j
�yy)Nr)zbyobu-ctrl-ar*)�stdout)�isalphar1r �devnullr4r5r3)r��nullfs  r
�	setesckeyr�9s>���K�K�M�
�r�z�z�3�
�%��/�/�>�8�S�1�%�@��+�+�-�	rc�x�tdt�d��}ttd��}t	|td�dftd�dt
ffd�	�}t
|td
�dd�}|j|dddd
��|j|ddd��|j|dd�|jd�d}|r�|j�}|dk(r�|j�}t|�dkDr|j|d�|dk(s|dk(r|jt�	t|j��}	|jt�nd}|r��|j!�|j#�}
|
dk7r)t%|j��t'�|
dk(ryy#t$rd}	Y�`wxYw)Nr9r)rorIzEscape key: ctrl-r�r�rhrirOrKrMr)rrrr)r�rR)r�rx�TIMERr�\�foor)�Entryr|r�rTrWrXrYrZ�setTimer�run�value�len�setr�rBr$�	popWindowr[r�r7)r^r_r��esclrcrd�loop�whichr��dummyr}s           r
�chgescr�As����Q�Y�[�Q�/��
�a�#�$�%����q��z�7�3�a��k�8�S�5Q�R�\]�^��
�k�1�5�6��1�=�����t�Q��a���6����s�A�q�Q������r�1�a�����C��	���
�%�%�'�%�
�g��	����3�	�#�h��l��G�G�C��F�O�	�S�j�C�4�K��G�G�G�����	�	���E��G�G�G��
�4�#�$
����
�
�
�5�
!��
�h���C�I�I�K�����v��
������E��s�'.F+�+F9�8F9c��tjjtdz�ry	t	dt
z�D]}d|vs�y	tjjdtz�ryy#t$rYywxYw)Nz/disable-autolaunchrz%s/.profilezbyobu-launchrz/etc/profile.d/Z97-%s.sh)r r.r/rr1rr$�PKG)r�s r
�
autolaunchr�gsw���G�G�N�N�#�&;�;�<�	
���=�4�'�(�
�d�����
�
�G�G�N�N�-��3�4�	
�	��		��	
��s�A/�A/�A/�/	A;�:A;c���t�}t�}|jddtd��|j	td��t�}d}|dkDret
|||�}|dk(r
t||�}n@|dk(r
t||�}n.|dk(r
t||�}n|dk(rt|||�}t�}|dkDr�e|j�tjd�y	)
z$This is the main loop of our utilityrrzByobu Configuration Menuz6<Tab> between elements | <Enter> selects | <Esc> exitsrxr9rLrMN)rC�SnackScreen�drawRootTextrT�pushHelpLiner�rer~r�r�r��finishrr)r_r^r`�tags    r
�mainr�us�������}�����!�Q��"<� =�>����!�T�U�V��|��
��
�Q�w��[�$��,�#��A�X�	
�k�4�	 �3�
�a�x�	�k�4�	(�3�
�a�x�	��T�	"�3�
�a�x�	��d�K�	0�3���;��Q�w�
�������!�r�__main__)5�
__future__rrr �os.path�time�stringr4�gettext�globr�snackr$r��getenvrrrrr�BYOBU_SOCKETDIRrr�ryr.r/r��RELOADr2rX�ord�hotkeys�bindtextdomain�
textdomainrTr'r7rCrerrr~r�r�r�r�r�r�r|r�r�r�r��__name__�rr
�<module>r�sX��4&�
�	���
����
�
3�
��
���r�y�y�����r�y�y�����2�9�9�/��	�1A�B����	�	�/�4�/�+A�B�
���	�	�/�6�2�
��"�)�)�K�):�;���r�y�y���0���y� �3�&���]�"�S�(��	�w�w�~�~�e��	�C�	�%�	'��	�w�w�~�~�c���,�,�s�2��	�w�w�~�~�c���#���#��

��
f��"�m�4��	����X��
�
�c����
�
�c�#�h������s�E�E�M�*�����3���O�O��
��'�,�(@A�A�f�I�W]�K^�ab�ck�al�nv�x{�`|�J}�&���8��4�2
���4�#�L
�
�.�z������
�3��1�2�3�s�	G8�8
H	�H	PK�]nR�L��reboot_requirednuȯ��#!/bin/sh -e
#
#    reboot_required: determine if a reboot is required
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

REBOOT_FLAG="/var/run/reboot-required"
RELOAD_FLAG="$BYOBU_RUN_DIR/reload-required"
POWERNAP_FLAG="/var/run/powernap/powersave"
UNATTENDED_UPGRADE_FLAG="/var/run/unattended-upgrades.pid"

__reboot_required_detail() {
		[ -e "$REBOOT_FLAG" ] && ls -alF "$REBOOT_FLAG" 2>&1
		[ -e "$RELOAD_FLAG" ] && ls -alF "$RELOAD_FLAG" 2>&1
		[ -e "$POWERNAP_FLAG" ] && ls -alF "$POWERNAP_FLAG" 2>&1
		[ -e "$POWERNAP_FLAG" ] && cat "$POWERNAP_FLAG" 2>&1
}

__reboot_required() {
	local status="$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/reboot_required"
	local livepatched=0
	if [ -e "$UNATTENDED_UPGRADE_FLAG" ]; then
		color b R W; printf "$ICON_UPGRADE "; color --;
	fi
	while read line; do
		set -- ${line}
		case "$line" in
			kpatch_livepatch_*)
				color k G; printf "$ICON_LIVEPATCHED"; color -;
				livepatched=1
				break
			;;
		esac
	done < /proc/modules
	if [ -e "$REBOOT_FLAG" ]; then
		if [ "$livepatched" = "1" ]; then
			color k G; printf "$ICON_REBOOT"; color --;
		else
			color b k R; printf "$ICON_REBOOT"; color --;
		fi
	fi
	if [ -e "$RELOAD_FLAG" ]; then
		color b W; printf "<"; color -; color b b W; printf "F5"; color -; color b W; printf ">"; color -; printf " "
	elif [ -s "$status" ]; then
		rm -f "$status"
	fi
	if [ -e "$POWERNAP_FLAG" ]; then
		color b W; printf ".zZ"; color --
	elif [ -s "$status" ]; then
		rm -f "$status"
	fi
}

# vi: syntax=sh ts=4 noexpandtab
PK�]�&X�apportnuȯ��#!/bin/sh -e
#
#    apport: note if there are crash dumps available for apporting
#
#    Copyright (C) 2009 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__apport_detail() {
	for i in /var/crash/*.crash; do
		if [ -f "$i" ]; then
			printf "\nTo file bugs on the existing crash reports, run:\n"
			which apport-cli >/dev/null || printf "  sudo apt-get install apport\n"
			for i in /var/crash/*.crash; do
				printf "  apport-cli $i\n"
			done
			printf "\nTo clear the pending reports:\n"
			printf "  rm -f /var/crash/*.crash\n\n"
			return
		fi
	done
	printf "No pending crash reports\n"
}

__apport() {
	# Print {!} if a /var/crash/*.crash file exists
	for i in /var/crash/*.crash; do
		if [ -f "$i" ]; then
			color y k; printf "{!}"; color --
			return
		fi
	done
	rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/apport"*
}

# vi: syntax=sh ts=4 noexpandtab
PK�]��2$$distronuȯ��#!/bin/sh -e
#
#    distro: grab the distro/os
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__distro_detail() {
	lsb_release -a 2>/dev/null
}

__distro() {
	local DISTRO="${DISTRO}"
	if [ -n "$DISTRO" ]; then
		# user defined
		true
	else
		DISTRO="$BYOBU_DISTRO"
	fi
	color bold2; printf "%s" "$DISTRO"; color --
}

# vi: syntax=sh ts=4 noexpandtab
PK�]Y�|9��batterynuȯ��#!/bin/sh -e
#
#    battery: print the state of the battery
#
#    Copyright (C) 2009 Raphaël Pinson.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Raphaël Pinson <raphink@ubuntu.com>
#             Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__battery_detail() {
	local bat
	for bat in /proc/acpi/battery/*; do
		cat "$bat/info"
		cat "$bat/state"
	done
	# FIXME: do the same thing with the /sys interface
}

__battery() {
	local bat line present sign state percent full rem color bcolor
	# Linux support
	present=""; full="0"; rem="0"; state=""
	for bat in $BATTERY /sys/class/power_supply/* /proc/acpi/battery/*; do
		case "$bat" in
			/sys/*)
				if [ -r "$bat/uevent" ]; then
					. "$bat/uevent"
					case "$POWER_SUPPLY_NAME" in AC|ac|Ac|aC) continue ;; esac
					present="$POWER_SUPPLY_PRESENT"
					# Some use "CHARGE", others use "ENERGY", still others "CAPACITY"
					[ -n "$POWER_SUPPLY_CHARGE_FULL" ] && full=$((POWER_SUPPLY_CHARGE_FULL+full))
					[ -n "$POWER_SUPPLY_ENERGY_FULL" ] && full=$((POWER_SUPPLY_ENERGY_FULL+full))
					[ -n "$POWER_SUPPLY_CHARGE_NOW" ] && rem=$((POWER_SUPPLY_CHARGE_NOW+rem))
					[ -n "$POWER_SUPPLY_ENERGY_NOW" ] && rem=$((POWER_SUPPLY_ENERGY_NOW+rem))
					if [ -n "$POWER_SUPPLY_CAPACITY" ] && [ ! -n "$POWER_SUPPLY_ENERGY_NOW" ] && [ ! -n "$POWER_SUPPLY_CHARGE_NOW" ]; then
						rem="$POWER_SUPPLY_CAPACITY" && full="100"
					fi
					[ "$POWER_SUPPLY_STATUS" != "Unknown" ] && state="$POWER_SUPPLY_STATUS"
				fi
			;;
			/proc/*)
				[ -f "$bat/info" ] || continue
				while read line; do
					set -- ${line}
					case "$line" in
						present:*)
							# make sure that this battery is present
							[ "$2" = "no" ] && continue 2
							present="$2";;
					   	last\ full\ capacity:*) full="$4";;
					esac
					[ -n "$present" -a -n "$full" ] && break
				done < "${bat}/info"
				while read line; do
					set -- ${line}
					case "$line" in
						remaining\ capacity:*) rem="$3";;
						charging\ state:*) state="$3";;
					esac
					[ -n "$rem" -a -n "$state" ] && break
				done < "$bat/state"
				[ -n "$full" ] && [ -n "$rem" ] && [ -n "$state" ] && break
			;;
		esac
	done
	# Mac OS X support
	if eval $BYOBU_TEST /usr/sbin/ioreg >/dev/null 2>&1; then
		# MacOS support
		local key
		for key in CurrentCapacity MaxCapacity ExternalChargeCapable FullyCharged; do
			line=$(/usr/sbin/ioreg -n AppleSmartBattery -w0 | grep -w $key | sed -e 's/|//g' | awk '{ print $3 }')
			case "$key" in
				CurrentCapacity) rem="$line";;
				MaxCapacity) full="$line";;
				ExternalChargeCapable)
					if [ "${line}" = "Yes" ]; then
						state="charging"
					elif [ "${line}" = "No" ]; then
						state="discharging"
					fi
				;;
				FullyCharged)
					if [ "${line}" = "Yes" ]; then
						state="charged"
					fi
				;;
			esac
		done
	fi
	# Android Termux support
	if eval $BYOBU_TEST termux-battery-status -h >/dev/null 2>&1; then
		BATTERY_STATUS=$(termux-battery-status)
		full=100
		rem=$(printf "%s" "$BATTERY_STATUS" | awk '/percentage/ { gsub(/[,]/,""); print $2}')
		state=$(printf "%s" "$BATTERY_STATUS" | awk '/status/ { gsub(/[",]/,""); print $2}')
	fi
	if [ $rem -ge 0 ] && [ $full -gt 0 ]; then
		percent=$(((100*$rem)/$full))
		if [ "$percent" -lt 33 ]; then
			color="R w"
			bcolor="b R w"
		elif [ "$percent" -lt 67 ]; then
			color="Y k"
			bcolor="b Y k"
		else
			color="G k"
			bcolor="b G k"
		fi
		percent="${percent}${PCT}"
		# Convert state to lower case
		state=$(printf "%s" "$state" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')
		case $state in
			charging) sign="+" ;;
			discharging) sign="-" ;;
			charged|unknown|full) sign="=" ;;
			*) sign="$state" ;;
		esac
		if [ -z "$percent" ]; then
			rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/battery"*
			return
		fi
		color $bcolor; printf "%s" "$percent"; color -; color $color; printf "%s" "$sign"; color --
	fi
}

# vi: syntax=sh ts=4 noexpandtab
PK�]�N=
��uptimenuȯ��#!/bin/sh -e
#
#    uptime: condensed uptime of the machine
#
#    Copyright (C) 2009 Raphaël Pinson.
#    Copyright (C) 2009 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Raphaël Pinson <raphink@ubuntu.com>
#             Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__uptime_detail() {
	uptime
}

__uptime() {
	local u= idle= str=
	if [ -r /proc/uptime ]; then
		read u idle < /proc/uptime
		u=${u%.*}
	elif [ -x /usr/sbin/sysctl ]; then
		# MacOS support
		u=$(/usr/sbin/sysctl -n kern.boottime | cut -f4 -d' ' | cut -d',' -f1)
		u=$(($(date +%s) - $u))
	fi
	if [ "$u" ]; then
		if [ "$u" -gt 86400 ]; then
			str="$(($u / 86400))d$((($u % 86400) / 3600))h"
		elif [ "$u" -gt 3600 ]; then
			str="$(($u / 3600))h$((($u % 3600) / 60))m"
		elif [ "$u" -gt 60 ]; then
			str="$(($u / 60))m"
		else
			str="${u}s"
		fi
	else
		# Last ditch hack
		str=$(uptime | sed -e "s/.* up *//" -e "s/ *days, */d/" -e "s/:/h/" -e "s/,.*/m/")
	fi
	[ -n "$str" ] || return
	color w b; printf "%s" "${str}"; color --
}

# vi: syntax=sh ts=4 noexpandtab
PK�]%@<7disknuȯ��#!/bin/sh -e
#
#    disk: print the current disk space and usage
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__disk_detail() {
	df -h
}

__disk() {
	local out="" MP="" size="" pct="" unit=""
	# Default to /, but let users override
	[ -z "$MONITORED_DISK" ] && MP="/" || MP="$MONITORED_DISK"
	case $MP in
		/dev/*) MP=$(awk '$1 == m { print $2; exit(0); }' "m=$MP" /proc/mounts);;
	esac
	# this could be done faster with 'stat --file-system --format'
	# but then we'd have to do blocks -> human units ourselves
	out=$(df -h "$MP" 2>/dev/null | awk 'END { printf("%s %s", $2, $5); }')
	set -- ${out}
	size=${1}; pct=${2};
	unit=${size#${size%?}} # get the unit (last char)
	size=${size%?}; # take the unit off
	pct=${pct%?}; # take off the '%'
	case "$unit" in
		k*|K*) unit="$ICON_KB" ;;
		m*|M*) unit="$ICON_MB" ;;
		g*|G*) unit="$ICON_GB" ;;
		t*|T*) unit="$ICON_TB" ;;
	esac
	[ -n "$size" ] || return
	color b m W; printf "%s" "$size"; color -; color m W; printf "%s" "$unit"; color -;
	color b m W; printf "%s" "$pct";  color -; color m W; printf "%s" "$PCT"; color --;
}

# vi: syntax=sh ts=4 noexpandtab
PK�]�� ccload_averagenuȯ��#!/bin/sh
#
#    load_average: grab the current load average
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__load_average_detail() {
	cat /proc/loadavg
}

__load_average() {
	if [ -r "/proc/loadavg" ]; then
		read one five fifteen other < /proc/loadavg
	else
		one=$(uptime | sed -e "s/.*://" | awk '{print $1}')
	fi
	[ -n "$one" ] || return
	color Y k; printf "$one"; color --
}

# vi: syntax=sh ts=4 noexpandtab
PK�]Š�$$cpu_tempnuȯ��#!/bin/sh -e
#
#    cpu_temp: cpu temperature
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__cpu_temp_detail() {
	local i
	for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal /proc/acpi/thermal_zone/*/temperature /sys/class/thermal/thermal_zone*/temp; do
		[ -r "$i" ] || continue
		printf "%s\n" "$i:"
		cat "$i"/*
	done
}

__cpu_temp() {
	local i t unit
	for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal /proc/acpi/thermal_zone/*/temperature /sys/class/thermal/thermal_zone*/temp; do
		case "$i" in
			*temp*_input|*thermal_zone*/temp)
				[ -s "$i" ] && read t < "$i" && t=$(($t/1000))
			;;
			*)
				[ -s "$i" ] && t=$($BYOBU_SED -e "s/^[^0-9]\+//" -e "s/\s.*$//" "$i")
			;;
		esac
		if [ -n "$t" ] && [ "$t" -gt 0 ]; then
			unit="$ICON_C"
			if [ "$TEMP" = "F" ]; then
				t=$(($t*9/5 + 32))
				unit="$ICON_F"
			fi
			color b k Y; printf "%s" "$t"; color -; color k Y; printf "%s" "$unit"; color --
			break
		fi
	done
}

# vi: syntax=sh ts=4 noexpandtab
PK�]��yssmenunuȯ��#!/bin/sh -e
#
#    menu: display the menu text
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland <kirkland@byobu.org>
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__menu_detail() {
	return
}

__menu() {
	local bindings esc key text
	[ -r "$BYOBU_CONFIG_DIR/keybindings" ] && bindings="$BYOBU_CONFIG_DIR/keybindings" || bindings="$BYOBU_CONFIG_DIR/.screenrc"
	if grep -qs "^source.*screen-escape-keys$" $bindings 2>/dev/null || grep -qs "^source.*f-keys.screen.disable$" $bindings 2>/dev/null || [ "$1" = "--disable-f-keys" ]; then
		# Get the second to last byte from the "escape" option
		esc=`grep "^escape" $bindings | tail -c 3 | head -c 1`
		[ -n "$esc" ] && key="^$esc-@" || key="^a-@"
	elif grep -qs "^source.*none$" $bindings 2>/dev/null; then
		key="byobu-config"
	else
		key="F9"
	fi
	text=$(gettext "Menu" 2>/dev/null) || text="Menu"
	color k w; printf "%s:<" "$text"; color -; color b k w; printf "%s" "$key"; color k w; printf ">"
}

# vi: syntax=sh ts=4 noexpandtab
PK�]ǡ���time_binarynuȯ��#!/bin/bash -e
#---------------------------------------------------------------------
# Script to display a "binary clock" using unicode characters from the
# braille block.
#
# Designed to work with the wonderful byobu(1) but can be run
# stand-alone.
#---------------------------------------------------------------------
#
# Copyright (C) 2011 Canonical Ltd.
#
# Author: James Hunt <james.hunt@canonical.com>
#
# 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 <http://www.gnu.org/licenses/>.
#
#---------------------------------------------------------------------

script_name=${0##*/}

# Selected Unicode Braille characters:
#
#  0x2800, 0x2880, 0x2820, 0x28a0, 0x2810, 0x2890, 0x2830, 0x28b0, 0x2808, 0x2888,
#  0x2840, 0x28c0, 0x2860, 0x28e0, 0x2850, 0x28d0, 0x2870, 0x28f0, 0x2848, 0x28c8,
#  0x2804, 0x2884, 0x2824, 0x28a4, 0x2814, 0x2894, 0x2834, 0x28b4, 0x280c, 0x288c,
#  0x2844, 0x28c4, 0x2864, 0x28e4, 0x2854, 0x28d4, 0x287b, 0x28f4, 0x284c, 0x28cc,
#  0x2802, 0x2882, 0x2822, 0x28a2, 0x2812, 0x2892, 0x2832, 0x28b2, 0x280a, 0x288a,
#  0x2842, 0x28c2, 0x2862, 0x28e2, 0x2852, 0x28d2, 0x2872, 0x28f2, 0x284a, 0x28ca,
#  0x2806, 0x2886
#
# Index of this array is 0-61 with character returned being
# "two column" binary representation of a time segment.
#
binary=(⠀ ⢀ ⠠ ⢠ ⠐ ⢐ ⠰ ⢰ ⠈ ⢈ \
         ⡀ ⣀ ⡠ ⣠ ⡐ ⣐ ⡰ ⣰ ⡈ ⣈ \
         ⠄ ⢄ ⠤ ⢤ ⠔ ⢔ ⠴ ⢴ ⠌ ⢌ \
         ⡄ ⣄ ⡤ ⣤ ⡔ ⣔ ⡻ ⣴ ⡌ ⣌ \
         ⠂ ⢂ ⠢ ⢢ ⠒ ⢒ ⠲ ⢲ ⠊ ⢊ \
         ⡂ ⣂ ⡢ ⣢ ⡒ ⣒ ⡲ ⣲ ⡊ ⣊ ⠆ ⢆)

usage()
{
cat <<EOT
Description: A clock that displays the time in binary.

Usage: $script_name [options]


Options:

 -b         : Display binary clock (default)
 -h         : Show this help.
 -l         : Display leading zeros (hex and octal modes only).
 -m         : Show time in 24-hour military format
              (default: 12-hour format).
 -n         : Suppress newline at end of time.
 -o         : Display time in octal (base 8).
 -s <sep>   : Specify separator between hours and minutes
              (and seconds if not disabled).
 -u         : Display alphabetics in upper-case (hex mode only).
 -x         : Disable time in hexadecimal (base 16).
 -z         : Disable display of seconds.

EOT
}

suppress_seconds=n
clock_type=binary
format=std
ending=""
uppercase=n
leading_zeros=n

while getopts "bhlmnos:uxz" opt
do
  case "$opt" in
    b) 
      clock_type=binary
    ;;

    h) 
      usage
      exit 0
    ;;

    l) 
      leading_zeros=y
    ;;

    m) 
      format=mil
    ;;

    n) 
      ending=
    ;;

    o) 
      clock_type=oct
    ;;

    s) 
      sep=$OPTARG
    ;;

    u)
      uppercase=y
    ;;

    x) 
      clock_type=hex
    ;;

    z) 
      suppress_seconds=y
    ;;
  esac
done

if [ -z "$clock_type" ]
then
  printf "%s\n" "ERROR: must specify clock type"
  exit 1
fi

shift $[$OPTIND-1]

# get current time, handling 12-hour or 24-hour
if [ $format = std ]
then
  hrs_format=%l
else
  hrs_format=%k
fi

time=($(date "+${hrs_format} %M %S"))
h=$(printf ${time[0]})
m=$(printf ${time[1]})
s=$(printf ${time[2]})

if [ $clock_type = binary ]
then
  [ $suppress_seconds = n ] && seconds="${sep}${binary[10#$s]}"
  display_time="${binary[10#$h]}${sep}${binary[10#$m]}${seconds}${ending}"
else
  if [ $clock_type = hex ]
  then
    conversion=x
    [ $uppercase = y ] && conversion=X
  else
    conversion=o
  fi
  precision=
  [ $leading_zeros = y ] && precision=.2
  base_format=%2${precision}${conversion}

  hh=$(printf "$base_format" $h)
  hm=$(printf "$base_format" $m)
  [ "$suppress_seconds" = n ] && hs="${sep}$(printf "$base_format" $s)"
  display_time="${hh}${sep}${hm}${hs}${ending}"
fi

color k w
printf "%s" "$display_time"
color --
PK�]uV�9llupdates_availablenuȯ��#!/bin/sh -e
#
#    updates_available: calculate and cache the number of updates available
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2023 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

___print_updates() {
	local u= s=
	read u s < "$1"
	if [ -n "$u" ]; then
		if [ "$u" -gt 0 ]; then
			color b r W; printf "%d" "$u"; color -; color r W
			if [ -n "$s" ] && [ "$s" -gt 0 ]; then
				printf "$ICON_SECURITY"
			else
				printf "$ICON_UPDATES"
			fi
			color --
		elif [ "$u" = "0" ] && [ -e "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/updates_available" ]; then
			# Clear out byobu's status cache
			rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/updates_available"*
		fi
	fi
}

___update_cache() {
	local mycache=$1 flock="$1.lock"
	# Now we actually have to do hard computational work to calculate updates.
	# Let's try to be "nice" about it:
	renice 10 $$ >/dev/null 2>&1 || true
	ionice -c3 -p $$ >/dev/null 2>&1 || true
	# These are very computationally intensive processes.
	# Background this work, have it write to the cache files,
	# and let the next cache check pick up the results.
	# Ensure that no more than one of these run at a given time
	if [ -x /usr/lib/update-notifier/apt-check ]; then
		# If apt-check binary exists, use it
		flock -xn "$flock" sh -c "(/usr/lib/update-notifier/apt-check 2>&1 | awk '-F;' 'END { print \$1, \$2 }' >\"${mycache}-x\" 2>/dev/null ; mv \"${mycache}-x\" \"$mycache\")" &
	elif eval $BYOBU_TEST apt-get >/dev/null; then
		# If apt-get exists, use it
		flock -xn "$flock" apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst >$mycache 2>/dev/null &
	elif eval $BYOBU_TEST pkcon >/dev/null; then
		# use packagekit to show list of packages
		LC_ALL=C flock -xn "$flock" pkcon get-updates -p | awk '/^Results:$/ { start=NR }; /^Security/ { security++ }; END { if (!/There are no updates available at this time./) { print NR-start, security }}' > "$mycache" 2>/dev/null &
	elif eval $BYOBU_TEST zypper >/dev/null; then
		# If zypper exists, use it
		flock -xn "$flock" zypper --no-refresh lu --best-effort | grep -c 'v |' >$mycache 2>/dev/null &
	elif eval $BYOBU_TEST yum >/dev/null; then
		# If yum exists, use it
		# TODO: We need a better way of counting updates available from a RH expert
		flock -xn "$flock" yum list updates -q | grep -vc "Updated Packages" >$mycache 2>/dev/null &
	elif eval $BYOBU_TEST pacman >/dev/null; then
		# If pacman (Archlinux) exists, use it
		LC_ALL=C flock -xn "$flock" pacman -Sup | grep -vc "^\(::\| \)" >$mycache 2>/dev/null &
	elif eval $BYOBU_TEST opkg >/dev/null; then
		# If opkg (OpenWrt) exists, use it, also background if flock exists
		if eval $BYOBU_TEST flock >/dev/null; then
			flock -xn "$flock" opkg list-upgradable | wc -l >$mycache 2>/dev/null &
		else
			opkg list-upgradable | wc -l >$mycache &
		fi
	elif eval $BYOBU_TEST brew >/dev/null; then
		# If homebrew (Mac OSX) exists, use it, also background if flock exists
		if eval $BYOBU_TEST flock >/dev/null; then
			flock -xn "$flock" brew outdated | wc -l >$mycache 2>/dev/null &
		else
			brew outdated | wc -l >$mycache &
		fi
	elif eval $BYOBU_TEST apk >/dev/null; then
		# Wolfi updates are cheap (~1s); so update cache every time
		apk update 2>&1 >/dev/null
		apk upgrade --simulate | grep -c " Upgrading " >$mycache 2>/dev/null &
	elif eval $BYOBU_TEST dnf >/dev/null; then
		# If dnf exists, use it
		flock -xn "$flock" dnf list --upgrades -q -y | grep -vc "Available Upgrades" >$mycache 2>/dev/null &
	fi
}

___update_needed() {
	# Checks if we need to update the cache.
	# TODO: add more distro
	local mycache=$1
	# The cache doesn't exist: create it
	[ ! -e "$mycache" ] && return 0
	if eval $BYOBU_TEST apt-get >/dev/null; then
		# Debian/ubuntu
		d0=$(($(stat -c %Y $mycache 2>/dev/null)-5))
		d1=$(stat -c %Y /var/lib/apt)
		d2=$(stat -c %Y /var/lib/apt/lists)
		d3=$(stat -c %Y /var/log/dpkg.log)
		now=$(date +%s)
		delta=$(($now-$d0))
		if [ $d0 -lt 0 ] || [ $d0 -lt $d1 ] || [ $d0 -lt $d2 ] || [ $d0 -lt $d3 ] || [ 3605 -lt $delta ] ; then
			return 0
		else
			return 1
		fi
	elif [ -e "/var/lib/PackageKit/transactions.db" ]; then
		[ "/var/lib/PackageKit/transactions.db" -nt "$mycache" ]
		return $?
	elif eval $BYOBU_TEST pacman >/dev/null; then
		# Archlinux
		local db
		for db in /var/lib/pacman/sync/*.db; do
			[ "$db" -nt "$mycache" ] && return 0
		done
		return 1
	elif eval $BYOBU_TEST opkg >/dev/null; then
		# OpenWrt
		[ ! -e /var/lock/opkg.lock ] || return 1
		if [ -d /var/opkg-lists ]; then
			[ /var/opkg-lists -nt "$mycache" ]
			return $?
		else
			local u s
			read u s < "$mycache"
			[ "$u" -gt 0 ]
			return $?
		fi
	elif eval $BYOBU_TEST brew >/dev/null; then
		# Mac OSX
		# check if any new versions have been installed since
		# we last cached. this may not recognize formulae
		# installed with HEAD
		for f in $(brew --prefix)/Cellar/*; do
			[ "$f" -nt "$mycache" ] && return 0
		done
		# nothing new has been installed, so check wether the
		# formulae database was updated
		[ "$(brew --prefix)/Library/Formula" -nt "$mycache" ]
		return $?
	elif [ -e "/var/cache/dnf/packages.db" ]; then
		[ "/var/cache/dnf/packages.db" -nt "$mycache" ]
		return $?
	fi
	return 1
}

__updates_available_detail() {
	if eval $BYOBU_TEST apt-get >/dev/null; then
		local detail=`apt-get -s -o Debug::NoLocking=true upgrade`
		if [ "$1" = "--detail" ]; then
			printf "$detail"
		else
			local short=`printf "%s" "$detail" | grep -c ^Inst`
			printf "$short"
		fi
	fi
}

__updates_available() {
	local mycache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/updates-available"
	# If mycache is present, use it
	[ -r $mycache ] && ___print_updates "$mycache"
	# If we really need to do so (mycache doesn't exist, or the package database has changed),
	# background an update now
	___update_needed "$mycache" && ___update_cache "$mycache"
}

# vi: syntax=sh ts=4 noexpandtab
PK�]��ڹ�raidnuȯ��#!/bin/sh -e
#
#    raid: notify raid events, failures and syncing
#
#    Copyright (C) 2010 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__raid_detail() {
	[ -r /proc/mdstat ] && cat /proc/mdstat || true
}

__raid() {
	[ -r /proc/mdstat ] || return
	while read line; do
		local p msg
		# Errors in your raid
		case "$line" in
			*\ blocks\ *\[*_*\])
				[ -z "${msg}" ] && msg="RAID"
			;;
			*%*)
				p="${line%%\%*}${PCT}"; p=${p##* };
				[ -z "$msg" ] && msg="RAID"
				msg="$msg,$p"
			;;
		esac
	done < /proc/mdstat
	if [ -n "$msg" ]; then
		color B w r; printf "%s" "$msg"; color --
	elif [ -e "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/raid" ]; then
		# Clear out cached raid message
		rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/raid"*
	fi
}

# vi: syntax=sh ts=4 noexpandtab
PK�]:6��AAentropynuȯ��#!/bin/sh -e
#
#    entropy: system entropy
#
#    Copyright (C) 2011-2014 Dustin Kirkland <kirkland@byobu.org>
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__entropy_detail() {
	cat /proc/sys/kernel/random/entropy_avail 2>/dev/null
}

__entropy() {
	if [ -r /proc/sys/kernel/random/entropy_avail ]; then
		local e=$(cat /proc/sys/kernel/random/entropy_avail)
		[ -n "$e" ] || return
		color K Y; printf "e%s" "$e"; color --
	fi
}

# vi: syntax=sh ts=4 noexpandtab
PK�]'޽���releasenuȯ��#!/bin/sh -e
#
#    release: grab the os/distro release version
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2023 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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 <http://www.gnu.org/licenses/>.

__release_detail() {
	lsb_release -a 2>/dev/null
}

__release() {
	local RELEASE="${RELEASE}"
	if [ -n "$RELEASE" ]; then
		# user defined
		true
	elif [ "$BYOBU_DISTRO" = "Wolfi" ]; then
		# Wolfi, and perhaps other distroless distros don't really have release versions
		RELEASE="Wolfi"
	elif [ -r "/etc/os-release" ]; then
		# lsb_release is *really* slow;  try to use /etc/os-release
		RELEASE=$(. /etc/os-release && echo "$VERSION_ID")
	elif [ -r "/etc/issue" ]; then
		# next try /etc/issue first
		local issue
		read issue < /etc/issue
		case "$issue" in
			Ubuntu*)
				set -- $issue;
				RELEASE="$2";
			;;
			Debian*)
				local ver
				read ver < /etc/debian_version
				RELEASE="$ver"
			;;
		esac
	elif eval $BYOBU_TEST sw_vers >/dev/null 2>&1; then
		RELEASE="$(sw_vers -productVersion)"
	fi
	if [ -z "$RELEASE" ] && eval $BYOBU_TEST lsb_release >/dev/null 2>&1; then
		# If lsb_release is available, use it
		RELEASE=$(lsb_release -s -r)
	fi
	if [ -n "$RELEASE_ABBREVIATED" ] && [ $RELEASE_ABBREVIATED -gt 0 ]; then
		color bold2; printf "%.${RELEASE_ABBREVIATED}s" "$RELEASE"; color --
	else
		color bold2; printf "%s" "$RELEASE"; color --
	fi
}

# vi: syntax=sh ts=4 noexpandtab
PK�]��,���	socketdirnu�[���# Set the location of the socket directory that byobu will use.
# On Debian/Ubuntu systems, this is in /var/run/screen, but on
# other distros, it might be elsewhere, such as /tmp/screens
# depending on your compilation.
#
# This file will be sourced by both shell scripts and python code,
# so please ensure that:
#  * the variable name is SOCKETDIR
#  * there is no space around the "="
#  * and that the path value is quoted
SOCKETDIR="/var/run/screen"
PK�]:���backendnu�[���# BYOBU_BACKEND can currently be "screen" or "tmux"
# Override this on a per-user basis by editing "$BYOBU_CONFIG_DIR/backend"
# or by launching either "byobu-screen" or "byobu-tmux" instead of "byobu".
BYOBU_BACKEND="tmux"
PK�]��-1��datenuȯ��PK�]�t�SSlogonuȯ��PK�]��&����hostnamenuȯ��PK�]fQ99�mailnuȯ��PK�]h���#swapnuȯ��PK�]"����:*customnuȯ��PK�]��!,���1time_utcnuȯ��PK�]c3�x���5packagesnuȯ��PK�]�Q��99<timenuȯ��PK�]U�7j��{@trashnuȯ��PK�]Ĩ�s
s
7Ememorynuȯ��PK�]�oyg	�Ocpu_countnuȯ��PK�]��	��8Tdisk_ionuȯ��PK�]�?t�h`wifi_qualitynuȯ��PK�]��`+hh�knetworknuȯ��PK�]퍽zZZIxcpu_freqnuȯ��PK�]/�zz	�processesnuȯ��PK�]p7�%%��colornuȯ��PK�]%����usersnuȯ��PK�]���ff	8�fan_speednuȯ��PK�].�S�bbזservicesnuȯ��PK�]����q�archnuȯ��PK�]H?���
9�ip_addressnuȯ��PK�]m[��

c�whoaminuȯ��PK�]i€))��sessionnuȯ��PK�])/����include/commonnuȯ��PK�]��Ļ�&�include/tmux-send-command-to-all-panesnuȯ��PK�]ih=;;*��include/tmux-detach-all-but-current-clientnuȯ��PK�]�qq(��include/tmux-send-command-to-all-windowsnuȯ��PK�]/+��Q�include/notify_osdnuȯ��PK�]����include/colorsnuȯ��PK�]���YY
��include/iconsnuȯ��PK�]03�	�	v�include/dirsnuȯ��PK�]s(�K��I�include/mondriannuȯ��PK�]1���
�
}�include/constantsnuȯ��PK�]6�6��)�)X
include/config.pynuȯ��PK�]�����p4include/toggle-utf8nuȯ��PK�]�?���"�"�;include/shutilnuȯ��PK�]�?�,cc�^include/cycle-statusnuȯ��PK�]��⬥�Kdinclude/select-session.pynuȯ��PK�]����d!d!29include/__pycache__/select-session.cpython-312.pycnu�[���PK�]��~�E�E*��include/__pycache__/config.cpython-312.pycnu�[���PK�]nR�L��=�reboot_requirednuȯ��PK�]�&X��apportnuȯ��PK�]��2$$W�distronuȯ��PK�]Y�|9����batterynuȯ��PK�]�N=
���uptimenuȯ��PK�]%@<7]disknuȯ��PK�]�� cc�load_averagenuȯ��PK�]Š�$$Lcpu_tempnuȯ��PK�]��yss�&menunuȯ��PK�]ǡ���O-time_binarynuȯ��PK�]uV�9ll@>updates_availablenuȯ��PK�]��ڹ��Wraidnuȯ��PK�]:6��AA�]entropynuȯ��PK�]'޽���Rbreleasenuȯ��PK�]��,���	hjsocketdirnu�[���PK�]:���ilbackendnu�[���PK::D�m