Merge lp:~jefferyto/byobu/misc-updates into lp:byobu
- misc-updates
- Merge into trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~jefferyto/byobu/misc-updates |
Merge into: | lp:byobu |
Diff against target: |
1406 lines (+467/-282) 29 files modified
debian/changelog (+96/-0) usr/bin/byobu-ctrl-a.in (+149/-76) usr/bin/byobu-export.in (+1/-1) usr/bin/byobu-janitor.in (+13/-7) usr/bin/byobu-launch.in (+1/-1) usr/bin/byobu-select-profile.in (+102/-75) usr/bin/byobu-status-detail.in (+1/-1) usr/bin/byobu-status.in (+6/-7) usr/bin/byobu.in (+14/-20) usr/lib/byobu/battery (+1/-1) usr/lib/byobu/disk_io (+1/-1) usr/lib/byobu/hostname (+1/-1) usr/lib/byobu/include/common (+7/-3) usr/lib/byobu/include/constants (+6/-10) usr/lib/byobu/include/dirs.in (+23/-14) usr/lib/byobu/include/shutil (+4/-4) usr/lib/byobu/ip_address (+2/-2) usr/lib/byobu/memory (+1/-1) usr/lib/byobu/release (+2/-2) usr/lib/byobu/updates_available (+14/-14) usr/lib/byobu/users (+10/-2) usr/lib/byobu/whoami (+3/-3) usr/lib/byobu/wifi_quality (+4/-4) usr/share/byobu/keybindings/f-keys.screen (+1/-1) usr/share/byobu/keybindings/f-keys.tmux (+1/-1) usr/share/byobu/profiles/Makefile.am (+1/-1) usr/share/byobu/profiles/byoburc (+0/-27) usr/share/byobu/profiles/screenrc (+1/-1) usr/share/byobu/profiles/tmuxrc (+1/-1) |
To merge this branch: | bzr merge lp:~jefferyto/byobu/misc-updates |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Dustin Kirkland | Pending | ||
Review via email: mp+368934@code.launchpad.net |
Commit message
Description of the change
There isn't a major theme to these changes, just things I noticed while working on porting byobu to OpenWrt (but aren't critical enough that I needed to patch right away).
There is one fix (trailing "#" sign for usr/lib/
I imagine the "create new config dir in ~/.config" change may be somewhat controversial. I think at this point most users will have a ~/.config directory and keeping $HOME clean(er) is a good thing.
Dustin Kirkland (kirkland) wrote : | # |
Hi Jeffrey,
Yeah, these are a lot of changes. I'm struggling to review all of them, as a monolith.
Jeffery To (jefferyto) wrote : | # |
> Hi Jeffrey,
>
> Yeah, these are a lot of changes. I'm struggling to review all of them, as a
> monolith.
I can submit them one at a time (the first one is at https:/
Jeffery To (jefferyto) wrote : | # |
I can submit all of the changes in separate merge requests all at once, but since they all include an update to debian/changelog, they will all conflict with each other.
Do you want me to submit all of the changes all at once and you will resolve the conflicts, or do you want me to submit them one at a time?
Unmerged revisions
- 2640. By Jeffery To
-
* usr/bin/
byobu-status- detail. in,
usr/bin/byobu-status. in:
- Remove unnecessary backticks; the command returns no output, only
the exit value is tested - 2639. By Jeffery To
-
* usr/bin/
byobu-ctrl- a.in,
usr/bin/byobu-janitor. in,
usr/share/byobu/keybindin gs/f-keys. screen,
usr/share/byobu/keybindin gs/f-keys. tmux:
- Fix ^A unbinding: ^A is bound in f-keys.screen / f-keys.tmux to
autorun byobu-ctrl-a, but if the user selected a different key in
byobu-config, it would unbind the custom key instead of ^A
- Use functions to help make the logic easier to understand
- Add "custom" and "manual" modes, that only unbind ^A ("emacs" mode
would also set prefix to F12 for tmux, possibly overriding the
user's custom prefix); "custom" when it is detected that the user
has customized their prefix before byobu-ctrl-a was run for the
first time, "manual" when the user just wants to disable the
autorun
- Add an "autorun" command line option, used when byobu-ctrl-a is
triggered by the user pressing ^A; in this case, byobu-ctrl-a will
wait for the user to press enter/return before exiting, so that
the user can read the text output before the window auto-closes
- Add a quit option, so that the user can exit byobu-ctrl-a without
making any changes - 2638. By Jeffery To
-
* usr/bin/
byobu-status. in:
- Include $BYOBU_CONFIG_ DIR/datetime. tmux in the sourcing for loop - 2637. By Jeffery To
-
* usr/bin/
byobu-select- profile. in:
- Update help message
- Remove $BYOBU_CONFIG_ DIR/profile test, it is not used directly in
the script
- Restore list colors functionality
- Use local variables in functions
- Simplify color calculation
- Exit when --list / --help / invalid options are specified, before
making changes
- Removed -- option, command utilities that have a -- option expect
data to come after the -- - 2636. By Jeffery To
-
* usr/bin/
byobu-janitor. in:
- Remove unused variables - 2635. By Jeffery To
-
* usr/bin/
byobu-export. in,
usr/bin/byobu-janitor. in,
usr/bin/byobu-launch. in,
usr/bin/byobu-select- profile. in,
usr/bin/byobu-status- detail. in,
usr/bin/byobu-status. in,
usr/bin/byobu.in,
usr/lib/byobu/battery,
usr/lib/byobu/disk_ io,
usr/lib/byobu/hostname,
usr/lib/byobu/include/ common,
usr/lib/byobu/include/ constants,
usr/lib/byobu/include/ shutil,
usr/lib/byobu/ip_ address,
usr/lib/byobu/memory,
usr/lib/byobu/release,
usr/lib/byobu/updates_ available,
usr/lib/byobu/whoami,
usr/lib/byobu/wifi_ quality:
- Add (and use) a byobu_test function to wrap $BYOBU_TEST - 2634. By Jeffery To
-
* usr/bin/byobu.in:
- Remove exporting of $BYOBU_BACKEND, this is already done in
usr/lib/byobu/ include/ constants - 2633. By Jeffery To
-
* usr/lib/
byobu/include/ constants:
- Remove sourcing of files looking for $BYOBU_BACKEND, this is
already done in usr/lib/byobu/include/ common - 2632. By Jeffery To
-
* usr/bin/
byobu-status- detail. in:
- Use $BYOBU_TEST - 2631. By Jeffery To
-
* usr/bin/byobu.in:
- Replace $HOME/.$PKG with $BYOBU_CONFIG_DIR
Preview Diff
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2019-06-12 23:41:10 +0000 | |||
3 | +++ debian/changelog 2019-06-17 20:09:21 +0000 | |||
4 | @@ -2,6 +2,102 @@ | |||
5 | 2 | 2 | ||
6 | 3 | * UNRELEASED | 3 | * UNRELEASED |
7 | 4 | 4 | ||
8 | 5 | [ Jeffery To ] | ||
9 | 6 | * usr/bin/byobu-ctrl-a.in, | ||
10 | 7 | usr/bin/byobu-janitor.in, | ||
11 | 8 | usr/share/byobu/keybindings/f-keys.screen, | ||
12 | 9 | usr/share/byobu/keybindings/f-keys.tmux: | ||
13 | 10 | - Fix ^A unbinding: ^A is bound in f-keys.screen / f-keys.tmux to | ||
14 | 11 | autorun byobu-ctrl-a, but if the user selected a different key in | ||
15 | 12 | byobu-config, it would unbind the custom key instead of ^A | ||
16 | 13 | - Use functions to help make the logic easier to understand | ||
17 | 14 | - Add "custom" and "manual" modes, that only unbind ^A ("emacs" mode | ||
18 | 15 | would also set prefix to F12 for tmux, possibly overriding the | ||
19 | 16 | user's custom prefix); "custom" when it is detected that the user | ||
20 | 17 | has customized their prefix before byobu-ctrl-a was run for the | ||
21 | 18 | first time, "manual" when the user just wants to disable the | ||
22 | 19 | autorun | ||
23 | 20 | - Add an "autorun" command line option, used when byobu-ctrl-a is | ||
24 | 21 | triggered by the user pressing ^A; in this case, byobu-ctrl-a will | ||
25 | 22 | wait for the user to press enter/return before exiting, so that | ||
26 | 23 | the user can read the text output before the window auto-closes | ||
27 | 24 | - Add a quit option, so that the user can exit byobu-ctrl-a without | ||
28 | 25 | making any changes | ||
29 | 26 | * usr/bin/byobu-export.in, | ||
30 | 27 | usr/bin/byobu-janitor.in, | ||
31 | 28 | usr/bin/byobu-launch.in, | ||
32 | 29 | usr/bin/byobu-select-profile.in, | ||
33 | 30 | usr/bin/byobu-status-detail.in, | ||
34 | 31 | usr/bin/byobu-status.in, | ||
35 | 32 | usr/bin/byobu.in, | ||
36 | 33 | usr/lib/byobu/battery, | ||
37 | 34 | usr/lib/byobu/disk_io, | ||
38 | 35 | usr/lib/byobu/hostname, | ||
39 | 36 | usr/lib/byobu/include/common, | ||
40 | 37 | usr/lib/byobu/include/constants, | ||
41 | 38 | usr/lib/byobu/include/shutil, | ||
42 | 39 | usr/lib/byobu/ip_address, | ||
43 | 40 | usr/lib/byobu/memory, | ||
44 | 41 | usr/lib/byobu/release, | ||
45 | 42 | usr/lib/byobu/updates_available, | ||
46 | 43 | usr/lib/byobu/whoami, | ||
47 | 44 | usr/lib/byobu/wifi_quality: | ||
48 | 45 | - Add (and use) a byobu_test function to wrap $BYOBU_TEST | ||
49 | 46 | * usr/bin/byobu.in: | ||
50 | 47 | - Use "sh -n" to check $HOME/.byoburc, to avoid sourcing a | ||
51 | 48 | partially valid file | ||
52 | 49 | - Remove redundant sourcing of $HOME/.byoburc | ||
53 | 50 | - Set BYOBU_BACKEND before sourcing usr/lib/byobu/include/common, so | ||
54 | 51 | the latter doesn't need to look for a backend | ||
55 | 52 | - Remove sourcing of $BYOBU_CONFIG_DIR/backend, it is already | ||
56 | 53 | sourced by usr/lib/byobu/include/common | ||
57 | 54 | - Remove exporting of $BYOBU_BACKEND, this is already done in | ||
58 | 55 | usr/lib/byobu/include/constants | ||
59 | 56 | - Replace $HOME/.$PKG with $BYOBU_CONFIG_DIR | ||
60 | 57 | * usr/bin/byobu.in, | ||
61 | 58 | usr/share/byobu/profiles/byoburc, | ||
62 | 59 | usr/share/byobu/profiles/Makefile.am: | ||
63 | 60 | - Remove usr/share/byobu/profile/byoburc, since there are no longer | ||
64 | 61 | separate ".screenrc" and ".byoburc" configurations and it is | ||
65 | 62 | exactly the same as usr/share/byobu/profile/screenrc | ||
66 | 63 | * usr/bin/byobu-janitor.in: | ||
67 | 64 | - Remove unused variables | ||
68 | 65 | * usr/bin/byobu-status-detail.in: | ||
69 | 66 | - Use $BYOBU_TEST | ||
70 | 67 | * usr/bin/byobu-status-detail.in, | ||
71 | 68 | usr/bin/byobu-status.in: | ||
72 | 69 | - Remove unnecessary backticks; the command returns no output, only | ||
73 | 70 | the exit value is tested | ||
74 | 71 | * usr/bin/byobu-status.in: | ||
75 | 72 | - Include $BYOBU_CONFIG_DIR/datetime.tmux in the sourcing for loop | ||
76 | 73 | * usr/bin/byobu-status.in, | ||
77 | 74 | usr/lib/byobu/include/common, | ||
78 | 75 | usr/lib/byobu/include/dirs.in: | ||
79 | 76 | - Remove unnecessary directory existence test before "mkdir -p" | ||
80 | 77 | * usr/bin/byobu-select-profile.in: | ||
81 | 78 | - Update help message | ||
82 | 79 | - Remove $BYOBU_CONFIG_DIR/profile test, it is not used directly in | ||
83 | 80 | the script | ||
84 | 81 | - Restore list colors functionality | ||
85 | 82 | - Use local variables in functions | ||
86 | 83 | - Simplify color calculation | ||
87 | 84 | - Exit when --list / --help / invalid options are specified, before | ||
88 | 85 | making changes | ||
89 | 86 | - Removed -- option, command utilities that have a -- option expect | ||
90 | 87 | data to come after the -- | ||
91 | 88 | * usr/lib/byobu/include/constants: | ||
92 | 89 | - Remove sourcing of files looking for $BYOBU_BACKEND, this is | ||
93 | 90 | already done in usr/lib/byobu/include/common | ||
94 | 91 | * usr/lib/byobu/include/dirs.in: | ||
95 | 92 | - Use BYOBU_CONFIG_DIR or XDG_CONFIG_HOME even if they do not exist | ||
96 | 93 | - Create new config dir in ~/.config, if it exists | ||
97 | 94 | - Use XDG_CACHE_HOME even if it does not exist | ||
98 | 95 | * usr/lib/byobu/users: | ||
99 | 96 | - Fix trailing '#' sign for screen | ||
100 | 97 | * usr/share/byobu/profiles/screenrc, | ||
101 | 98 | usr/share/byobu/profiles/tmuxrc: | ||
102 | 99 | - Fix header comment | ||
103 | 100 | |||
104 | 5 | -- Dustin Kirkland <kirkland@ubuntu.com> Wed, 12 Jun 2019 18:41:09 -0500 | 101 | -- Dustin Kirkland <kirkland@ubuntu.com> Wed, 12 Jun 2019 18:41:09 -0500 |
105 | 6 | 102 | ||
106 | 7 | byobu (5.129-0ubuntu1) eoan; urgency=medium | 103 | byobu (5.129-0ubuntu1) eoan; urgency=medium |
107 | 8 | 104 | ||
108 | === modified file 'usr/bin/byobu-ctrl-a.in' | |||
109 | --- usr/bin/byobu-ctrl-a.in 2017-08-15 06:51:04 +0000 | |||
110 | +++ usr/bin/byobu-ctrl-a.in 2019-06-17 20:09:21 +0000 | |||
111 | @@ -17,11 +17,11 @@ | |||
112 | 17 | # You should have received a copy of the GNU General Public License | 17 | # You should have received a copy of the GNU General Public License |
113 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
114 | 19 | 19 | ||
116 | 20 | Usage() { | 20 | usage() { |
117 | 21 | cat <<EOF | 21 | cat <<EOF |
118 | 22 | Usage: ${0##*/} [mode] | 22 | Usage: ${0##*/} [mode] |
121 | 23 | mode is one of 'screen' or 'emacs' | 23 | mode is one of 'screen' or 'emacs' |
122 | 24 | if not specified, prompt the user | 24 | if not specified, prompt the user |
123 | 25 | EOF | 25 | EOF |
124 | 26 | } | 26 | } |
125 | 27 | 27 | ||
126 | @@ -30,47 +30,119 @@ | |||
127 | 30 | [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX | 30 | [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX |
128 | 31 | . "${BYOBU_PREFIX}/lib/${PKG}/include/common" | 31 | . "${BYOBU_PREFIX}/lib/${PKG}/include/common" |
129 | 32 | 32 | ||
131 | 33 | bind_to="" | 33 | bind_to= |
132 | 34 | is_autorun= | ||
133 | 35 | is_autorun_disabled= | ||
134 | 34 | keybindings="$BYOBU_CONFIG_DIR/keybindings" | 36 | keybindings="$BYOBU_CONFIG_DIR/keybindings" |
135 | 35 | [ "$BYOBU_BACKEND" = "tmux" ] && keybindings="$keybindings.tmux" | 37 | [ "$BYOBU_BACKEND" = "tmux" ] && keybindings="$keybindings.tmux" |
136 | 36 | touch "$keybindings" | 38 | touch "$keybindings" |
137 | 37 | 39 | ||
138 | 40 | # may not work if a custom key was selected before (with ^${KEY} unbound) | ||
139 | 41 | case $BYOBU_BACKEND in | ||
140 | 42 | screen) s='^bindkey "\^A"' ;; | ||
141 | 43 | tmux) s="^unbind-key -n C-a" ;; | ||
142 | 44 | esac | ||
143 | 45 | if grep -qs "$s" "$keybindings"; then | ||
144 | 46 | is_autorun_disabled=1 | ||
145 | 47 | fi | ||
146 | 48 | |||
147 | 49 | # unbind ^A and not ^${KEY} because it is ^A in f-keys.screen / f-keys.tmux | ||
148 | 50 | disable_autorun() { | ||
149 | 51 | local binding | ||
150 | 52 | case $BYOBU_BACKEND in | ||
151 | 53 | screen) binding='bindkey "^A"' ;; | ||
152 | 54 | tmux) binding="unbind-key -n C-a" ;; | ||
153 | 55 | esac | ||
154 | 56 | echo "$binding" >> "$keybindings" | ||
155 | 57 | } | ||
156 | 58 | |||
157 | 59 | clear_mode_bindings() { | ||
158 | 60 | case $BYOBU_BACKEND in | ||
159 | 61 | screen) | ||
160 | 62 | $BYOBU_SED_INLINE -e "/^register x /d" -e "/^escape /d" "$keybindings" | ||
161 | 63 | ;; | ||
162 | 64 | tmux) | ||
163 | 65 | $BYOBU_SED_INLINE -e "/^set -g prefix/d" -e "/ send-prefix/d" "$keybindings" | ||
164 | 66 | ;; | ||
165 | 67 | esac | ||
166 | 68 | } | ||
167 | 69 | |||
168 | 70 | set_emacs_mode_bindings() { | ||
169 | 71 | case $BYOBU_BACKEND in | ||
170 | 72 | screen) | ||
171 | 73 | : | ||
172 | 74 | ;; | ||
173 | 75 | tmux) | ||
174 | 76 | echo "set -g prefix F12" >> "$keybindings" | ||
175 | 77 | ;; | ||
176 | 78 | esac | ||
177 | 79 | } | ||
178 | 80 | |||
179 | 81 | set_screen_mode_bindings() { | ||
180 | 82 | case $BYOBU_BACKEND in | ||
181 | 83 | screen) | ||
182 | 84 | echo "escape \"^$KEY$key\"" >> "$keybindings" | ||
183 | 85 | echo "register x \"^$KEY\"" >> "$keybindings" | ||
184 | 86 | ;; | ||
185 | 87 | tmux) | ||
186 | 88 | if $BYOBU_BACKEND -V | grep " 1.5"; then | ||
187 | 89 | # tmux 1.5 supports a list of prefixes | ||
188 | 90 | echo "set -g prefix ^$KEY,F12" >> "$keybindings" | ||
189 | 91 | else | ||
190 | 92 | # tmux 1.6 and above supports prefix and prefix2 | ||
191 | 93 | echo "set -g prefix ^$KEY" >> "$keybindings" | ||
192 | 94 | echo "set -g prefix2 F12" >> "$keybindings" | ||
193 | 95 | fi | ||
194 | 96 | echo "bind $key send-prefix" >> "$keybindings" | ||
195 | 97 | ;; | ||
196 | 98 | esac | ||
197 | 99 | } | ||
198 | 100 | |||
199 | 101 | reload_profile() { | ||
200 | 102 | case $BYOBU_BACKEND in | ||
201 | 103 | screen) | ||
202 | 104 | $BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile" | ||
203 | 105 | ;; | ||
204 | 106 | tmux) | ||
205 | 107 | $BYOBU_BACKEND source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc" 2>/dev/null | ||
206 | 108 | ;; | ||
207 | 109 | esac | ||
208 | 110 | } | ||
209 | 111 | |||
210 | 38 | # If the user has already chosen an escape sequence, then | 112 | # If the user has already chosen an escape sequence, then |
230 | 39 | # presumably they want ctrl-a to operate in emacs mode | 113 | # presumably they just want to disable autorun |
231 | 40 | case "$BYOBU_BACKEND" in | 114 | if [ -z "$is_autorun_disabled" ]; then |
232 | 41 | "screen") | 115 | case $BYOBU_BACKEND in |
233 | 42 | if grep -qs "^escape" "$keybindings"; then | 116 | screen) |
234 | 43 | # Check for escape definition in local keybindings config | 117 | if grep -qs "^escape" "$keybindings"; then |
235 | 44 | bind_to="emacs" | 118 | # Check for escape definition in local keybindings config |
236 | 45 | fi | 119 | bind_to=custom |
237 | 46 | ;; | 120 | fi |
238 | 47 | "tmux") | 121 | ;; |
239 | 48 | if grep -qs "^set -g prefix" "$keybindings"e; then | 122 | tmux) |
240 | 49 | # Check for escape definition in local keybindings config | 123 | if grep -qs "^set -g prefix" "$keybindings"; then |
241 | 50 | bind_to="emacs" | 124 | # Check for escape definition in local keybindings config |
242 | 51 | fi | 125 | bind_to=custom |
243 | 52 | # Check for some other escape sequence in tmux keys | 126 | fi |
244 | 53 | if $BYOBU_BACKEND list-keys 2>/dev/null | grep -qs "^bind-key\s\+[^a]\s\+send-prefix"; then | 127 | # Check for some other escape sequence in tmux keys |
245 | 54 | bind_to="emacs" | 128 | if $BYOBU_BACKEND list-keys 2>/dev/null | grep "\ssend-prefix$" | grep -vqs "\sa\s\+send-prefix$"; then |
246 | 55 | fi | 129 | bind_to=custom |
247 | 56 | ;; | 130 | fi |
248 | 57 | esac | 131 | ;; |
249 | 132 | esac | ||
250 | 133 | fi | ||
251 | 58 | 134 | ||
256 | 59 | case "${1}" in | 135 | case $1 in |
257 | 60 | -h|--help) Usage; exit 0;; | 136 | -h|--help) usage; exit 0 ;; |
258 | 61 | screen) bind_to="screen";; | 137 | screen) bind_to=screen ;; |
259 | 62 | emacs) bind_to="emacs";; | 138 | emacs) bind_to=emacs ;; |
260 | 139 | autorun) is_autorun=1 ;; | ||
261 | 63 | "") :;; | 140 | "") :;; |
263 | 64 | *) { Usage printf "%s\n" "Bad argument $1"; } 1>&2; exit 1;; | 141 | *) { usage; printf "%s\n" "Bad argument: $1"; } 1>&2; exit 1;; |
264 | 65 | esac | 142 | esac |
265 | 66 | 143 | ||
273 | 67 | if [ "${2}" ]; then | 144 | KEY=$(printf "${2:-A}" | $BYOBU_SED 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/') |
274 | 68 | KEY=$(printf "$2" | $BYOBU_SED 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/') | 145 | key=$(printf "$KEY" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/') |
268 | 69 | key=$(printf "$2" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/') | ||
269 | 70 | else | ||
270 | 71 | KEY="A" | ||
271 | 72 | key="a" | ||
272 | 73 | fi | ||
275 | 74 | 146 | ||
276 | 75 | while [ -z "$bind_to" ]; do | 147 | while [ -z "$bind_to" ]; do |
277 | 76 | echo | 148 | echo |
278 | @@ -79,72 +151,73 @@ | |||
279 | 79 | echo "When you press ctrl-a in Byobu, do you want it to operate in:" | 151 | echo "When you press ctrl-a in Byobu, do you want it to operate in:" |
280 | 80 | echo " (1) Screen mode (GNU Screen's default escape sequence)" | 152 | echo " (1) Screen mode (GNU Screen's default escape sequence)" |
281 | 81 | echo " (2) Emacs mode (go to beginning of line)" | 153 | echo " (2) Emacs mode (go to beginning of line)" |
282 | 154 | if [ -z "$is_autorun_disabled" ]; then | ||
283 | 155 | echo " (M) Manual (I will configure this manually, don't ask me anymore)" | ||
284 | 156 | echo " (Q) Quit (ask me again later)" | ||
285 | 157 | else | ||
286 | 158 | echo " (Q) Quit (no change)" | ||
287 | 159 | fi | ||
288 | 82 | echo | 160 | echo |
289 | 83 | echo "Note that:" | 161 | echo "Note that:" |
290 | 84 | echo " - F12 also operates as an escape in Byobu" | 162 | echo " - F12 also operates as an escape in Byobu" |
291 | 85 | echo " - You can press F9 and choose your escape character" | 163 | echo " - You can press F9 and choose your escape character" |
292 | 86 | echo " - You can run 'byobu-ctrl-a' at any time to change your selection" | 164 | echo " - You can run 'byobu-ctrl-a' at any time to change your selection" |
293 | 87 | echo | 165 | echo |
295 | 88 | printf "Select [1 or 2]: " | 166 | if [ -z "$is_autorun_disabled" ]; then |
296 | 167 | printf "Select [1 / 2 / M / Q]: " | ||
297 | 168 | else | ||
298 | 169 | printf "Select [1 / 2 / Q]: " | ||
299 | 170 | fi | ||
300 | 89 | s=$(head -n1) | 171 | s=$(head -n1) |
301 | 90 | echo | 172 | echo |
302 | 91 | case "$s" in | 173 | case "$s" in |
303 | 92 | 1) bind_to="screen"; break;; | 174 | 1) bind_to="screen"; break;; |
304 | 93 | 2) bind_to="emacs"; break;; | 175 | 2) bind_to="emacs"; break;; |
305 | 176 | q|Q) break;; | ||
306 | 177 | m|M) | ||
307 | 178 | if [ -z "$is_autorun_disabled" ]; then | ||
308 | 179 | bind_to="manual" | ||
309 | 180 | break | ||
310 | 181 | fi | ||
311 | 182 | ;; | ||
312 | 94 | esac | 183 | esac |
313 | 95 | done | 184 | done |
314 | 96 | 185 | ||
315 | 97 | case "$bind_to" in | 186 | case "$bind_to" in |
316 | 187 | custom) | ||
317 | 188 | disable_autorun | ||
318 | 189 | reload_profile | ||
319 | 190 | echo "INFO: custom settings were found, no change to ctrl-a was made" | ||
320 | 191 | ;; | ||
321 | 192 | manual) | ||
322 | 193 | disable_autorun | ||
323 | 194 | reload_profile | ||
324 | 195 | echo "INFO: ctrl-a will no longer cause this prompt to appear" | ||
325 | 196 | ;; | ||
326 | 98 | emacs) | 197 | emacs) |
340 | 99 | case "$BYOBU_BACKEND" in | 198 | [ -n "$is_autorun_disabled" ] || disable_autorun |
341 | 100 | screen) | 199 | clear_mode_bindings |
342 | 101 | $BYOBU_SED_INLINE -e "/^register x /d" -e "/^bindkey /d" -e "/^escape /d" "$keybindings" | 200 | set_emacs_mode_bindings |
343 | 102 | echo "bindkey \"^${KEY}\"" >> "$keybindings" | 201 | reload_profile |
331 | 103 | $BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile" | ||
332 | 104 | ;; | ||
333 | 105 | tmux) | ||
334 | 106 | $BYOBU_SED_INLINE -e "/^set -g prefix/d" -e "/ send-prefix/d" -e "/^unbind-key -n C-${key}/d" "$keybindings" | ||
335 | 107 | echo "set -g prefix F12" >> "$keybindings" | ||
336 | 108 | echo "unbind-key -n C-${key}" >> "$keybindings" | ||
337 | 109 | $BYOBU_BACKEND source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc" 2>/dev/null | ||
338 | 110 | ;; | ||
339 | 111 | esac | ||
344 | 112 | echo "INFO: ctrl-a will now operate in emacs mode" | 202 | echo "INFO: ctrl-a will now operate in emacs mode" |
345 | 113 | ;; | 203 | ;; |
346 | 114 | screen) | 204 | screen) |
370 | 115 | case "$BYOBU_BACKEND" in | 205 | [ -n "$is_autorun_disabled" ] || disable_autorun |
371 | 116 | screen) | 206 | clear_mode_bindings |
372 | 117 | $BYOBU_SED_INLINE -e "/^register x /d" -e "/^bindkey \"^\"/d" -e "/^escape /d" "$keybindings" | 207 | set_screen_mode_bindings |
373 | 118 | echo "bindkey \"^${KEY}\"" >> "$keybindings" | 208 | reload_profile |
351 | 119 | echo "escape \"^${KEY}${key}\"" >> "$keybindings" | ||
352 | 120 | echo "register x \"^${KEY}\"" >> "$keybindings" | ||
353 | 121 | $BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile" | ||
354 | 122 | ;; | ||
355 | 123 | tmux) | ||
356 | 124 | $BYOBU_SED_INLINE -e "/^set -g prefix/d" -e "/ send-prefix/d" -e "/^unbind-key -n C-${key}/d" "$keybindings" | ||
357 | 125 | echo "unbind-key -n C-${key}" >> "$keybindings" | ||
358 | 126 | if $BYOBU_BACKEND -V | grep " 1.5"; then | ||
359 | 127 | # tmux 1.5 supports a list of prefixes | ||
360 | 128 | echo "set -g prefix ^${KEY},F12" >> "$keybindings" | ||
361 | 129 | else | ||
362 | 130 | # tmux 1.6 and above supports prefix and prefix2 | ||
363 | 131 | echo "set -g prefix ^${KEY}" >> "$keybindings" | ||
364 | 132 | echo "set -g prefix2 F12" >> "$keybindings" | ||
365 | 133 | fi | ||
366 | 134 | echo "bind ${key} send-prefix" >> "$keybindings" | ||
367 | 135 | $BYOBU_BACKEND source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc" 2>/dev/null | ||
368 | 136 | ;; | ||
369 | 137 | esac | ||
374 | 138 | echo "INFO: ctrl-a will now operate in GNU Screen mode" | 209 | echo "INFO: ctrl-a will now operate in GNU Screen mode" |
375 | 139 | ;; | 210 | ;; |
376 | 140 | *) | ||
377 | 141 | echo "Error: bad value for binding: $bind_to" | ||
378 | 142 | ;; | ||
379 | 143 | esac | 211 | esac |
380 | 144 | 212 | ||
382 | 145 | if [ -z "${2}" ]; then | 213 | if [ "$bind_to" != manual ]; then |
383 | 146 | echo "To modify this behavior again later, run 'byobu-ctrl-a'" | 214 | echo "To modify this behavior again later, run 'byobu-ctrl-a'" |
384 | 147 | echo | 215 | echo |
385 | 148 | fi | 216 | fi |
386 | 149 | 217 | ||
387 | 218 | if [ -n "$is_autorun" ]; then | ||
388 | 219 | echo "Press enter/return to close this window..." | ||
389 | 220 | s=$(head -n1) | ||
390 | 221 | fi | ||
391 | 222 | |||
392 | 150 | # vi: syntax=sh ts=4 noexpandtab | 223 | # vi: syntax=sh ts=4 noexpandtab |
393 | 151 | 224 | ||
394 | === modified file 'usr/bin/byobu-export.in' | |||
395 | --- usr/bin/byobu-export.in 2019-05-26 19:18:53 +0000 | |||
396 | +++ usr/bin/byobu-export.in 2019-06-17 20:09:21 +0000 | |||
397 | @@ -22,7 +22,7 @@ | |||
398 | 22 | [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX | 22 | [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX |
399 | 23 | . "${BYOBU_PREFIX}/lib/${PKG}/include/common" | 23 | . "${BYOBU_PREFIX}/lib/${PKG}/include/common" |
400 | 24 | 24 | ||
402 | 25 | if eval $BYOBU_TEST gettext >/dev/null 2>&1; then | 25 | if byobu_test gettext; then |
403 | 26 | command=gettext | 26 | command=gettext |
404 | 27 | else | 27 | else |
405 | 28 | command=echo | 28 | command=echo |
406 | 29 | 29 | ||
407 | === modified file 'usr/bin/byobu-janitor.in' | |||
408 | --- usr/bin/byobu-janitor.in 2019-05-26 19:18:06 +0000 | |||
409 | +++ usr/bin/byobu-janitor.in 2019-06-17 20:09:21 +0000 | |||
410 | @@ -36,13 +36,9 @@ | |||
411 | 36 | exit 0 | 36 | exit 0 |
412 | 37 | fi | 37 | fi |
413 | 38 | 38 | ||
414 | 39 | # Set the rest of the variables | ||
415 | 40 | DEFAULT_PROFILE="light" | ||
416 | 41 | PROFILE="$BYOBU_CONFIG_DIR/profile" | ||
417 | 42 | |||
418 | 43 | # Create byobu-exchange buffer file, with secure permissions, if it doesn't exist | 39 | # Create byobu-exchange buffer file, with secure permissions, if it doesn't exist |
419 | 44 | if ! [ -e "$BYOBU_RUN_DIR/printscreen" ]; then | 40 | if ! [ -e "$BYOBU_RUN_DIR/printscreen" ]; then |
421 | 45 | if eval $BYOBU_TEST install >/dev/null 2>&1; then | 41 | if byobu_test install; then |
422 | 46 | install -m 600 /dev/null "$BYOBU_RUN_DIR/printscreen" | 42 | install -m 600 /dev/null "$BYOBU_RUN_DIR/printscreen" |
423 | 47 | else | 43 | else |
424 | 48 | cp /dev/null "$BYOBU_RUN_DIR/printscreen" | 44 | cp /dev/null "$BYOBU_RUN_DIR/printscreen" |
425 | @@ -121,11 +117,11 @@ | |||
426 | 121 | # Affects: Upgrades from <= byobu 5.50, install byobu prompt if using stock bashrc | 117 | # Affects: Upgrades from <= byobu 5.50, install byobu prompt if using stock bashrc |
427 | 122 | if [ -r /etc/skel/.bashrc ] && [ -r "$HOME/.bashrc" ] && [ -w "$HOME/.bashrc" ] && \ | 118 | if [ -r /etc/skel/.bashrc ] && [ -r "$HOME/.bashrc" ] && [ -w "$HOME/.bashrc" ] && \ |
428 | 123 | ! (grep -qs "#byobu-prompt#$" "$HOME/.bashrc") && ! [ -e "$BYOBU_CONFIG_DIR/prompt" ]; then | 119 | ! (grep -qs "#byobu-prompt#$" "$HOME/.bashrc") && ! [ -e "$BYOBU_CONFIG_DIR/prompt" ]; then |
430 | 124 | if eval $BYOBU_TEST diff >/dev/null 2>&1; then | 120 | if byobu_test diff; then |
431 | 125 | if diff /etc/skel/.bashrc "$HOME/.bashrc" >/dev/null 2>&1; then | 121 | if diff /etc/skel/.bashrc "$HOME/.bashrc" >/dev/null 2>&1; then |
432 | 126 | printf "[ -r $BYOBU_CONFIG_DIR/prompt ] && . $BYOBU_CONFIG_DIR/prompt #byobu-prompt#\n" >> "$HOME/.bashrc" | 122 | printf "[ -r $BYOBU_CONFIG_DIR/prompt ] && . $BYOBU_CONFIG_DIR/prompt #byobu-prompt#\n" >> "$HOME/.bashrc" |
433 | 127 | fi | 123 | fi |
435 | 128 | elif eval $BYOBU_TEST md5sum >/dev/null 2>&1; then | 124 | elif byobu_test md5sum; then |
436 | 129 | if [ "$(cat /etc/skel/.bashrc | md5sum)" = "$(cat $HOME/.bashrc | md5sum)" ]; then | 125 | if [ "$(cat /etc/skel/.bashrc | md5sum)" = "$(cat $HOME/.bashrc | md5sum)" ]; then |
437 | 130 | printf "[ -r $BYOBU_CONFIG_DIR/prompt ] && . $BYOBU_CONFIG_DIR/prompt #byobu-prompt#\n" >> "$HOME/.bashrc" | 126 | printf "[ -r $BYOBU_CONFIG_DIR/prompt ] && . $BYOBU_CONFIG_DIR/prompt #byobu-prompt#\n" >> "$HOME/.bashrc" |
438 | 131 | fi | 127 | fi |
439 | @@ -136,4 +132,14 @@ | |||
440 | 136 | # Affects: Upgrades from <= byobu 5.126, clear out ec2/rcs cost statuses | 132 | # Affects: Upgrades from <= byobu 5.126, clear out ec2/rcs cost statuses |
441 | 137 | rm -f "$BYOBU_RUN_DIR"/cache.tmux/ec2_cost* "$BYOBU_RUN_DIR"/cache.tmux/rcs_cost* "$BYOBU_RUN_DIR"/status.tmux/ec2_cost* "$BYOBU_RUN_DIR"/status.tmux/rcs_cost* | 133 | rm -f "$BYOBU_RUN_DIR"/cache.tmux/ec2_cost* "$BYOBU_RUN_DIR"/cache.tmux/rcs_cost* "$BYOBU_RUN_DIR"/status.tmux/ec2_cost* "$BYOBU_RUN_DIR"/status.tmux/rcs_cost* |
442 | 138 | 134 | ||
443 | 135 | # Affects: Upgrades from <= byobu 5.129, fix unbinding of ctrl-a binding (autorun byobu-ctrl-a) | ||
444 | 136 | if grep '^bindkey "\^."$' "$BYOBU_CONFIG_DIR/keybindings" | grep -vqs '^bindkey "\^A"$'; then | ||
445 | 137 | $BYOBU_SED_INLINE -e '/^bindkey "\^."$/d' "$BYOBU_CONFIG_DIR/keybindings" | ||
446 | 138 | echo 'bindkey "^A"' >> "$BYOBU_CONFIG_DIR/keybindings" | ||
447 | 139 | fi | ||
448 | 140 | if grep "^unbind-key -n C-.$" "$BYOBU_CONFIG_DIR/keybindings.tmux" | grep -vqs "^unbind-key -n C-a$"; then | ||
449 | 141 | $BYOBU_SED_INLINE -e "/^unbind-key -n C-.$/d" "$BYOBU_CONFIG_DIR/keybindings.tmux" | ||
450 | 142 | echo "unbind-key -n C-a" >> "$BYOBU_CONFIG_DIR/keybindings.tmux" | ||
451 | 143 | fi | ||
452 | 144 | |||
453 | 139 | # vi: syntax=sh ts=4 noexpandtab | 145 | # vi: syntax=sh ts=4 noexpandtab |
454 | 140 | 146 | ||
455 | === modified file 'usr/bin/byobu-launch.in' | |||
456 | --- usr/bin/byobu-launch.in 2019-05-26 19:17:42 +0000 | |||
457 | +++ usr/bin/byobu-launch.in 2019-06-17 20:09:21 +0000 | |||
458 | @@ -51,7 +51,7 @@ | |||
459 | 51 | *i*) | 51 | *i*) |
460 | 52 | # Attempt to merge shell history across sessions/windows (works with some exceptions) | 52 | # Attempt to merge shell history across sessions/windows (works with some exceptions) |
461 | 53 | for i in shopt setopt; do | 53 | for i in shopt setopt; do |
463 | 54 | if eval $BYOBU_TEST $i >/dev/null; then | 54 | if byobu_test $i; then |
464 | 55 | case $i in | 55 | case $i in |
465 | 56 | shopt) $i -s histappend || true ;; | 56 | shopt) $i -s histappend || true ;; |
466 | 57 | setopt) $i appendhistory || true ;; | 57 | setopt) $i appendhistory || true ;; |
467 | 58 | 58 | ||
468 | === modified file 'usr/bin/byobu-select-profile.in' | |||
469 | --- usr/bin/byobu-select-profile.in 2018-08-12 14:43:52 +0000 | |||
470 | +++ usr/bin/byobu-select-profile.in 2019-06-17 20:09:21 +0000 | |||
471 | @@ -51,47 +51,51 @@ | |||
472 | 51 | 51 | ||
473 | 52 | # Find a hash utility | 52 | # Find a hash utility |
474 | 53 | for i in md5sum md5 sha512sum sha256sum sha1sum shasum shasum5.12 shasum5.10; do | 53 | for i in md5sum md5 sha512sum sha256sum sha1sum shasum shasum5.12 shasum5.10; do |
476 | 54 | if eval $BYOBU_TEST $i >/dev/null 2>&1; then | 54 | if byobu_test $i; then |
477 | 55 | HASH="$i" | 55 | HASH="$i" |
478 | 56 | break | 56 | break |
479 | 57 | fi | 57 | fi |
480 | 58 | done | 58 | done |
481 | 59 | 59 | ||
482 | 60 | usage () { | 60 | usage () { |
486 | 61 | cat <<EOT | 61 | cat <<EOF |
487 | 62 | Usage: $0 [OPTION] | 62 | Usage: ${0##*/} [OPTION] |
488 | 63 | -l,--list list available profiles | 63 | screen options: |
489 | 64 | -l,--list list available colors | ||
490 | 64 | -b,--background COLOR set the background color | 65 | -b,--background COLOR set the background color |
491 | 65 | -f,--foreground COLOR set the foreground color | 66 | -f,--foreground COLOR set the foreground color |
493 | 66 | -h,--hostnmae set the colors based on a hash of the hostname | 67 | |
494 | 68 | tmux options: | ||
495 | 69 | -h,--hostname set the colors based on a hash of the hostname | ||
496 | 67 | -i,--ip set the colors based on a hash of the ip | 70 | -i,--ip set the colors based on a hash of the ip |
497 | 68 | -r,--random set the colors randomly | 71 | -r,--random set the colors randomly |
498 | 72 | |||
499 | 73 | Other options: | ||
500 | 69 | --help this help | 74 | --help this help |
502 | 70 | EOT | 75 | |
503 | 76 | If multiple tmux options are specified, only the first one will | ||
504 | 77 | take effect. | ||
505 | 78 | EOF | ||
506 | 71 | } | 79 | } |
507 | 72 | 80 | ||
508 | 73 | # Initialize variables | 81 | # Initialize variables |
509 | 74 | FILE="$BYOBU_CONFIG_DIR/color" | 82 | FILE="$BYOBU_CONFIG_DIR/color" |
510 | 75 | PROFILE="$BYOBU_CONFIG_DIR/profile" | ||
511 | 76 | [ -r "$PROFILE" ] || ln -sf $BYOBU_PREFIX/share/$PKG/profiles/common "$PROFILE" | ||
512 | 77 | selected=-1 | ||
513 | 78 | color= | ||
514 | 79 | 83 | ||
517 | 80 | listprofiles() { | 84 | listcolors() { |
518 | 81 | # Display list of profiles, one per line | 85 | local x |
519 | 86 | # Display list of colors, one per line | ||
520 | 82 | for x in $COLORS; do | 87 | for x in $COLORS; do |
521 | 83 | echo "$x" | 88 | echo "$x" |
522 | 84 | done | 89 | done |
523 | 85 | } | 90 | } |
524 | 86 | 91 | ||
525 | 87 | getletter() { | 92 | getletter() { |
528 | 88 | count=$(echo "$1" | wc -c) | 93 | local letter |
529 | 89 | if [ "$count" = "2" ]; then | 94 | if [ "${#1}" -eq 1 ]; then |
530 | 90 | echo "$1" | 95 | echo "$1" |
531 | 91 | return | 96 | return |
532 | 92 | fi | 97 | fi |
535 | 93 | color="$1" | 98 | case $1 in |
534 | 94 | case $color in | ||
536 | 95 | default_light) letter="d";; | 99 | default_light) letter="d";; |
537 | 96 | default_dark) letter="D";; | 100 | default_dark) letter="D";; |
538 | 97 | black) letter="k";; | 101 | black) letter="k";; |
539 | @@ -117,8 +121,9 @@ | |||
540 | 117 | } | 121 | } |
541 | 118 | 122 | ||
542 | 119 | setcolor_screen() { | 123 | setcolor_screen() { |
545 | 120 | which="$1" | 124 | local which="$1" |
546 | 121 | color="$2" | 125 | local color="$2" |
547 | 126 | local FOREGROUND BACKGROUND MONOCHROME | ||
548 | 122 | [ -r $FILE ] && . $FILE | 127 | [ -r $FILE ] && . $FILE |
549 | 123 | if [ "$which" = "foreground" ]; then | 128 | if [ "$which" = "foreground" ]; then |
550 | 124 | FOREGROUND=$(getletter "$color") | 129 | FOREGROUND=$(getletter "$color") |
551 | @@ -126,20 +131,20 @@ | |||
552 | 126 | BACKGROUND=$(getletter "$color") | 131 | BACKGROUND=$(getletter "$color") |
553 | 127 | fi | 132 | fi |
554 | 128 | [ "$MONOCHROME" = "1" ] || MONOCHROME=0 | 133 | [ "$MONOCHROME" = "1" ] || MONOCHROME=0 |
556 | 129 | printf "FOREGROUND=$FOREGROUND\nBACKGROUND=$BACKGROUND\nMONOCHROME=$MONOCHROME" > $FILE | 134 | printf "FOREGROUND=$FOREGROUND\nBACKGROUND=$BACKGROUND\nMONOCHROME=$MONOCHROME\n" > $FILE |
557 | 130 | touch "$BYOBU_RUN_DIR/reload-required" | 135 | touch "$BYOBU_RUN_DIR/reload-required" |
559 | 131 | $BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile" | 136 | screen -X at 0 source "$BYOBU_CONFIG_DIR/profile" |
560 | 132 | } | 137 | } |
561 | 133 | 138 | ||
562 | 134 | get_contrast() { | 139 | get_contrast() { |
563 | 135 | # See section 2.2: http://www.w3.org/TR/AERT#color-contrast | 140 | # See section 2.2: http://www.w3.org/TR/AERT#color-contrast |
564 | 136 | local awk="awk" | ||
565 | 137 | if eval $BYOBU_TEST gawk >/dev/null 2>&1; then | ||
566 | 138 | awk="gawk" | ||
567 | 139 | fi | ||
568 | 140 | local hex="$(echo "$1" | sed -e "s/\(..\)\(..\)\(..\)/\1 \2 \3/")" | 141 | local hex="$(echo "$1" | sed -e "s/\(..\)\(..\)\(..\)/\1 \2 \3/")" |
571 | 141 | local bright=$(echo $hex | $awk --non-decimal-data '{printf "%0.0f",(("0x"$1)*299+("0x"$2)*587+("0x"$3)*114)/1000}') | 142 | local dec h |
572 | 142 | if [ $bright -ge 130 ]; then | 143 | for h in $hex; do |
573 | 144 | dec="$dec $((0x$h))" | ||
574 | 145 | done | ||
575 | 146 | local bright=$(echo $dec | awk '{printf "%0.0f",(($1*299)+($2*587)+($3*114))/1000}') | ||
576 | 147 | if [ "$bright" -ge 130 ]; then | ||
577 | 143 | _RET="black" | 148 | _RET="black" |
578 | 144 | else | 149 | else |
579 | 145 | _RET="white" | 150 | _RET="white" |
580 | @@ -150,61 +155,83 @@ | |||
581 | 150 | if [ "$BYOBU_BACKEND" != "tmux" ]; then | 155 | if [ "$BYOBU_BACKEND" != "tmux" ]; then |
582 | 151 | echo "WARNING: This functionality is only supported in Byobu with the tmux backend" 1>&2 | 156 | echo "WARNING: This functionality is only supported in Byobu with the tmux backend" 1>&2 |
583 | 152 | fi | 157 | fi |
585 | 153 | dark="$1" | 158 | local dark="$1" |
586 | 154 | get_contrast "$dark" | 159 | get_contrast "$dark" |
592 | 155 | light="$_RET" | 160 | local light="$_RET" |
593 | 156 | accent="magenta" | 161 | local accent="magenta" |
594 | 157 | highlight="red" | 162 | local highlight="red" |
595 | 158 | monochrome="0" | 163 | local monochrome="0" |
596 | 159 | printf "BYOBU_DARK=\"$dark\"\nBYOBU_LIGHT=$light\nBYOBU_ACCENT=$accent\nBYOBU_HIGHLIGHT=$highlight\nMONOCHROME=$MONOCHROME" > "$FILE".tmux | 164 | printf "BYOBU_DARK=\"#$dark\"\nBYOBU_LIGHT=$light\nBYOBU_ACCENT=$accent\nBYOBU_HIGHLIGHT=$highlight\nMONOCHROME=$monochrome\n" > "$FILE".tmux |
597 | 160 | tmux source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc" | 165 | tmux source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc" |
598 | 161 | } | 166 | } |
599 | 162 | 167 | ||
600 | 163 | if [ $# -eq 0 ]; then | 168 | if [ $# -eq 0 ]; then |
601 | 164 | usage | 169 | usage |
645 | 165 | else | 170 | exit 0 |
646 | 166 | while true; do | 171 | fi |
647 | 167 | case "$1" in | 172 | |
648 | 168 | -b|--background) | 173 | # Check options first, exit early if necessary |
649 | 169 | setcolor_screen "background" "$2" | 174 | for opt in "$@"; do |
650 | 170 | shift 2 | 175 | if [ -n "$ignore_next" ]; then |
651 | 171 | ;; | 176 | ignore_next= |
652 | 172 | -f|--foreground) | 177 | continue |
653 | 173 | setcolor_screen "foreground" "$2" | 178 | fi |
654 | 174 | shift 2 | 179 | case $opt in |
655 | 175 | ;; | 180 | -l|--list) listcolors; exit 0 ;; |
656 | 176 | -h|--hostname) | 181 | -b|--background) ignore_next=1 ;; |
657 | 177 | color=$(hostname | $HASH | head -c 6) | 182 | -f|--foreground) ignore_next=1 ;; |
658 | 178 | setcolor_tmux "$color" | 183 | -h|--hostname) : ;; |
659 | 179 | shift | 184 | -i|--ip) : ;; |
660 | 180 | break | 185 | -r|--random) : ;; |
661 | 181 | ;; | 186 | --help) usage; exit 0 ;; |
662 | 182 | -i|--ip) | 187 | *) usage; exit 1 ;; |
663 | 183 | [ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc" | 188 | esac |
664 | 184 | . $BYOBU_PREFIX/lib/$PKG/ip_address | 189 | done |
665 | 185 | color=$(__ip_address t| $HASH | head -c 6) | 190 | |
666 | 186 | setcolor_tmux "$color" | 191 | # Was expecting an argument but it wasn't specified |
667 | 187 | shift | 192 | if [ -n "$ignore_next" ]; then |
668 | 188 | break | 193 | usage |
669 | 189 | ;; | 194 | exit 1 |
670 | 190 | -r|--random) | 195 | fi |
671 | 191 | color=$(head -c 10 /dev/urandom | $HASH | head -c 6) | 196 | |
672 | 192 | setcolor_tmux "\#$color" | 197 | while [ "$#" -gt 0 ]; do |
673 | 193 | shift | 198 | case $1 in |
674 | 194 | break | 199 | -b|--background) |
675 | 195 | ;; | 200 | setcolor_screen "background" "$2" |
676 | 196 | *) | 201 | shift 2 |
677 | 197 | usage | 202 | ;; |
678 | 198 | exit 1 | 203 | -f|--foreground) |
679 | 199 | ;; | 204 | setcolor_screen "foreground" "$2" |
680 | 200 | --) | 205 | shift 2 |
681 | 201 | shift | 206 | ;; |
682 | 202 | break | 207 | -h|--hostname) |
683 | 203 | ;; | 208 | if byobu_test hostname; then |
684 | 204 | esac | 209 | h=$(hostname) |
685 | 205 | [ $# -eq 0 ] && break | 210 | elif [ -r /proc/sys/kernel/hostname ]; then |
686 | 206 | done | 211 | read h < /proc/sys/kernel/hostname |
687 | 207 | fi | 212 | fi |
688 | 213 | color=$(echo "$h" | $HASH | head -c 6) | ||
689 | 214 | setcolor_tmux "$color" | ||
690 | 215 | break | ||
691 | 216 | ;; | ||
692 | 217 | -i|--ip) | ||
693 | 218 | [ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc" | ||
694 | 219 | . $BYOBU_PREFIX/lib/$PKG/ip_address | ||
695 | 220 | color=$(__ip_address t| $HASH | head -c 6) | ||
696 | 221 | setcolor_tmux "$color" | ||
697 | 222 | break | ||
698 | 223 | ;; | ||
699 | 224 | -r|--random) | ||
700 | 225 | color=$(head -c 10 /dev/urandom | $HASH | head -c 6) | ||
701 | 226 | setcolor_tmux "$color" | ||
702 | 227 | break | ||
703 | 228 | ;; | ||
704 | 229 | *) | ||
705 | 230 | usage | ||
706 | 231 | exit 1 | ||
707 | 232 | ;; | ||
708 | 233 | esac | ||
709 | 234 | done | ||
710 | 208 | 235 | ||
711 | 209 | exit 0 | 236 | exit 0 |
712 | 210 | 237 | ||
713 | 211 | 238 | ||
714 | === modified file 'usr/bin/byobu-status-detail.in' | |||
715 | --- usr/bin/byobu-status-detail.in 2016-04-07 22:07:52 +0000 | |||
716 | +++ usr/bin/byobu-status-detail.in 2019-06-17 20:09:21 +0000 | |||
717 | @@ -22,7 +22,7 @@ | |||
718 | 22 | [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX | 22 | [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX |
719 | 23 | . "${BYOBU_PREFIX}/lib/${PKG}/include/common" | 23 | . "${BYOBU_PREFIX}/lib/${PKG}/include/common" |
720 | 24 | 24 | ||
722 | 25 | if which vim >/dev/null && `vim --version | grep -q +folding`; then | 25 | if byobu_test vim && vim --version | grep -q +folding; then |
723 | 26 | byobu-status --detail | vim -c "set foldmethod=indent" -c "set foldminlines=0" -c "set foldnestmax=1" -c "set foldcolumn=2" -R - | 26 | byobu-status --detail | vim -c "set foldmethod=indent" -c "set foldminlines=0" -c "set foldnestmax=1" -c "set foldcolumn=2" -R - |
724 | 27 | else | 27 | else |
725 | 28 | byobu-status --detail | $BYOBU_PAGER | 28 | byobu-status --detail | $BYOBU_PAGER |
726 | 29 | 29 | ||
727 | === modified file 'usr/bin/byobu-status.in' | |||
728 | --- usr/bin/byobu-status.in 2016-09-15 19:25:51 +0000 | |||
729 | +++ usr/bin/byobu-status.in 2019-06-17 20:09:21 +0000 | |||
730 | @@ -26,16 +26,15 @@ | |||
731 | 26 | # Make sure status is not disabled | 26 | # Make sure status is not disabled |
732 | 27 | [ -f "$BYOBU_CONFIG_DIR/status.disable" ] && exit 0 | 27 | [ -f "$BYOBU_CONFIG_DIR/status.disable" ] && exit 0 |
733 | 28 | 28 | ||
737 | 29 | # Clean and create cache directories | 29 | # Create cache directories |
738 | 30 | [ -d "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND" | 30 | mkdir -p "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND" |
739 | 31 | [ -d "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND" | 31 | mkdir -p "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND" |
740 | 32 | 32 | ||
741 | 33 | # Source configurations | 33 | # Source configurations |
742 | 34 | . "${BYOBU_PREFIX}/lib/${PKG}/include/icons" | 34 | . "${BYOBU_PREFIX}/lib/${PKG}/include/icons" |
744 | 35 | for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/status/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc" "$BYOBU_CONFIG_DIR/color" "$BYOBU_CONFIG_DIR/color.tmux"; do | 35 | for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/status/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc" "$BYOBU_CONFIG_DIR/color" "$BYOBU_CONFIG_DIR/color.tmux" "$BYOBU_CONFIG_DIR/datetime.tmux"; do |
745 | 36 | [ -r "$i" ] && . "$i" | 36 | [ -r "$i" ] && . "$i" |
746 | 37 | done | 37 | done |
747 | 38 | [ -r "$BYOBU_CONFIG_DIR/datetime.tmux" ] && . "$BYOBU_CONFIG_DIR/datetime.tmux" | ||
748 | 39 | 38 | ||
749 | 40 | case "$BYOBU_BACKEND" in | 39 | case "$BYOBU_BACKEND" in |
750 | 41 | screen) | 40 | screen) |
751 | @@ -153,11 +152,11 @@ | |||
752 | 153 | ;; | 152 | ;; |
753 | 154 | --detail) | 153 | --detail) |
754 | 155 | VER= | 154 | VER= |
756 | 156 | if eval $BYOBU_TEST dpkg-query >/dev/null; then | 155 | if byobu_test dpkg-query; then |
757 | 157 | VER=$(set -- $(dpkg-query --show $PKG); printf "%s\n" "$2") | 156 | VER=$(set -- $(dpkg-query --show $PKG); printf "%s\n" "$2") |
758 | 158 | fi | 157 | fi |
759 | 159 | printf "$PKG-$VER Detailed Status Navigation\n" | 158 | printf "$PKG-$VER Detailed Status Navigation\n" |
761 | 160 | if eval $BYOBU_TEST vim >/dev/null && `vim --version | grep -q +folding`; then | 159 | if byobu_test vim && vim --version | grep -q +folding; then |
762 | 161 | printf " Expand all - zr\t\tCollapse all - zm\n Expand one - zo\t\tCollapse one - zc\n\n" | 160 | printf " Expand all - zr\t\tCollapse all - zm\n Expand one - zo\t\tCollapse one - zc\n\n" |
763 | 162 | fi | 161 | fi |
764 | 163 | for i in "$BYOBU_PREFIX/lib/$PKG"/*; do | 162 | for i in "$BYOBU_PREFIX/lib/$PKG"/*; do |
765 | 164 | 163 | ||
766 | === modified file 'usr/bin/byobu.in' | |||
767 | --- usr/bin/byobu.in 2019-06-12 23:41:10 +0000 | |||
768 | +++ usr/bin/byobu.in 2019-06-17 20:09:21 +0000 | |||
769 | @@ -35,7 +35,11 @@ | |||
770 | 35 | # Source local byobu config | 35 | # Source local byobu config |
771 | 36 | if [ -r "$HOME/.byoburc" ]; then | 36 | if [ -r "$HOME/.byoburc" ]; then |
772 | 37 | # Ensure that this configuration is usable | 37 | # Ensure that this configuration is usable |
774 | 38 | . "$HOME/.byoburc" || mv -f "$HOME/.byoburc" "$HOME/.byoburc".orig | 38 | if sh -n "$HOME/.byoburc" >/dev/null 2>&1; then |
775 | 39 | . "$HOME/.byoburc" | ||
776 | 40 | else | ||
777 | 41 | mv -f "$HOME/.byoburc" "$HOME/.byoburc".orig | ||
778 | 42 | fi | ||
779 | 39 | fi | 43 | fi |
780 | 40 | if [ -z "${BYOBU_PREFIX}" ]; then | 44 | if [ -z "${BYOBU_PREFIX}" ]; then |
781 | 41 | # Find and export the installation location prefix | 45 | # Find and export the installation location prefix |
782 | @@ -43,26 +47,22 @@ | |||
783 | 43 | prefix="$(dirname $(dirname $($BYOBU_READLINK -f $0)))" | 47 | prefix="$(dirname $(dirname $($BYOBU_READLINK -f $0)))" |
784 | 44 | if [ "$prefix" != "@prefix@" ]; then | 48 | if [ "$prefix" != "@prefix@" ]; then |
785 | 45 | echo "export BYOBU_PREFIX='$prefix'" >> "$HOME/.byoburc" | 49 | echo "export BYOBU_PREFIX='$prefix'" >> "$HOME/.byoburc" |
787 | 46 | . "$HOME/.byoburc" | 50 | BYOBU_PREFIX="$prefix" |
788 | 47 | fi | 51 | fi |
789 | 48 | fi | 52 | fi |
790 | 49 | export BYOBU_CHARMAP=$(locale charmap) | 53 | export BYOBU_CHARMAP=$(locale charmap) |
791 | 50 | [ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc" | ||
792 | 51 | [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX | ||
793 | 52 | . "${BYOBU_PREFIX}/lib/${PKG}/include/common" | ||
794 | 53 | 54 | ||
795 | 54 | # Override backend if we can determine intentions from argv[0] | 55 | # Override backend if we can determine intentions from argv[0] |
796 | 55 | [ -r "$HOME/.$PKG/backend" ] && . "$HOME/.$PKG/backend" | ||
797 | 56 | case "$0" in | 56 | case "$0" in |
798 | 57 | *byobu-screen) BYOBU_BACKEND="screen" ;; | 57 | *byobu-screen) BYOBU_BACKEND="screen" ;; |
799 | 58 | *byobu-tmux) BYOBU_BACKEND="tmux" ;; | 58 | *byobu-tmux) BYOBU_BACKEND="tmux" ;; |
800 | 59 | esac | 59 | esac |
801 | 60 | 60 | ||
804 | 61 | # At this point, we're sure BYOBU_BACKEND is properly defined | 61 | [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX |
805 | 62 | export BYOBU_BACKEND | 62 | . "${BYOBU_PREFIX}/lib/${PKG}/include/common" |
806 | 63 | 63 | ||
807 | 64 | # Store the parent tty | 64 | # Store the parent tty |
809 | 65 | if eval $BYOBU_TEST tty >/dev/null 2>&1; then | 65 | if byobu_test tty; then |
810 | 66 | export BYOBU_TTY=$(tty) | 66 | export BYOBU_TTY=$(tty) |
811 | 67 | else | 67 | else |
812 | 68 | export BYOBU_TTY=$(readlink /proc/$$/fd/0) | 68 | export BYOBU_TTY=$(readlink /proc/$$/fd/0) |
813 | @@ -76,7 +76,7 @@ | |||
814 | 76 | case "$1" in | 76 | case "$1" in |
815 | 77 | -v|--version) | 77 | -v|--version) |
816 | 78 | echo "$PKG version $VERSION" | 78 | echo "$PKG version $VERSION" |
818 | 79 | if eval $BYOBU_TEST bash >/dev/null 2>&1; then | 79 | if byobu_test bash; then |
819 | 80 | # Check ulimits | 80 | # Check ulimits |
820 | 81 | u=$(bash -c "ulimit -n") | 81 | u=$(bash -c "ulimit -n") |
821 | 82 | [ "$u" = "unlimited" ] || [ $u -ge 15 ] || echo "WARNING: ulimit -n is too low" 1>&2 | 82 | [ "$u" = "unlimited" ] || [ $u -ge 15 ] || echo "WARNING: ulimit -n is too low" 1>&2 |
822 | @@ -122,7 +122,7 @@ | |||
823 | 122 | 122 | ||
824 | 123 | # Check if our terminfo supports 256 colors | 123 | # Check if our terminfo supports 256 colors |
825 | 124 | CAN_SHOW_COLORS= | 124 | CAN_SHOW_COLORS= |
827 | 125 | if eval $BYOBU_TEST tput >/dev/null 2>&1; then | 125 | if byobu_test tput; then |
828 | 126 | if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ]; then | 126 | if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ]; then |
829 | 127 | CAN_SHOW_COLORS=1 | 127 | CAN_SHOW_COLORS=1 |
830 | 128 | fi | 128 | fi |
831 | @@ -130,7 +130,7 @@ | |||
832 | 130 | 130 | ||
833 | 131 | # Check if the color terminfo is available | 131 | # Check if the color terminfo is available |
834 | 132 | HAS_COLOR_TERM= | 132 | HAS_COLOR_TERM= |
836 | 133 | if eval $BYOBU_TEST infocmp >/dev/null 2>&1; then | 133 | if byobu_test infocmp; then |
837 | 134 | if infocmp "$BYOBU_COLOR_TERM" >/dev/null 2>&1; then | 134 | if infocmp "$BYOBU_COLOR_TERM" >/dev/null 2>&1; then |
838 | 135 | HAS_COLOR_TERM=1 | 135 | HAS_COLOR_TERM=1 |
839 | 136 | fi | 136 | fi |
840 | @@ -151,7 +151,7 @@ | |||
841 | 151 | fi | 151 | fi |
842 | 152 | BYOBU_PROFILE="-f $BYOBU_PREFIX/share/$PKG/profiles/tmuxrc" | 152 | BYOBU_PROFILE="-f $BYOBU_PREFIX/share/$PKG/profiles/tmuxrc" |
843 | 153 | # Set default window, unless user has overriden | 153 | # Set default window, unless user has overriden |
845 | 154 | if egrep -qs "default-command|default-shell" $HOME/.$PKG/.tmux.conf >/dev/null 2>&1; then | 154 | if egrep -qs "default-command|default-shell" "$BYOBU_CONFIG_DIR/.tmux.conf" >/dev/null 2>&1; then |
846 | 155 | DEFAULT_WINDOW= | 155 | DEFAULT_WINDOW= |
847 | 156 | else | 156 | else |
848 | 157 | DEFAULT_WINDOW="new-session -n $BYOBU_WINDOW_NAME ${BYOBU_PREFIX}/bin/byobu-shell" | 157 | DEFAULT_WINDOW="new-session -n $BYOBU_WINDOW_NAME ${BYOBU_PREFIX}/bin/byobu-shell" |
849 | @@ -191,13 +191,7 @@ | |||
850 | 191 | fi | 191 | fi |
851 | 192 | fi | 192 | fi |
852 | 193 | SCREEN_TERM="-T $BYOBU_TERM" | 193 | SCREEN_TERM="-T $BYOBU_TERM" |
860 | 194 | # Some users want to maintain separate configurations | 194 | BYOBU_PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/screenrc" |
854 | 195 | # if they use both GNU Screen and byobu on the same system | ||
855 | 196 | if [ -r "$BYOBU_CONFIG_DIR/.screenrc" ]; then | ||
856 | 197 | BYOBU_PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/byoburc" | ||
857 | 198 | else | ||
858 | 199 | BYOBU_PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/screenrc" | ||
859 | 200 | fi | ||
861 | 201 | BYOBU_SESSION_NAME="-S $PKG" | 195 | BYOBU_SESSION_NAME="-S $PKG" |
862 | 202 | # Zero out $BYOBU_SESSION_NAME if user has specified a session name | 196 | # Zero out $BYOBU_SESSION_NAME if user has specified a session name |
863 | 203 | for i in "$@"; do | 197 | for i in "$@"; do |
864 | 204 | 198 | ||
865 | === modified file 'usr/lib/byobu/battery' | |||
866 | --- usr/lib/byobu/battery 2016-09-15 19:25:51 +0000 | |||
867 | +++ usr/lib/byobu/battery 2019-06-17 20:09:21 +0000 | |||
868 | @@ -77,7 +77,7 @@ | |||
869 | 77 | esac | 77 | esac |
870 | 78 | done | 78 | done |
871 | 79 | # Mac OS X support | 79 | # Mac OS X support |
873 | 80 | if eval $BYOBU_TEST /usr/sbin/ioreg >/dev/null 2>&1; then | 80 | if byobu_test /usr/sbin/ioreg; then |
874 | 81 | # MacOS support | 81 | # MacOS support |
875 | 82 | local key | 82 | local key |
876 | 83 | for key in CurrentCapacity MaxCapacity ExternalChargeCapable FullyCharged; do | 83 | for key in CurrentCapacity MaxCapacity ExternalChargeCapable FullyCharged; do |
877 | 84 | 84 | ||
878 | === modified file 'usr/lib/byobu/disk_io' | |||
879 | --- usr/lib/byobu/disk_io 2019-06-12 00:01:41 +0000 | |||
880 | +++ usr/lib/byobu/disk_io 2019-06-17 20:09:21 +0000 | |||
881 | @@ -20,7 +20,7 @@ | |||
882 | 20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
883 | 21 | 21 | ||
884 | 22 | __disk_io_detail() { | 22 | __disk_io_detail() { |
886 | 23 | if eval $BYOBU_TEST iostat >/dev/null; then | 23 | if byobu_test iostat; then |
887 | 24 | iostat -d -m -h | 24 | iostat -d -m -h |
888 | 25 | else | 25 | else |
889 | 26 | printf "%s\n" "Please install iostat if you want detailed information on your disk throughput" | 26 | printf "%s\n" "Please install iostat if you want detailed information on your disk throughput" |
890 | 27 | 27 | ||
891 | === modified file 'usr/lib/byobu/hostname' | |||
892 | --- usr/lib/byobu/hostname 2019-05-26 19:12:44 +0000 | |||
893 | +++ usr/lib/byobu/hostname 2019-06-17 20:09:21 +0000 | |||
894 | @@ -25,7 +25,7 @@ | |||
895 | 25 | 25 | ||
896 | 26 | __hostname() { | 26 | __hostname() { |
897 | 27 | local h= | 27 | local h= |
899 | 28 | if eval $BYOBU_TEST hostname >/dev/null 2>&1; then | 28 | if byobu_test hostname; then |
900 | 29 | h=$(hostname -s 2>/dev/null || hostname) | 29 | h=$(hostname -s 2>/dev/null || hostname) |
901 | 30 | elif [ -r /proc/sys/kernel/hostname ]; then | 30 | elif [ -r /proc/sys/kernel/hostname ]; then |
902 | 31 | read h < /proc/sys/kernel/hostname | 31 | read h < /proc/sys/kernel/hostname |
903 | 32 | 32 | ||
904 | === modified file 'usr/lib/byobu/include/common' | |||
905 | --- usr/lib/byobu/include/common 2016-09-15 19:25:51 +0000 | |||
906 | +++ usr/lib/byobu/include/common 2019-06-17 20:09:21 +0000 | |||
907 | @@ -27,6 +27,10 @@ | |||
908 | 27 | eval $BYOBU_TEST ls >/dev/null 2>&1 && break || true | 27 | eval $BYOBU_TEST ls >/dev/null 2>&1 && break || true |
909 | 28 | done | 28 | done |
910 | 29 | 29 | ||
911 | 30 | byobu_test() { | ||
912 | 31 | eval $BYOBU_TEST "$1" >/dev/null 2>&1 | ||
913 | 32 | } | ||
914 | 33 | |||
915 | 30 | # If the backend is already set (eg. running `byobu-tmux`), do nothing. | 34 | # If the backend is already set (eg. running `byobu-tmux`), do nothing. |
916 | 31 | if [ -z "${BYOBU_BACKEND}" ]; then | 35 | if [ -z "${BYOBU_BACKEND}" ]; then |
917 | 32 | [ -r "/etc/$PKG/backend" ] && . "/etc/$PKG/backend" | 36 | [ -r "/etc/$PKG/backend" ] && . "/etc/$PKG/backend" |
918 | @@ -34,9 +38,9 @@ | |||
919 | 34 | # Just in case there's no config file at all | 38 | # Just in case there's no config file at all |
920 | 35 | if [ -z "${BYOBU_BACKEND}" ]; then | 39 | if [ -z "${BYOBU_BACKEND}" ]; then |
921 | 36 | # New byobu configuration, default to tmux | 40 | # New byobu configuration, default to tmux |
923 | 37 | if eval $BYOBU_TEST tmux >/dev/null; then | 41 | if byobu_test tmux; then |
924 | 38 | BYOBU_BACKEND="tmux" | 42 | BYOBU_BACKEND="tmux" |
926 | 39 | elif eval $BYOBU_TEST screen >/dev/null; then | 43 | elif byobu_test screen; then |
927 | 40 | BYOBU_BACKEND="screen" | 44 | BYOBU_BACKEND="screen" |
928 | 41 | else | 45 | else |
929 | 42 | printf "%s\n" "ERROR: $PKG won't work without tmux or screen installed" 1>&2 | 46 | printf "%s\n" "ERROR: $PKG won't work without tmux or screen installed" 1>&2 |
930 | @@ -45,7 +49,7 @@ | |||
931 | 45 | fi | 49 | fi |
932 | 46 | 50 | ||
933 | 47 | # Creating backend cache | 51 | # Creating backend cache |
935 | 48 | [ -d "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND" | 52 | mkdir -p "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND" |
936 | 49 | 53 | ||
937 | 50 | . "${BYOBU_PREFIX}/lib/${PKG}/include/shutil" | 54 | . "${BYOBU_PREFIX}/lib/${PKG}/include/shutil" |
938 | 51 | . "${BYOBU_PREFIX}/lib/${PKG}/include/constants" | 55 | . "${BYOBU_PREFIX}/lib/${PKG}/include/constants" |
939 | 52 | 56 | ||
940 | === modified file 'usr/lib/byobu/include/constants' | |||
941 | --- usr/lib/byobu/include/constants 2018-04-11 15:16:45 +0000 | |||
942 | +++ usr/lib/byobu/include/constants 2019-06-17 20:09:21 +0000 | |||
943 | @@ -26,10 +26,6 @@ | |||
944 | 26 | PCT="%" | 26 | PCT="%" |
945 | 27 | 27 | ||
946 | 28 | # Support two different backends (screen/tmux) | 28 | # Support two different backends (screen/tmux) |
947 | 29 | if [ -z "$BYOBU_BACKEND" ]; then | ||
948 | 30 | [ -r "/etc/byobu/backend" ] && . "/etc/byobu/backend" | ||
949 | 31 | [ -r "$BYOBU_CONFIG_DIR/backend" ] && . "$BYOBU_CONFIG_DIR/backend" | ||
950 | 32 | fi | ||
951 | 33 | case "$BYOBU_BACKEND" in | 29 | case "$BYOBU_BACKEND" in |
952 | 34 | tmux) | 30 | tmux) |
953 | 35 | export BYOBU_BACKEND | 31 | export BYOBU_BACKEND |
954 | @@ -44,18 +40,18 @@ | |||
955 | 44 | esac | 40 | esac |
956 | 45 | 41 | ||
957 | 46 | # MacOS Support | 42 | # MacOS Support |
963 | 47 | eval $BYOBU_TEST gsed >/dev/null 2>&1 && export BYOBU_SED="gsed" || export BYOBU_SED="sed" | 43 | byobu_test gsed && export BYOBU_SED="gsed" || export BYOBU_SED="sed" |
964 | 48 | eval $BYOBU_TEST greadlink >/dev/null 2>&1 && export BYOBU_READLINK="greadlink" || export BYOBU_READLINK="readlink" | 44 | byobu_test greadlink && export BYOBU_READLINK="greadlink" || export BYOBU_READLINK="readlink" |
965 | 49 | eval $BYOBU_TEST sensible-pager >/dev/null 2>&1 && export BYOBU_PAGER="sensible-pager" || export BYOBU_PAGER="less" | 45 | byobu_test sensible-pager && export BYOBU_PAGER="sensible-pager" || export BYOBU_PAGER="less" |
966 | 50 | eval $BYOBU_TEST sensible-editor >/dev/null 2>&1 && export BYOBU_EDITOR="sensible-editor" || export BYOBU_EDITOR="$EDITOR" | 46 | byobu_test sensible-editor && export BYOBU_EDITOR="sensible-editor" || export BYOBU_EDITOR="$EDITOR" |
967 | 51 | eval $BYOBU_TEST "$BYOBU_EDITOR" >/dev/null 2>&1 || export BYOBU_EDITOR="vim" | 47 | byobu_test "$BYOBU_EDITOR" || export BYOBU_EDITOR="vim" |
968 | 52 | 48 | ||
969 | 53 | 49 | ||
970 | 54 | # Check sed's follow-symlinks feature | 50 | # Check sed's follow-symlinks feature |
971 | 55 | $BYOBU_SED --follow-symlinks "s///" /dev/null 2>/dev/null && BYOBU_SED_INLINE="$BYOBU_SED -i --follow-symlinks" || BYOBU_SED_INLINE="$BYOBU_SED -i" | 51 | $BYOBU_SED --follow-symlinks "s///" /dev/null 2>/dev/null && BYOBU_SED_INLINE="$BYOBU_SED -i --follow-symlinks" || BYOBU_SED_INLINE="$BYOBU_SED -i" |
972 | 56 | 52 | ||
973 | 57 | # Determine if we have ulimit support | 53 | # Determine if we have ulimit support |
975 | 58 | eval $BYOBU_TEST ulimit >/dev/null 2>&1 && export BYOBU_ULIMIT="ulimit" || export BYOBU_ULIMIT="false" | 54 | byobu_test ulimit && export BYOBU_ULIMIT="ulimit" || export BYOBU_ULIMIT="false" |
976 | 59 | 55 | ||
977 | 60 | # Find a suitable python interpreter, if undefined | 56 | # Find a suitable python interpreter, if undefined |
978 | 61 | if [ -z "$BYOBU_PYTHON" ]; then | 57 | if [ -z "$BYOBU_PYTHON" ]; then |
979 | 62 | 58 | ||
980 | === modified file 'usr/lib/byobu/include/dirs.in' | |||
981 | --- usr/lib/byobu/include/dirs.in 2016-04-07 22:07:52 +0000 | |||
982 | +++ usr/lib/byobu/include/dirs.in 2019-06-17 20:09:21 +0000 | |||
983 | @@ -25,22 +25,29 @@ | |||
984 | 25 | [ -n "$BYOBU_PREFIX" ] || BYOBU_PREFIX="@prefix@" | 25 | [ -n "$BYOBU_PREFIX" ] || BYOBU_PREFIX="@prefix@" |
985 | 26 | 26 | ||
986 | 27 | # Create and export the user configuration directory | 27 | # Create and export the user configuration directory |
992 | 28 | if [ -d "$BYOBU_CONFIG_DIR" ]; then | 28 | if [ -n "$BYOBU_CONFIG_DIR" ]; then |
993 | 29 | export BYOBU_CONFIG_DIR="$BYOBU_CONFIG_DIR" | 29 | # Explicitly told to use this location, even if it does not exist yet |
994 | 30 | elif [ -d "$XDG_CONFIG_HOME" ]; then | 30 | : |
995 | 31 | # Use XDG, as some users insist on such nonsense :-) | 31 | elif [ -n "$XDG_CONFIG_HOME" ]; then |
996 | 32 | export BYOBU_CONFIG_DIR="$XDG_CONFIG_HOME/$PKG" | 32 | # Presumably set explicitly, use even if it doesn't exist yet |
997 | 33 | BYOBU_CONFIG_DIR="$XDG_CONFIG_HOME/$PKG" | ||
998 | 33 | elif [ -d "$HOME/.config/$PKG" ]; then | 34 | elif [ -d "$HOME/.config/$PKG" ]; then |
999 | 34 | # Use XDG config directory, if it exists | 35 | # Use XDG config directory, if it exists |
1001 | 35 | export BYOBU_CONFIG_DIR="$HOME/.config/$PKG" | 36 | BYOBU_CONFIG_DIR="$HOME/.config/$PKG" |
1002 | 36 | elif [ -d "$HOME/.local/share/$PKG" ]; then | 37 | elif [ -d "$HOME/.local/share/$PKG" ]; then |
1003 | 37 | # Use XDG local directory, if it exists | 38 | # Use XDG local directory, if it exists |
1005 | 38 | export BYOBU_CONFIG_DIR="$HOME/.local/share/$PKG" | 39 | BYOBU_CONFIG_DIR="$HOME/.local/share/$PKG" |
1006 | 40 | elif [ -d "$HOME/.$PKG" ]; then | ||
1007 | 41 | # Use classic config dir location, if it exists | ||
1008 | 42 | BYOBU_CONFIG_DIR="$HOME/.$PKG" | ||
1009 | 43 | elif [ -d "$HOME/.config" ]; then | ||
1010 | 44 | # Create new config in XDG config directory | ||
1011 | 45 | BYOBU_CONFIG_DIR="$HOME/.config/$PKG" | ||
1012 | 39 | else | 46 | else |
1013 | 40 | # And to default to good old classic config dir location! | 47 | # And to default to good old classic config dir location! |
1015 | 41 | export BYOBU_CONFIG_DIR="$HOME/.$PKG" | 48 | BYOBU_CONFIG_DIR="$HOME/.$PKG" |
1016 | 42 | fi | 49 | fi |
1018 | 43 | [ -d "$BYOBU_CONFIG_DIR" ] || mkdir -p "$BYOBU_CONFIG_DIR/bin" | 50 | mkdir -p "$BYOBU_CONFIG_DIR/bin" |
1019 | 44 | 51 | ||
1020 | 45 | # Grab the global, then local socket directory | 52 | # Grab the global, then local socket directory |
1021 | 46 | [ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir" | 53 | [ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir" |
1022 | @@ -51,22 +58,24 @@ | |||
1023 | 51 | # Use shm for performance, if possible | 58 | # Use shm for performance, if possible |
1024 | 52 | for i in /dev/shm/$PKG-$USER-*; do | 59 | for i in /dev/shm/$PKG-$USER-*; do |
1025 | 53 | if [ -d "$i" ] && [ -O "$i" ]; then | 60 | if [ -d "$i" ] && [ -O "$i" ]; then |
1027 | 54 | export BYOBU_RUN_DIR="$i" | 61 | BYOBU_RUN_DIR="$i" |
1028 | 55 | break | 62 | break |
1029 | 56 | fi | 63 | fi |
1030 | 57 | done | 64 | done |
1031 | 58 | # Still empty, make a new one | 65 | # Still empty, make a new one |
1032 | 59 | if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ]; then | 66 | if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ]; then |
1034 | 60 | export BYOBU_RUN_DIR=$(mktemp -d /dev/shm/$PKG-$USER-XXXXXXXX) | 67 | BYOBU_RUN_DIR=$(mktemp -d /dev/shm/$PKG-$USER-XXXXXXXX) |
1035 | 61 | fi | 68 | fi |
1036 | 62 | fi | 69 | fi |
1037 | 63 | if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ] || [ ! -w "$BYOBU_RUN_DIR" ]; then | 70 | if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ] || [ ! -w "$BYOBU_RUN_DIR" ]; then |
1038 | 64 | # For distros that don't have a /dev/shm, use local disk | 71 | # For distros that don't have a /dev/shm, use local disk |
1040 | 65 | if [ -d "$XDG_CACHE_HOME" ]; then | 72 | if [ -n "$XDG_CACHE_HOME" ]; then |
1041 | 66 | # Use XDG, as some users insist on such nonsense :-) | 73 | # Use XDG, as some users insist on such nonsense :-) |
1043 | 67 | export BYOBU_RUN_DIR="$XDG_CACHE_HOME/$PKG" | 74 | BYOBU_RUN_DIR="$XDG_CACHE_HOME/$PKG" |
1044 | 68 | else | 75 | else |
1045 | 69 | # But if not, we'll use a cache directory | 76 | # But if not, we'll use a cache directory |
1047 | 70 | export BYOBU_RUN_DIR="$HOME/.cache/$PKG" | 77 | BYOBU_RUN_DIR="$HOME/.cache/$PKG" |
1048 | 71 | fi | 78 | fi |
1049 | 72 | fi | 79 | fi |
1050 | 80 | |||
1051 | 81 | export BYOBU_CONFIG_DIR BYOBU_RUN_DIR | ||
1052 | 73 | 82 | ||
1053 | === modified file 'usr/lib/byobu/include/shutil' | |||
1054 | --- usr/lib/byobu/include/shutil 2018-08-12 16:28:39 +0000 | |||
1055 | +++ usr/lib/byobu/include/shutil 2019-06-17 20:09:21 +0000 | |||
1056 | @@ -300,7 +300,7 @@ | |||
1057 | 300 | [ "$Mask" = "00000000" ] && break | 300 | [ "$Mask" = "00000000" ] && break |
1058 | 301 | done < /proc/net/route | 301 | done < /proc/net/route |
1059 | 302 | _RET="$Iface" | 302 | _RET="$Iface" |
1061 | 303 | elif eval $BYOBU_TEST route >/dev/null 2>&1; then | 303 | elif byobu_test route; then |
1062 | 304 | # Route command on path | 304 | # Route command on path |
1063 | 305 | _RET=$(route get default|grep interface:|awk '{print $2}') | 305 | _RET=$(route get default|grep interface:|awk '{print $2}') |
1064 | 306 | elif [ -x "/sbin/route" ]; then | 306 | elif [ -x "/sbin/route" ]; then |
1065 | @@ -340,7 +340,7 @@ | |||
1066 | 340 | distro="${issue%% *}"; | 340 | distro="${issue%% *}"; |
1067 | 341 | ;; | 341 | ;; |
1068 | 342 | esac | 342 | esac |
1070 | 343 | elif eval $BYOBU_TEST lsb_release >/dev/null 2>&1; then | 343 | elif byobu_test lsb_release; then |
1071 | 344 | # If lsb_release is available, use it | 344 | # If lsb_release is available, use it |
1072 | 345 | local r=$(lsb_release -s -d) | 345 | local r=$(lsb_release -s -d) |
1073 | 346 | case "$r" in | 346 | case "$r" in |
1074 | @@ -354,9 +354,9 @@ | |||
1075 | 354 | distro=$(lsb_release -s -i) | 354 | distro=$(lsb_release -s -i) |
1076 | 355 | ;; | 355 | ;; |
1077 | 356 | esac | 356 | esac |
1079 | 357 | elif eval $BYOBU_TEST sw_vers >/dev/null 2>&1; then | 357 | elif byobu_test sw_vers; then |
1080 | 358 | distro="$(sw_vers -productName)" | 358 | distro="$(sw_vers -productName)" |
1082 | 359 | elif eval $BYOBU_TEST uname >/dev/null 2>&1; then | 359 | elif byobu_test uname; then |
1083 | 360 | distro="$(uname -s)" | 360 | distro="$(uname -s)" |
1084 | 361 | else | 361 | else |
1085 | 362 | distro="Byobu" | 362 | distro="Byobu" |
1086 | 363 | 363 | ||
1087 | === modified file 'usr/lib/byobu/ip_address' | |||
1088 | --- usr/lib/byobu/ip_address 2018-08-12 14:07:40 +0000 | |||
1089 | +++ usr/lib/byobu/ip_address 2019-06-17 20:09:21 +0000 | |||
1090 | @@ -47,7 +47,7 @@ | |||
1091 | 47 | # Background an update | 47 | # Background an update |
1092 | 48 | if [ -x /sbin/ip ]; then | 48 | if [ -x /sbin/ip ]; then |
1093 | 49 | LC_ALL=C /sbin/ip -6 addr list dev "$interface" scope global </dev/null >"$cache" 2>/dev/null & | 49 | LC_ALL=C /sbin/ip -6 addr list dev "$interface" scope global </dev/null >"$cache" 2>/dev/null & |
1095 | 50 | elif eval $BYOBU_TEST ifconfig >/dev/null 2>&1; then | 50 | elif byobu_test ifconfig; then |
1096 | 51 | LC_ALL=c ifconfig "$interface" | grep "inet6 " | awk '{print $2}' | sed -e "s/%.*//" >"$cache" 2>/dev/null & | 51 | LC_ALL=c ifconfig "$interface" | grep "inet6 " | awk '{print $2}' | sed -e "s/%.*//" >"$cache" 2>/dev/null & |
1097 | 52 | 52 | ||
1098 | 53 | fi | 53 | fi |
1099 | @@ -73,7 +73,7 @@ | |||
1100 | 73 | ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global 2>/dev/null) | 73 | ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global 2>/dev/null) |
1101 | 74 | ipaddr=${ipaddr#* inet } | 74 | ipaddr=${ipaddr#* inet } |
1102 | 75 | ipaddr=${ipaddr%%/*} | 75 | ipaddr=${ipaddr%%/*} |
1104 | 76 | elif eval $BYOBU_TEST ifconfig >/dev/null 2>&1; then | 76 | elif byobu_test ifconfig; then |
1105 | 77 | ipaddr=$(ifconfig "$interface" | grep "inet " | awk '{print $2}') | 77 | ipaddr=$(ifconfig "$interface" | grep "inet " | awk '{print $2}') |
1106 | 78 | fi | 78 | fi |
1107 | 79 | fi | 79 | fi |
1108 | 80 | 80 | ||
1109 | === modified file 'usr/lib/byobu/memory' | |||
1110 | --- usr/lib/byobu/memory 2016-09-15 19:25:51 +0000 | |||
1111 | +++ usr/lib/byobu/memory 2019-06-17 20:09:21 +0000 | |||
1112 | @@ -36,7 +36,7 @@ | |||
1113 | 36 | esac | 36 | esac |
1114 | 37 | [ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break; | 37 | [ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break; |
1115 | 38 | done < /proc/meminfo | 38 | done < /proc/meminfo |
1117 | 39 | elif eval $BYOBU_TEST vm_stat >/dev/null 2>&1; then | 39 | elif byobu_test vm_stat; then |
1118 | 40 | # MacOS support | 40 | # MacOS support |
1119 | 41 | # calculation borrowed from http://apple.stackexchange.com/a/48195/18857 | 41 | # calculation borrowed from http://apple.stackexchange.com/a/48195/18857 |
1120 | 42 | free_blocks=$(vm_stat | grep free | awk '{ print $3 }' | sed -e 's/\.//') | 42 | free_blocks=$(vm_stat | grep free | awk '{ print $3 }' | sed -e 's/\.//') |
1121 | 43 | 43 | ||
1122 | === modified file 'usr/lib/byobu/release' | |||
1123 | --- usr/lib/byobu/release 2019-05-26 19:14:28 +0000 | |||
1124 | +++ usr/lib/byobu/release 2019-06-17 20:09:21 +0000 | |||
1125 | @@ -46,10 +46,10 @@ | |||
1126 | 46 | RELEASE="$ver" | 46 | RELEASE="$ver" |
1127 | 47 | ;; | 47 | ;; |
1128 | 48 | esac | 48 | esac |
1130 | 49 | elif eval $BYOBU_TEST sw_vers >/dev/null 2>&1; then | 49 | elif byobu_test sw_vers; then |
1131 | 50 | RELEASE="$(sw_vers -productVersion)" | 50 | RELEASE="$(sw_vers -productVersion)" |
1132 | 51 | fi | 51 | fi |
1134 | 52 | if [ -z "$RELEASE" ] && eval $BYOBU_TEST lsb_release >/dev/null 2>&1; then | 52 | if [ -z "$RELEASE" ] && byobu_test lsb_release; then |
1135 | 53 | # If lsb_release is available, use it | 53 | # If lsb_release is available, use it |
1136 | 54 | RELEASE=$(lsb_release -s -r) | 54 | RELEASE=$(lsb_release -s -r) |
1137 | 55 | fi | 55 | fi |
1138 | 56 | 56 | ||
1139 | === modified file 'usr/lib/byobu/updates_available' | |||
1140 | --- usr/lib/byobu/updates_available 2019-05-26 19:15:34 +0000 | |||
1141 | +++ usr/lib/byobu/updates_available 2019-06-17 20:09:21 +0000 | |||
1142 | @@ -51,32 +51,32 @@ | |||
1143 | 51 | if [ -x /usr/lib/update-notifier/apt-check ]; then | 51 | if [ -x /usr/lib/update-notifier/apt-check ]; then |
1144 | 52 | # If apt-check binary exists, use it | 52 | # If apt-check binary exists, use it |
1145 | 53 | 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\")" & | 53 | 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\")" & |
1147 | 54 | elif eval $BYOBU_TEST apt-get >/dev/null; then | 54 | elif byobu_test apt-get; then |
1148 | 55 | # If apt-get exists, use it | 55 | # If apt-get exists, use it |
1149 | 56 | flock -xn "$flock" apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst >$mycache 2>/dev/null & | 56 | flock -xn "$flock" apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst >$mycache 2>/dev/null & |
1151 | 57 | elif eval $BYOBU_TEST pkcon >/dev/null; then | 57 | elif byobu_test pkcon; then |
1152 | 58 | # use packagekit to show list of packages | 58 | # use packagekit to show list of packages |
1153 | 59 | 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 & | 59 | 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 & |
1155 | 60 | elif eval $BYOBU_TEST zypper >/dev/null; then | 60 | elif byobu_test zypper; then |
1156 | 61 | # If zypper exists, use it | 61 | # If zypper exists, use it |
1157 | 62 | flock -xn "$flock" zypper --no-refresh lu --best-effort | grep -c 'v |' >$mycache 2>/dev/null & | 62 | flock -xn "$flock" zypper --no-refresh lu --best-effort | grep -c 'v |' >$mycache 2>/dev/null & |
1159 | 63 | elif eval $BYOBU_TEST yum >/dev/null; then | 63 | elif byobu_test yum; then |
1160 | 64 | # If yum exists, use it | 64 | # If yum exists, use it |
1161 | 65 | # TODO: We need a better way of counting updates available from a RH expert | 65 | # TODO: We need a better way of counting updates available from a RH expert |
1162 | 66 | flock -xn "$flock" yum list updates -q | grep -vc "Updated Packages" >$mycache 2>/dev/null & | 66 | flock -xn "$flock" yum list updates -q | grep -vc "Updated Packages" >$mycache 2>/dev/null & |
1164 | 67 | elif eval $BYOBU_TEST pacman >/dev/null; then | 67 | elif byobu_test pacman; then |
1165 | 68 | # If pacman (Archlinux) exists, use it | 68 | # If pacman (Archlinux) exists, use it |
1166 | 69 | LC_ALL=C flock -xn "$flock" pacman -Sup | grep -vc "^\(::\| \)" >$mycache 2>/dev/null & | 69 | LC_ALL=C flock -xn "$flock" pacman -Sup | grep -vc "^\(::\| \)" >$mycache 2>/dev/null & |
1168 | 70 | elif eval $BYOBU_TEST opkg >/dev/null; then | 70 | elif byobu_test opkg; then |
1169 | 71 | # If opkg (OpenWrt) exists, use it, also background if flock exists | 71 | # If opkg (OpenWrt) exists, use it, also background if flock exists |
1171 | 72 | if eval $BYOBU_TEST flock >/dev/null; then | 72 | if byobu_test flock; then |
1172 | 73 | flock -xn "$flock" opkg list-upgradable | wc -l >$mycache 2>/dev/null & | 73 | flock -xn "$flock" opkg list-upgradable | wc -l >$mycache 2>/dev/null & |
1173 | 74 | else | 74 | else |
1174 | 75 | opkg list-upgradable | wc -l >$mycache & | 75 | opkg list-upgradable | wc -l >$mycache & |
1175 | 76 | fi | 76 | fi |
1177 | 77 | elif eval $BYOBU_TEST brew >/dev/null; then | 77 | elif byobu_test brew; then |
1178 | 78 | # If homebrew (Mac OSX) exists, use it, also background if flock exists | 78 | # If homebrew (Mac OSX) exists, use it, also background if flock exists |
1180 | 79 | if eval $BYOBU_TEST flock >/dev/null; then | 79 | if byobu_test flock; then |
1181 | 80 | flock -xn "$flock" brew outdated | wc -l >$mycache 2>/dev/null & | 80 | flock -xn "$flock" brew outdated | wc -l >$mycache 2>/dev/null & |
1182 | 81 | else | 81 | else |
1183 | 82 | brew outdated | wc -l >$mycache & | 82 | brew outdated | wc -l >$mycache & |
1184 | @@ -90,7 +90,7 @@ | |||
1185 | 90 | local mycache=$1 | 90 | local mycache=$1 |
1186 | 91 | # The cache doesn't exist: create it | 91 | # The cache doesn't exist: create it |
1187 | 92 | [ ! -e "$mycache" ] && return 0 | 92 | [ ! -e "$mycache" ] && return 0 |
1189 | 93 | if eval $BYOBU_TEST apt-get >/dev/null; then | 93 | if byobu_test apt-get; then |
1190 | 94 | # Debian/ubuntu | 94 | # Debian/ubuntu |
1191 | 95 | d0=$(($(stat -c %Y $mycache 2>/dev/null)-5)) | 95 | d0=$(($(stat -c %Y $mycache 2>/dev/null)-5)) |
1192 | 96 | d1=$(stat -c %Y /var/lib/apt) | 96 | d1=$(stat -c %Y /var/lib/apt) |
1193 | @@ -106,14 +106,14 @@ | |||
1194 | 106 | elif [ -e "/var/lib/PackageKit/transactions.db" ]; then | 106 | elif [ -e "/var/lib/PackageKit/transactions.db" ]; then |
1195 | 107 | [ "/var/lib/PackageKit/transactions.db" -nt "$mycache" ] | 107 | [ "/var/lib/PackageKit/transactions.db" -nt "$mycache" ] |
1196 | 108 | return $? | 108 | return $? |
1198 | 109 | elif eval $BYOBU_TEST pacman >/dev/null; then | 109 | elif byobu_test pacman; then |
1199 | 110 | # Archlinux | 110 | # Archlinux |
1200 | 111 | local db | 111 | local db |
1201 | 112 | for db in /var/lib/pacman/sync/*.db; do | 112 | for db in /var/lib/pacman/sync/*.db; do |
1202 | 113 | [ "$db" -nt "$mycache" ] && return 0 | 113 | [ "$db" -nt "$mycache" ] && return 0 |
1203 | 114 | done | 114 | done |
1204 | 115 | return 1 | 115 | return 1 |
1206 | 116 | elif eval $BYOBU_TEST opkg >/dev/null; then | 116 | elif byobu_test opkg; then |
1207 | 117 | # OpenWrt | 117 | # OpenWrt |
1208 | 118 | [ ! -e /var/lock/opkg.lock ] || return 1 | 118 | [ ! -e /var/lock/opkg.lock ] || return 1 |
1209 | 119 | if [ -d /var/opkg-lists ]; then | 119 | if [ -d /var/opkg-lists ]; then |
1210 | @@ -125,7 +125,7 @@ | |||
1211 | 125 | [ "$u" -gt 0 ] | 125 | [ "$u" -gt 0 ] |
1212 | 126 | return $? | 126 | return $? |
1213 | 127 | fi | 127 | fi |
1215 | 128 | elif eval $BYOBU_TEST brew >/dev/null; then | 128 | elif byobu_test brew; then |
1216 | 129 | # Mac OSX | 129 | # Mac OSX |
1217 | 130 | # check if any new versions have been installed since | 130 | # check if any new versions have been installed since |
1218 | 131 | # we last cached. this may not recognize formulae | 131 | # we last cached. this may not recognize formulae |
1219 | @@ -142,7 +142,7 @@ | |||
1220 | 142 | } | 142 | } |
1221 | 143 | 143 | ||
1222 | 144 | __updates_available_detail() { | 144 | __updates_available_detail() { |
1224 | 145 | if eval $BYOBU_TEST apt-get >/dev/null; then | 145 | if byobu_test apt-get; then |
1225 | 146 | local detail=`apt-get -s -o Debug::NoLocking=true upgrade` | 146 | local detail=`apt-get -s -o Debug::NoLocking=true upgrade` |
1226 | 147 | if [ "$1" = "--detail" ]; then | 147 | if [ "$1" = "--detail" ]; then |
1227 | 148 | printf "$detail" | 148 | printf "$detail" |
1228 | 149 | 149 | ||
1229 | === modified file 'usr/lib/byobu/users' | |||
1230 | --- usr/lib/byobu/users 2019-05-26 19:18:32 +0000 | |||
1231 | +++ usr/lib/byobu/users 2019-06-17 20:09:21 +0000 | |||
1232 | @@ -26,7 +26,7 @@ | |||
1233 | 26 | } | 26 | } |
1234 | 27 | 27 | ||
1235 | 28 | __users() { | 28 | __users() { |
1237 | 29 | local count=0 | 29 | local count=0 sign |
1238 | 30 | if [ "$USERS_DISTINCT" = "1" ]; then | 30 | if [ "$USERS_DISTINCT" = "1" ]; then |
1239 | 31 | count=$(pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l) | 31 | count=$(pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l) |
1240 | 32 | else | 32 | else |
1241 | @@ -35,7 +35,15 @@ | |||
1242 | 35 | count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l) || return | 35 | count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l) || return |
1243 | 36 | fi | 36 | fi |
1244 | 37 | if [ $count -gt 0 ]; then | 37 | if [ $count -gt 0 ]; then |
1246 | 38 | color b w r; printf "%d" "$count"; color -; color w r; printf "##"; color -- | 38 | case "$BYOBU_BACKEND" in |
1247 | 39 | tmux) | ||
1248 | 40 | sign="##" | ||
1249 | 41 | ;; | ||
1250 | 42 | screen) | ||
1251 | 43 | sign="#" | ||
1252 | 44 | ;; | ||
1253 | 45 | esac | ||
1254 | 46 | color b w r; printf "%d" "$count"; color -; color w r; printf "$sign"; color -- | ||
1255 | 39 | else | 47 | else |
1256 | 40 | rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"* | 48 | rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"* |
1257 | 41 | fi | 49 | fi |
1258 | 42 | 50 | ||
1259 | === modified file 'usr/lib/byobu/whoami' | |||
1260 | --- usr/lib/byobu/whoami 2019-05-26 19:15:56 +0000 | |||
1261 | +++ usr/lib/byobu/whoami 2019-06-17 20:09:21 +0000 | |||
1262 | @@ -20,9 +20,9 @@ | |||
1263 | 20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1264 | 21 | 21 | ||
1265 | 22 | ___get_user() { | 22 | ___get_user() { |
1267 | 23 | if eval $BYOBU_TEST whoami >/dev/null 2>&1; then | 23 | if byobu_test whoami; then |
1268 | 24 | whoami | 24 | whoami |
1270 | 25 | elif eval $BYOBU_TEST id >/dev/null 2>&1; then | 25 | elif byobu_test id; then |
1271 | 26 | id -un | 26 | id -un |
1272 | 27 | fi | 27 | fi |
1273 | 28 | } | 28 | } |
1274 | @@ -30,7 +30,7 @@ | |||
1275 | 30 | __whoami_detail() { | 30 | __whoami_detail() { |
1276 | 31 | local user=$(___get_user) | 31 | local user=$(___get_user) |
1277 | 32 | [ -n "$user" ] || return | 32 | [ -n "$user" ] || return |
1279 | 33 | if eval $BYOBU_TEST getent >/dev/null 2>&1; then | 33 | if byobu_test getent; then |
1280 | 34 | getent -- passwd "$user" | 34 | getent -- passwd "$user" |
1281 | 35 | else | 35 | else |
1282 | 36 | grep "^$user:" /etc/passwd | 36 | grep "^$user:" /etc/passwd |
1283 | 37 | 37 | ||
1284 | === modified file 'usr/lib/byobu/wifi_quality' | |||
1285 | --- usr/lib/byobu/wifi_quality 2019-06-01 21:12:18 +0000 | |||
1286 | +++ usr/lib/byobu/wifi_quality 2019-06-17 20:09:21 +0000 | |||
1287 | @@ -28,21 +28,21 @@ | |||
1288 | 28 | } | 28 | } |
1289 | 29 | 29 | ||
1290 | 30 | __wifi_quality_detail() { | 30 | __wifi_quality_detail() { |
1292 | 31 | if eval $BYOBU_TEST iw >/dev/null 2>&1; then | 31 | if byobu_test iw; then |
1293 | 32 | local dev | 32 | local dev |
1294 | 33 | for dev in $(___get_dev_list); do | 33 | for dev in $(___get_dev_list); do |
1295 | 34 | iw dev "$dev" info | 34 | iw dev "$dev" info |
1296 | 35 | iw dev "$dev" link | 35 | iw dev "$dev" link |
1297 | 36 | echo | 36 | echo |
1298 | 37 | done | 37 | done |
1300 | 38 | elif eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then | 38 | elif byobu_test iwconfig; then |
1301 | 39 | iwconfig 2>/dev/null | 39 | iwconfig 2>/dev/null |
1302 | 40 | fi | 40 | fi |
1303 | 41 | } | 41 | } |
1304 | 42 | 42 | ||
1305 | 43 | __wifi_quality() { | 43 | __wifi_quality() { |
1306 | 44 | local out bitrate quality | 44 | local out bitrate quality |
1308 | 45 | if eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then | 45 | if byobu_test iwconfig; then |
1309 | 46 | # iwconfig is expected to output lines like: | 46 | # iwconfig is expected to output lines like: |
1310 | 47 | # Bit Rate=54 Mb/s Tx-Power=15 dBm | 47 | # Bit Rate=54 Mb/s Tx-Power=15 dBm |
1311 | 48 | # Link Quality=60/70 Signal level=-50 dBm | 48 | # Link Quality=60/70 Signal level=-50 dBm |
1312 | @@ -54,7 +54,7 @@ | |||
1313 | 54 | $0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); } | 54 | $0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); } |
1314 | 55 | '` | 55 | '` |
1315 | 56 | eval "$out" | 56 | eval "$out" |
1317 | 57 | elif eval $BYOBU_TEST iw >/dev/null 2>&1; then | 57 | elif byobu_test iw; then |
1318 | 58 | local dev | 58 | local dev |
1319 | 59 | for dev in $(___get_dev_list); do | 59 | for dev in $(___get_dev_list); do |
1320 | 60 | # iw is expected to output lines like: | 60 | # iw is expected to output lines like: |
1321 | 61 | 61 | ||
1322 | === modified file 'usr/share/byobu/keybindings/f-keys.screen' | |||
1323 | --- usr/share/byobu/keybindings/f-keys.screen 2018-04-11 15:16:45 +0000 | |||
1324 | +++ usr/share/byobu/keybindings/f-keys.screen 2019-06-17 20:09:21 +0000 | |||
1325 | @@ -89,4 +89,4 @@ | |||
1326 | 89 | register d ":source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen.disable^M" | 89 | register d ":source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen.disable^M" |
1327 | 90 | bind ! eval 'process x' 'process d' 'backtick 111 9999999 9999999 byobu-status menu --disable-f-keys' # F12 ! | toggle on/off f-keys | 90 | bind ! eval 'process x' 'process d' 'backtick 111 9999999 9999999 byobu-status menu --disable-f-keys' # F12 ! | toggle on/off f-keys |
1328 | 91 | 91 | ||
1330 | 92 | bindkey "^A" $BYOBU_BACKEND -t ctrl-a byobu-ctrl-a | 92 | bindkey "^A" $BYOBU_BACKEND -t ctrl-a byobu-ctrl-a autorun |
1331 | 93 | 93 | ||
1332 | === modified file 'usr/share/byobu/keybindings/f-keys.tmux' | |||
1333 | --- usr/share/byobu/keybindings/f-keys.tmux 2019-05-26 19:10:55 +0000 | |||
1334 | +++ usr/share/byobu/keybindings/f-keys.tmux 2019-06-17 20:09:21 +0000 | |||
1335 | @@ -82,4 +82,4 @@ | |||
1336 | 82 | bind-key -n M-F12 source $BYOBU_PREFIX/share/byobu/keybindings/mouse.tmux.enable | 82 | bind-key -n M-F12 source $BYOBU_PREFIX/share/byobu/keybindings/mouse.tmux.enable |
1337 | 83 | bind-key -n M-IC paste-buffer | 83 | bind-key -n M-IC paste-buffer |
1338 | 84 | 84 | ||
1340 | 85 | bind-key -n C-a new-window -n "ctrl-a" "byobu-ctrl-a" | 85 | bind-key -n C-a new-window -n "ctrl-a" "byobu-ctrl-a autorun" |
1341 | 86 | 86 | ||
1342 | === modified file 'usr/share/byobu/profiles/Makefile.am' | |||
1343 | --- usr/share/byobu/profiles/Makefile.am 2015-11-14 22:57:11 +0000 | |||
1344 | +++ usr/share/byobu/profiles/Makefile.am 2019-06-17 20:09:21 +0000 | |||
1345 | @@ -1,2 +1,2 @@ | |||
1346 | 1 | profilesdir = $(datadir)/@PACKAGE@/profiles | 1 | profilesdir = $(datadir)/@PACKAGE@/profiles |
1348 | 2 | profiles_DATA = bashrc byoburc dircolors screenrc common tmux tmuxrc NONE | 2 | profiles_DATA = bashrc dircolors screenrc common tmux tmuxrc NONE |
1349 | 3 | 3 | ||
1350 | === removed file 'usr/share/byobu/profiles/byoburc' | |||
1351 | --- usr/share/byobu/profiles/byoburc 2016-04-07 22:07:52 +0000 | |||
1352 | +++ usr/share/byobu/profiles/byoburc 1970-01-01 00:00:00 +0000 | |||
1353 | @@ -1,27 +0,0 @@ | |||
1354 | 1 | ############################################################################### | ||
1355 | 2 | # Load: | ||
1356 | 3 | # * the stock byobu profile | ||
1357 | 4 | # * any windows | ||
1358 | 5 | # * and the local byoburc (instead of .screenrc) | ||
1359 | 6 | # Used at startup but not profile refresh | ||
1360 | 7 | # | ||
1361 | 8 | # Copyright (C) 2009-2011 Canonical Ltd. | ||
1362 | 9 | # | ||
1363 | 10 | # Authors: Dustin Kirkland <kirkland@byobu.org> | ||
1364 | 11 | # | ||
1365 | 12 | # This program is free software: you can redistribute it and/or modify | ||
1366 | 13 | # it under the terms of the GNU General Public License as published by | ||
1367 | 14 | # the Free Software Foundation, version 3 of the License. | ||
1368 | 15 | # | ||
1369 | 16 | # This program is distributed in the hope that it will be useful, | ||
1370 | 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1371 | 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1372 | 19 | # GNU General Public License for more details. | ||
1373 | 20 | # | ||
1374 | 21 | # You should have received a copy of the GNU General Public License | ||
1375 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1376 | 23 | ############################################################################### | ||
1377 | 24 | |||
1378 | 25 | source $BYOBU_CONFIG_DIR/profile | ||
1379 | 26 | source $BYOBU_WINDOWS | ||
1380 | 27 | source $BYOBU_CONFIG_DIR/.screenrc | ||
1381 | 28 | 0 | ||
1382 | === modified file 'usr/share/byobu/profiles/screenrc' | |||
1383 | --- usr/share/byobu/profiles/screenrc 2016-04-07 22:07:52 +0000 | |||
1384 | +++ usr/share/byobu/profiles/screenrc 2019-06-17 20:09:21 +0000 | |||
1385 | @@ -2,7 +2,7 @@ | |||
1386 | 2 | # Load: | 2 | # Load: |
1387 | 3 | # * the stock byobu profile | 3 | # * the stock byobu profile |
1388 | 4 | # * any windows | 4 | # * any windows |
1390 | 5 | # * and the local .screenrc (instead of .byoburc) | 5 | # * and the local .screenrc |
1391 | 6 | # Used at startup but not profile refresh | 6 | # Used at startup but not profile refresh |
1392 | 7 | # | 7 | # |
1393 | 8 | # Copyright (C) 2009-2011 Canonical Ltd. | 8 | # Copyright (C) 2009-2011 Canonical Ltd. |
1394 | 9 | 9 | ||
1395 | === modified file 'usr/share/byobu/profiles/tmuxrc' | |||
1396 | --- usr/share/byobu/profiles/tmuxrc 2016-04-07 22:07:52 +0000 | |||
1397 | +++ usr/share/byobu/profiles/tmuxrc 2019-06-17 20:09:21 +0000 | |||
1398 | @@ -2,7 +2,7 @@ | |||
1399 | 2 | # Load: | 2 | # Load: |
1400 | 3 | # * the stock byobu profile | 3 | # * the stock byobu profile |
1401 | 4 | # * any windows | 4 | # * any windows |
1403 | 5 | # * and the local byoburc (instead of .screenrc) | 5 | # * and the local .tmux.conf |
1404 | 6 | # Used at startup but not profile refresh | 6 | # Used at startup but not profile refresh |
1405 | 7 | # | 7 | # |
1406 | 8 | # Copyright (C) 2009-2011 Canonical Ltd. | 8 | # Copyright (C) 2009-2011 Canonical Ltd. |
Should I separate these changes into separate branches/merge requests?