diff --git a/README.md b/README.md index d86fd724..af33a4d4 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,14 @@ set -g @tokyo-night-tmux_battery_low_threshold 21 # default Set variable value `0` to disable the widget. Remember to restart `tmux` after changing values. +#### Hostname Widget + +```bash +set -g @tokyo-night-tmux_show_hostname 1 +``` + +![Snap hostname](snaps/hostname.png) + ## Styles - `none`: no style, default font diff --git a/snaps/hostname.png b/snaps/hostname.png new file mode 100644 index 00000000..c6caf40b Binary files /dev/null and b/snaps/hostname.png differ diff --git a/src/hostname-widget.sh b/src/hostname-widget.sh new file mode 100755 index 00000000..cac2d1bc --- /dev/null +++ b/src/hostname-widget.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# Imports +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.." +. "${ROOT_DIR}/lib/coreutils-compat.sh" + +# Check if enabled +ENABLED=$(tmux show-option -gv @tokyo-night-tmux_show_hostname 2>/dev/null) +[[ ${ENABLED} -ne 1 ]] && exit 0 + +CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source $CURRENT_DIR/themes.sh + +hostname=$(hostnamectl hostname) + +echo "#[fg=red,bold,bg=default]░ @ #[fg=brightwhite,bg=${THEME[background]}]${hostname}" diff --git a/tokyo-night.tmux b/tokyo-night.tmux index 6a55454c..52749ac0 100755 --- a/tokyo-night.tmux +++ b/tokyo-night.tmux @@ -51,6 +51,7 @@ zoom_number="#($SCRIPTS_PATH/custom-number.sh #P $zoom_id_style)" date_and_time="$($SCRIPTS_PATH/datetime-widget.sh)" current_path="#($SCRIPTS_PATH/path-widget.sh #{pane_current_path})" battery_status="#($SCRIPTS_PATH/battery-widget.sh)" +hostname="#($SCRIPTS_PATH/hostname-widget.sh)" #+--- Bars LEFT ---+ # Session name @@ -63,5 +64,5 @@ tmux set -g window-status-current-format "$RESET#[fg=${THEME[green]},bg=${THEME[ tmux set -g window-status-format "$RESET#[fg=${THEME[foreground]}] #{?#{==:#{pane_current_command},ssh},󰣀 , }${RESET}$window_number#W#[nobold,dim]#{?window_zoomed_flag, $zoom_number, $custom_pane}#[fg=${THEME[yellow]}]#{?window_last_flag,󰁯 , }" #+--- Bars RIGHT ---+ -tmux set -g status-right "$battery_status$current_path$cmus_status$netspeed$git_status$wb_git_status$date_and_time" +tmux set -g status-right "$battery_status$current_path$cmus_status$netspeed$git_status$wb_git_status$date_and_time$hostname" tmux set -g window-status-separator ""