mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 14:24:39 -07:00
* usr/bin/byobu-select-profile: LP: #946112
- fix byobu interactive color selection in tmux
This commit is contained in:
parent
e5facd4e21
commit
091b1c403a
2 changed files with 23 additions and 7 deletions
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -14,6 +14,8 @@ byobu (5.27) unreleased; urgency=low
|
||||||
usr/bin/byobu-tmux, === target is byobu: LP: #1022882
|
usr/bin/byobu-tmux, === target is byobu: LP: #1022882
|
||||||
- add symlinks to repo, makes it easier to use byobu straight out of
|
- add symlinks to repo, makes it easier to use byobu straight out of
|
||||||
bzr
|
bzr
|
||||||
|
* usr/bin/byobu-select-profile: LP: #946112
|
||||||
|
- fix byobu interactive color selection in tmux
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 10 Jan 2013 16:36:23 -0600
|
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 10 Jan 2013 16:36:23 -0600
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,14 @@ prompt() {
|
||||||
i=$(expr $i + 1)
|
i=$(expr $i + 1)
|
||||||
done
|
done
|
||||||
echo `gettext "Selected"` "$which [$color]"
|
echo `gettext "Selected"` "$which [$color]"
|
||||||
setcolor "$which" "$color"
|
case "$BYOBU_BACKEND" in
|
||||||
|
screen)
|
||||||
|
setcolor_screen "$which" "$color"
|
||||||
|
;;
|
||||||
|
tmux|*)
|
||||||
|
setcolor_tmux "$color"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -154,7 +161,7 @@ getletter() {
|
||||||
echo "$letter"
|
echo "$letter"
|
||||||
}
|
}
|
||||||
|
|
||||||
setcolor() {
|
setcolor_screen() {
|
||||||
which="$1"
|
which="$1"
|
||||||
color="$2"
|
color="$2"
|
||||||
[ -r $FILE ] && . $FILE
|
[ -r $FILE ] && . $FILE
|
||||||
|
@ -166,6 +173,7 @@ setcolor() {
|
||||||
[ "$MONOCHROME" = "1" ] || MONOCHROME=0
|
[ "$MONOCHROME" = "1" ] || MONOCHROME=0
|
||||||
printf "FOREGROUND=$FOREGROUND\nBACKGROUND=$BACKGROUND\nMONOCHROME=$MONOCHROME" > $FILE
|
printf "FOREGROUND=$FOREGROUND\nBACKGROUND=$BACKGROUND\nMONOCHROME=$MONOCHROME" > $FILE
|
||||||
touch "$BYOBU_RUN_DIR/reload-required"
|
touch "$BYOBU_RUN_DIR/reload-required"
|
||||||
|
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_contrast() {
|
get_contrast() {
|
||||||
|
@ -180,29 +188,35 @@ get_contrast() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setcolor_tmux() {
|
setcolor_tmux() {
|
||||||
|
if [ "$BYOBU_BACKEND" != "tmux" ]; then
|
||||||
|
echo "WARNING: This functionality is only supported in Byobu with the tmux backend" 1>&2
|
||||||
|
fi
|
||||||
dark="$1"
|
dark="$1"
|
||||||
get_contrast "$dark"
|
get_contrast "$dark"
|
||||||
light="$_RET"
|
light="$_RET"
|
||||||
accent="magenta"
|
accent="magenta"
|
||||||
highlight="red"
|
highlight="red"
|
||||||
monochrome="0"
|
monochrome="0"
|
||||||
printf "BYOBU_DARK=\"#$dark\"\nBYOBU_LIGHT=$light\nBYOBU_ACCENT=$accent\nBYOBU_HIGHLIGHT=$highlight\nMONOCHROME=$MONOCHROME" > "$FILE".tmux
|
printf "BYOBU_DARK=\"$dark\"\nBYOBU_LIGHT=$light\nBYOBU_ACCENT=$accent\nBYOBU_HIGHLIGHT=$highlight\nMONOCHROME=$MONOCHROME" > "$FILE".tmux
|
||||||
tmux source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc"
|
tmux source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
prompt "background"
|
prompt "background"
|
||||||
prompt "foreground"
|
case "$BYOBU_BACKEND" in
|
||||||
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
screen)
|
||||||
|
prompt "foreground"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-b|--background)
|
-b|--background)
|
||||||
setcolor "background" "$2"
|
setcolor_screen "background" "$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-f|--foreground)
|
-f|--foreground)
|
||||||
setcolor "foreground" "$2"
|
setcolor_screen "foreground" "$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-l|--list)
|
-l|--list)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue