このコミットが含まれているのは:
守矢諏訪子 2023-12-12 19:10:41 +09:00
コミット a0074a8e50
40個のファイルの変更292行の追加214行の削除

65
CHANGELOG.md ノーマルファイル
ファイルの表示

@ -0,0 +1,65 @@
# 5.2
* 今度から、テクニカル諏訪子ちゃんは更新します。
* メモリ、ディスク、CPU温度、及びCPUプロセスがLinux、OpenBSD、及びFreeBSDに対応する様にしました。
* 「.byobu」→「.config/byobu」、「.byoburc」→「.config/byoburc」
# 5.133
* fix FTBFS on README
# 5.132
* pep8 binary is gone from Debian, disable for now
# 5.131
* build-depend on python3-pep8, rather than pep8 transitional package
* change disk status to white on darker magenta/purple, helps with readability on some terminals
* commit edeae41 fixed the excessive creation of sessions by not creating different sessions. This commit adjust the behavior in a way that having .reuse-sessions enabled tmux will properly attach and remove sessions when dettaching and will also kill the last session available
* When more than two sessions exist, tmux asks which session to use
* Update usage of tmux swap-window so that focus stays with the original window.
# 5.130
* add Raspbian colors / logo
* Force UTF-8 when attaching in `select-session.py`
* ignore new pep8 rules around hard tabs and whitespaces, related to bug 1843729
* Flatten these files into a single README.md
* Minor updates in the process
# 5.129
* recommend less package, for BYOBU_PAGER
# 5.128
* Quotes are needed around "$@" to keep parameters from splitting on spaces.
* "SuSE" name is an outdated version of it. Use the modern one: SUSE
* use env python3 for portability to other Linux and Mac systems (hopefully that's still okay for Debian / Ubuntu?
* https://github.com/dustinkirkland/byobu/pull/30
* prefer iwconfig over iw for now, iw is not working for me
* flatten some of our color configuration to match the new tmux format
* ensure some values are set to zero, if unreadable
* fixes a bug where disk_io causes the rest of the status line to fail
* fix bug creating a mess of sessions, where cycling through a bunch of copies of the same session
* On tmux version 1.9 all the styles *-bg/fg/attr were deprecated and replaced with *-style bg=/ fg=/ attribute In the upcoming version 2.9, this commands are gone and will break byobu style. this fix that issue and mantain compatibility with upcoming tmux versions.
* Do not include the user's .screenrc in the apport generated crash report
* Test if $HOME/.bashrc exists before modifying it (and potentially creating it)
* Use echo if the gettext command is not available
* Use readlink if the tty command is not available
* Add fallback if the install command is not available
* Don't autolaunch for ARM serial consoles
* Ensure the detected mount point device exists
* Read from /proc/sys/kernel/hostname if the hostname command is not available
* Add logo for OpenWrt
* Handle stderr for ps, e.g. unsupported options
* Remove unnecessary awk call; wc -l only outputs one value
* Ensure /proc/mdstat is readable
* Fix typo
* Fix reading services from $BYOBU_CONFIG_DIR/statusrc
* Fix screen session regex
* Add support for opkg (OpenWrt)
* Handle stderr for ps, e.g. unsupported options
* Fix trailing '#' sign
* Use id if the whoami command is not available
* Read from /etc/passwd if the getent command is not available
* Add support for iw (preferred over iwconfig)
* Make logic more similar to other status notifications
* Remove -k for new-window. In older versions of tmux, -k without -t <target-window> had no effect. In tmux 2.8, -k without -t will not trigger a new window; the given command is executed in the current window instead.
* Rename the new window created after adding a new session
もっと: [https://launchpad.net/byobu/+download](https://launchpad.net/byobu/+download)

ファイルの表示

@ -1 +1,4 @@
元のbyobuはDebian向けらしい、だからArtix、CRUX、OpenBSD、及びFreeBSDでもうまく機能している間で変更した
元のbyobuはDebian向けらしい、だからArtix、CRUX、OpenBSD、及びFreeBSDでもうまく機能している間で変更した。
更新:\
元のbyobuの開発者は辞めたらしいから、バージョン5.2からあたしが開発者だわ〜

ファイルの表示

@ -18,7 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
VERSION=5.133
VERSION=5.2
PKG="byobu"
# All sorts of things go wrong if you don't own your $HOME dir.
@ -33,21 +33,21 @@ if [ ! -O "$HOME" ]; then
fi
# Source local byobu config
if [ -r "$HOME/.byoburc" ]; then
if [ -r "$HOME/.config/byoburc" ]; then
# Ensure that this configuration is usable
. "$HOME/.byoburc" || mv -f "$HOME/.byoburc" "$HOME/.byoburc".orig
. "$HOME/.config/byoburc" || mv -f "$HOME/.config/byoburc" "$HOME/.config/byoburc".orig
fi
if [ -z "${BYOBU_PREFIX}" ]; then
# Find and export the installation location prefix
greadlink -f . >/dev/null 2>&1 && export BYOBU_READLINK="greadlink" || export BYOBU_READLINK="readlink"
prefix="$(dirname $(dirname $($BYOBU_READLINK -f $0)))"
if [ "$prefix" != "/usr" ]; then
echo "export BYOBU_PREFIX='$prefix'" >> "$HOME/.byoburc"
. "$HOME/.byoburc"
echo "export BYOBU_PREFIX='$prefix'" >> "$HOME/.config/byoburc"
. "$HOME/.config/byoburc"
fi
fi
export BYOBU_CHARMAP=$(locale charmap)
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -26,7 +26,7 @@ EOF
}
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -20,7 +20,7 @@
[ "$SHELL" = "/bin/bash" ] || exit 1
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
@ -34,7 +34,7 @@ The byobu-export utility is now deprecated.
To install byobu on a system for which byobu is not packaged, or
where you are not the root user, simply:
* Download the latest release (>= 3.0) from:
https://launchpad.net/byobu/+download
https://gitler.moe/suwako/byobu
* And follow the instructions in the README
"

ファイルの表示

@ -20,7 +20,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -42,7 +42,7 @@ elif [ "$BYOBU_SOURCED_PROFILE" != "1" ] && [ "$LC_BYOBU" != "0" ] && [ "$BYOBU_
unset _tty
BYOBU_SOURCED_PROFILE=1
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
# Ensure that autolaunch is not explicitly disabled

ファイルの表示

@ -21,7 +21,7 @@ PKG="byobu"
# Bad things happen if you run byobu, but you don't own your $HOME
# ie, rather than "sudo byobu", you must run "sudo -H byobu"
if [ -O "$HOME" ]; then
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
if [ -e "$BYOBU_CONFIG_DIR/disable-autolaunch" ]; then

ファイルの表示

@ -19,7 +19,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -19,7 +19,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -24,7 +24,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -19,7 +19,7 @@
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -23,7 +23,7 @@
# ./debian/rules get-po
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -19,7 +19,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -25,7 +25,7 @@
#---------------------------------------------------------------------
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -36,7 +36,7 @@
# command-line option.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

ファイルの表示

@ -1,92 +1,132 @@
#!/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"
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=""
case "$(uname)" in
OpenBSD)
percent=$(apm -l)
case $(apm -a) in
0) state="discharging";;
1) state="charging";;
2) state="on-line";;
esac
;;
Linux)
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"
[ -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:*)
[ "$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
esac
if [ $percent -ge 0 ]; then
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}"
state=$(printf "%s" "$state" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')
case $state in
charging) sign="+" ;;
discharging) sign="-" ;;
on-line) 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 --
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 $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
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

ファイルの表示

@ -1,4 +1,3 @@
#!/bin/sh -e
__cpu_freq_detail() {
cat /proc/cpuinfo
}
@ -45,6 +44,7 @@ __cpu_freq() {
unit="MHz"
fi
fi
[ -n "$freq" ] || return
color c W; printf "%s" "${cores}x"; color b c W; printf "%s" "$freq"; color -; color c W; printf "%s" "$unit"; color --
}

ファイルの表示

@ -1,54 +1,53 @@
#!/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
case "$(uname)" in
"OpenBSD")
sysctl hw.sensors | grep -E 'hw.sensors.*temp'
;;
"FreeBSD")
sysctl dev.cpu | grep -E 'dev.cpu.*temperature'
;;
"Linux")
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
;;
esac
}
__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
local i t unit
case "$(uname)" in
"OpenBSD")
t=$(sysctl hw.sensors | grep -E 'hw.sensors.*temp' | awk '{ print $1 }' | head -1 | sed 's/^.*=//' | sed 's/\..*$//')
color b k Y; printf "%s" "$t"; color --
;;
"FreeBSD")
t=$(sysctl dev.cpu | grep -E 'dev.cpu.*temperature' | awk '{ print $2 }' | head -1 | sed 's/\..*$/C/')
color b k Y; printf "%s" "$t"; color --
;;
"Linux")
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
color b k Y; printf "%sC" "$t"; color --
break
fi
done
;;
esac
}
# vi: syntax=sh ts=4 noexpandtab

ファイルの表示

@ -1,40 +1,23 @@
#!/bin/sh -e
__disk_detail() {
df -h -P
if [ $(uname) = "FreeBSD" ]; then
df -h
else
df -h -P
fi
}
__disk() {
local out="" MP="" size="" free="" unit=""
[ -z "$MONITORED_DISK" ] && MP="/" || MP="$MONITORED_DISK"
case $MP in
/dev/*) MP=$(awk '$1 == m { print $2; exit(0); }' "m=$MP" /proc/mounts);;
esac
if [ "$(uname)" = "FreeBSD" ]; then
out=$(df -h | grep "${MP}$" | awk '{ printf("%s %s", $4, $2); }')
local use="" total=""
if [ $(uname) = "FreeBSD" ]; then
use=$(zpool list | tail -1 | awk '{ print $3 }')
total=$(zpool list | tail -1 | awk '{ print $2 }')
else
out=$({ df -h -P "$MP" 2>/dev/null || df -h "$MP"; } | awk 'END { printf("%s %s", $3, $2); }')
use=$(df -h "/" | tail -1 | awk '{ print $3 }')
total=$(df -h "/" | tail -1 | awk '{ print $2 }')
fi
set -- ${out}
free=${1}; size=${2};
free_unit=${free#${free%?}}
free=${free%?};
unit=${size#${size%?}}
size=${size%?};
case "$unit" in
k*|K*) unit="$ICON_KB" ;;
m*|M*) unit="$ICON_MB" ;;
g*|G*) unit="$ICON_GB" ;;
t*|T*) unit="$ICON_TB" ;;
esac
case "$free_unit" in
k*|K*) free_unit="$ICON_KB" ;;
m*|M*) free_unit="$ICON_MB" ;;
g*|G*) free_unit="$ICON_GB" ;;
t*|T*) free_unit="$ICON_TB" ;;
esac
[ -n "$size" ] || return
color b m W; printf "%s%s/%s%s" "$free" "$free_unit" "$size" "$unit"; color --;
color b m W; printf "%s/" "$use"; color -; color b m W; printf "%s" "$total"; color -;
}
# vi: syntax=sh ts=4 noexpandtab

ファイルの表示

@ -49,7 +49,7 @@ except Exception:
PKG = "byobu"
HOME = os.getenv("HOME")
USER = os.getenv("USER")
BYOBU_CONFIG_DIR = os.getenv("BYOBU_CONFIG_DIR", HOME + "/.byobu")
BYOBU_CONFIG_DIR = os.getenv("BYOBU_CONFIG_DIR", HOME + "/.config/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")

ファイルの表示

@ -21,25 +21,11 @@
PKG="byobu"
# Some users build and install byobu themselves, rather than from a distro
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/byoburc"
[ -n "$BYOBU_PREFIX" ] || BYOBU_PREFIX="/usr"
# Create and export the user configuration directory
if [ -d "$BYOBU_CONFIG_DIR" ]; then
export BYOBU_CONFIG_DIR="$BYOBU_CONFIG_DIR"
elif [ -d "$XDG_CONFIG_HOME" ]; then
# Use XDG, as some users insist on such nonsense :-)
export BYOBU_CONFIG_DIR="$XDG_CONFIG_HOME/$PKG"
elif [ -d "$HOME/.config/$PKG" ]; then
# Use XDG config directory, if it exists
export BYOBU_CONFIG_DIR="$HOME/.config/$PKG"
elif [ -d "$HOME/.local/share/$PKG" ]; then
# Use XDG local directory, if it exists
export BYOBU_CONFIG_DIR="$HOME/.local/share/$PKG"
else
# And to default to good old classic config dir location!
export BYOBU_CONFIG_DIR="$HOME/.$PKG"
fi
export BYOBU_CONFIG_DIR="$HOME/.config/$PKG"
[ -d "$BYOBU_CONFIG_DIR" ] || mkdir -p "$BYOBU_CONFIG_DIR/bin"
# Grab the global, then local socket directory

ファイルの表示

@ -35,7 +35,7 @@ except Exception:
PKG = "byobu"
SHELL = os.getenv("SHELL", "/bin/bash")
HOME = os.getenv("HOME")
BYOBU_CONFIG_DIR = os.getenv("BYOBU_CONFIG_DIR", HOME + "/.byobu")
BYOBU_CONFIG_DIR = os.getenv("BYOBU_CONFIG_DIR", HOME + "/.config/byobu")
BYOBU_BACKEND = os.getenv("BYOBU_BACKEND", "tmux")
choice = -1
sessions = []

ファイルの表示

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -r "$HOME/.config/byoburc" ] && . "$HOME/.config/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"

ファイルの表示

@ -28,7 +28,7 @@ __memory() {
;;
OpenBSD)
total=$(($(sysctl -n hw.physmem) / 1024 / 1024))
used_mb=$(($(vmstat | tail -1 | awk '{print $4}') / 1024))
used_mb=$(vmstat | tail -1 | awk '{print substr($3, 1, length($3)-1)}')
;;
FreeBSD)
total=$(($(sysctl -n hw.realmem) / 1024 / 1024))

ファイルの表示

@ -13,8 +13,10 @@ __release() {
elif [ -r "/etc/os-release" ]; then
if grep -q -E '^(Arch|Artix|Gentoo|Void)' /etc/os-release; then
RELEASE="" # ローリングリリースの場合
else
elif grep -q -E '^ID=crux' /etc/os-release; then
RELEASE=$(. /etc/os-release && echo "$VERSION")
else
RELEASE=$(. /etc/os-release && echo "$VERSION_ID")
fi
elif [ -r "/etc/issue" ]; then
local issue
@ -23,12 +25,12 @@ __release() {
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)"

ファイルの表示

@ -78,7 +78,7 @@ unbind-key -n C-F9
unbind-key -n M-F11
unbind-key -n C-F11
unbind-key -n S-F11
bind-key -n S-F12 source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux \; source $HOME/.byobu/keybindings.tmux \; display-message "Byobu F-keys: ENABLED"
bind-key -n S-F12 source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux \; source $HOME/.config/byobu/keybindings.tmux \; display-message "Byobu F-keys: ENABLED"
unbind-key -n M-F12
unbind-key -n C-S-F12
unbind-key -n M-IC

ファイルの表示

@ -2,7 +2,7 @@
# Load:
# * the stock byobu profile
# * any windows
# * and the local .screenrc (instead of .byoburc)
# * and the local .screenrc (instead of .config/byoburc)
# Used at startup but not profile refresh
#
# Copyright (C) 2009-2011 Canonical Ltd.

ファイルの表示

@ -2,7 +2,7 @@
#
# Override these in $BYOBU_CONFIG_DIR/status
# where BYOBU_CONFIG_DIR is XDG_CONFIG_HOME if defined,
# and $HOME/.byobu otherwise.
# and $HOME/.config/byobu otherwise.
#
# Copyright (C) 2009-2011 Canonical Ltd.
#

ファイルの表示

@ -2,7 +2,7 @@
#
# Override these in $BYOBU_CONFIG_DIR/statusrc
# where BYOBU_CONFIG_DIR is XDG_CONFIG_HOME if defined,
# and $HOME/.byobu otherwise.
# and $HOME/.config/byobu otherwise.
#
# Copyright (C) 2009-2011 Canonical Ltd.
#