Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
* comply with shellfmt
  • Loading branch information
xx4h committed Apr 14, 2024
1 parent d8f199b commit 47f3414
Show file tree
Hide file tree
Showing 32 changed files with 431 additions and 426 deletions.
6 changes: 3 additions & 3 deletions color_palette.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# Idea from http://superuser.com/questions/285381/how-does-the-tmux-color-palette-work

for i in $(seq 0 8 255); do
for j in $(seq "$i" $(( i + 7 ))); do
for _unused in $(seq 1 $(( 7 - ${#j} ))); do
for j in $(seq "$i" $((i + 7))); do
for _unused in $(seq 1 $((7 - ${#j}))); do
echo -n " "
done
echo -en "\x1b[38;5;${j}mcolour${j}"
[[ $(( j % 8 )) != 7 ]] && echo -n " "
[[ $((j % 8)) != 7 ]] && echo -n " "
done
echo
done
12 changes: 6 additions & 6 deletions lib/colors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ __normalize_color() {
local result

case "$input" in
[0-9]|[0-9][0-9]|[0-9][0-9][0-9]) # handle 1 to 3 digits
result="colour$input"
;;
*) # Catch-all
result=$input
;;
[0-9] | [0-9][0-9] | [0-9][0-9][0-9]) # handle 1 to 3 digits
result="colour$input"
;;
*) # Catch-all
result=$input
;;
esac

echo -n "$result"
Expand Down
8 changes: 3 additions & 5 deletions lib/config_file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,10 @@ process_settings() {

export TMUX_POWERLINE_STATUS_STYLE="fg=$fg_color,bg=$bg_color"
fi


}

generate_default_config() {
read -r -d '' config_contents << EORC
read -r -d '' config_contents <<EORC
# Default configuration file for tmux-powerline.
# Modeline {
# vi: foldmarker={,} foldmethod=marker foldlevel=0 tabstop=4 filetype=sh
Expand Down Expand Up @@ -142,13 +140,13 @@ EORC
fi
done

echo -e "$config_contents" > "$TMUX_POWERLINE_CONFIG_FILE_DEFAULT"
echo -e "$config_contents" >"$TMUX_POWERLINE_CONFIG_FILE_DEFAULT"
echo "Default configuration file generated to: ${TMUX_POWERLINE_CONFIG_FILE_DEFAULT}"
echo "Copy/move it to \"${TMUX_POWERLINE_CONFIG_FILE}\" and make your changes."
}

__read_config_file() {
if [ -f "$TMUX_POWERLINE_CONFIG_FILE" ]; then
if [ -f "$TMUX_POWERLINE_CONFIG_FILE" ]; then
# shellcheck disable=SC1090
source "$TMUX_POWERLINE_CONFIG_FILE"
fi
Expand Down
2 changes: 1 addition & 1 deletion lib/headers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Source all needed libs and helpers, kind of like a main.h.

if [ -z "$TMUX_POWERLINE_DIR_HOME" ]; then
lib_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
lib_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TMUX_POWERLINE_DIR_HOME="$(dirname "$lib_dir")" # step up to parent dir.

export TMUX_POWERLINE_DIR_HOME
Expand Down
2 changes: 1 addition & 1 deletion lib/muting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# In all cases $1 is the side to be muted (eg left/right).

powerline_muted() {
[ -e "$(__powerline_mute_file "$1")" ];
[ -e "$(__powerline_mute_file "$1")" ]
}

toggle_powerline_mute_status() {
Expand Down
6 changes: 3 additions & 3 deletions main.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
set -o errexit
set -o pipefail

TMUX_POWERLINE_DIR_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TMUX_POWERLINE_DIR_HOME="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export TMUX_POWERLINE_DIR_HOME

# Obtain the left/right status length settings by reading the tmux-powerline config.
Expand Down Expand Up @@ -39,8 +39,8 @@ if [ "$TMUX_POWERLINE_STATUS_VISIBILITY" = "2" ]; then
window_status=1
left_right_status=0
fi
tmux set-option -g status-format["$window_status"] "${TMUX_POWERLINE_STATUS_FORMAT_WINDOW:-${TMUX_POWERLINE_STATUS_FORMAT_WINDOW_DEFAULT}}"
tmux set-option -g status-format["$left_right_status"] "${TMUX_POWERLINE_STATUS_FORMAT_LEFT:-${TMUX_POWERLINE_STATUS_FORMAT_LEFT_DEFAULT}}"
tmux set-option -g status-format["$window_status"] "${TMUX_POWERLINE_STATUS_FORMAT_WINDOW:-${TMUX_POWERLINE_STATUS_FORMAT_WINDOW_DEFAULT}}"
tmux set-option -g status-format["$left_right_status"] "${TMUX_POWERLINE_STATUS_FORMAT_LEFT:-${TMUX_POWERLINE_STATUS_FORMAT_LEFT_DEFAULT}}"
tmux set-option -ag status-format["$left_right_status"] "${TMUX_POWERLINE_STATUS_FORMAT_RIGHT:-${TMUX_POWERLINE_STATUS_FORMAT_RIGHT_DEFAULT}}"
fi

Expand Down
2 changes: 1 addition & 1 deletion mute_powerline.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

TMUX_POWERLINE_DIR_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TMUX_POWERLINE_DIR_HOME="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export TMUX_POWERLINE_DIR_HOME

source "${TMUX_POWERLINE_DIR_HOME}/config/paths.sh"
Expand Down
2 changes: 1 addition & 1 deletion powerline.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

TMUX_POWERLINE_DIR_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TMUX_POWERLINE_DIR_HOME="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export TMUX_POWERLINE_DIR_HOME

# shellcheck source=lib/headers.sh
Expand Down
Loading

0 comments on commit 47f3414

Please sign in to comment.