Skip to content

Commit

Permalink
Merge branch 'master' into patch2
Browse files Browse the repository at this point in the history
  • Loading branch information
ethancedwards8 authored Oct 17, 2024
2 parents 784106d + 2c5913d commit 83464a1
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 48 deletions.
11 changes: 10 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ programs.tmux = {

#### Configuration

To enable plugins set up the `@dracula-plugins` option in you `.tmux.conf` file, separate plugin by space.
To enable plugins set up the `@dracula-plugins` option in your `.tmux.conf` file, separate plugin by space.
The order that you define the plugins will be the order on the status bar left to right.

```bash
Expand Down Expand Up @@ -117,6 +117,15 @@ Hide empty plugins
set -g @dracula-show-empty-plugins false
```

Make the powerline background transparent

```bash
set -g @dracula-powerline-bg-transparent true

# the left separator symbol is inversed with a transparent background, you can modify it with any symbol you like
set -g @dracula-inverse-divider 
```

#### cpu-usage options

Customize label
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ Configuration and options can be found at [draculatheme.com/tmux](https://dracul
- When prefix is enabled, a smiley face turns from green to yellow
- When charging, 'AC' is displayed
- Alternatively show battery level and whether its charging next to percentage by setting:
`set -g @dracula-battery-label false`
`set -g @dracula-show-battery-status true`
```
set -g @dracula-battery-label false
set -g @dracula-no-battery-label false
set -g @dracula-show-battery-status true
```
- If forecast information is available, a ☀, ☁, ☂, or ❄ unicode character corresponding with the forecast is displayed alongside the temperature
- Info if the Panes are synchronized
- Spotify playback (needs the tool spotify-tui installed). max-len can be configured.
Expand Down
35 changes: 20 additions & 15 deletions scripts/battery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ linux_acpi() {
arg=$1
BAT=$(ls -d /sys/class/power_supply/*)
if [ ! -x "$(which acpi 2> /dev/null)" ];then
case "$arg" in
status)
cat $BAT/status
;;

percent)
cat $BAT/capacity
;;

*)
;;
esac
for DEV in $BAT; do
case "$arg" in
status)
[ -f "$DEV/status" ] && cat "$DEV/status"
;;
percent)
[ -f "$DEV/capacity" ] && cat "$DEV/capacity"
;;
*)
;;
esac
done
else
case "$arg" in
status)
Expand Down Expand Up @@ -106,7 +106,7 @@ battery_status()
)
echo "${battery_labels[$((bat_perc/10*10))]:-󰂃}"
;;
high|Full)
high|charged|Full)
echo "󰁹"
;;
charging|Charging)
Expand Down Expand Up @@ -151,10 +151,15 @@ battery_status()
main()
{
bat_label=$(get_tmux_option "@dracula-battery-label" "")
if [ "$bat_label" ]; then
if [ "$bat_label" == false ]; then
bat_label=""
fi

no_bat_label=$(get_tmux_option "@dracula-no-battery-label" "AC")
if [ "$no_bat_label" == false ]; then
no_bat_label=""
fi

show_bat_label=$(get_tmux_option "@dracula-show-battery-status" false)
if $show_bat_label; then
bat_stat=$(battery_status)
Expand All @@ -167,7 +172,7 @@ main()
if [ -z "$bat_stat" ]; then # Test if status is empty or not
echo "$bat_label $bat_perc"
elif [ -z "$bat_perc" ]; then # In case it is a desktop with no battery percent, only AC power
echo ""
echo "$no_bat_label"
else
echo "$bat_label$bat_stat $bat_perc"
fi
Expand Down
47 changes: 31 additions & 16 deletions scripts/dracula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ main()
show_location=$(get_tmux_option "@dracula-show-location" true)
fixed_location=$(get_tmux_option "@dracula-fixed-location")
show_powerline=$(get_tmux_option "@dracula-show-powerline" false)
transparent_powerline_bg=$(get_tmux_option "@dracula-transparent-powerline-bg" false)
show_flags=$(get_tmux_option "@dracula-show-flags" false)
show_left_icon=$(get_tmux_option "@dracula-show-left-icon" smiley)
show_left_icon_padding=$(get_tmux_option "@dracula-left-icon-padding" 1)
Expand All @@ -26,6 +27,7 @@ main()
show_timezone=$(get_tmux_option "@dracula-show-timezone" true)
show_left_sep=$(get_tmux_option "@dracula-show-left-sep")
show_right_sep=$(get_tmux_option "@dracula-show-right-sep")
show_inverse_divider=$(get_tmux_option "@dracula-inverse-divider")
show_border_contrast=$(get_tmux_option "@dracula-border-contrast" false)
show_day_month=$(get_tmux_option "@dracula-day-month" false)
show_refresh=$(get_tmux_option "@dracula-refresh-rate" 5)
Expand All @@ -37,17 +39,30 @@ main()
show_empty_plugins=$(get_tmux_option "@dracula-show-empty-plugins" true)

# Dracula Color Pallette
white='#f8f8f2'
gray='#44475a'
dark_gray='#282a36'
light_purple='#bd93f9'
dark_purple='#6272a4'
cyan='#8be9fd'
green='#50fa7b'
orange='#ffb86c'
red='#ff5555'
pink='#ff79c6'
yellow='#f1fa8c'
white=$(get_tmux_option "@dracula-color-white" "#f8f8f2")
gray=$(get_tmux_option "@dracula-color-gray" "#44475a")
dark_gray=$(get_tmux_option "@dracula-color-dark_gray" "#282a36")
light_purple=$(get_tmux_option "@dracula-color-light_purple" "#bd93f9")
dark_purple=$(get_tmux_option "@dracula-color-dark_purple" "#6272a4")
cyan=$(get_tmux_option "@dracula-color-cyan" "#8be9fd")
green=$(get_tmux_option "@dracula-color-green" "#50fa7b")
orange=$(get_tmux_option "@dracula-color-orange" "#ffb86c")
red=$(get_tmux_option "@dracula-color-red" "#ff5555")
pink=$(get_tmux_option "@dracula-color-pink" "#ff79c6")
yellow=$(get_tmux_option "@dracula-color-yellow" "#f1fa8c")

# Set transparency variables - Colors and window dividers
if $transparent_powerline_bg; then
bg_color="default"
window_sep_fg=${dark_purple}
window_sep_bg=default
window_sep="$show_inverse_divider"
else
bg_color=${gray}
window_sep_fg=${gray}
window_sep_bg=${dark_purple}
window_sep="$show_left_sep"
fi

# Handle left icon configuration
case $show_left_icon in
Expand Down Expand Up @@ -123,12 +138,12 @@ main()
tmux set-option -g message-style "bg=${gray},fg=${white}"

# status bar
tmux set-option -g status-style "bg=${gray},fg=${white}"
tmux set-option -g status-style "bg=${bg_color},fg=${white}"

# Status left
if $show_powerline; then
tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon} #[fg=${green},bg=${gray}]#{?client_prefix,#[fg=${yellow}],}${left_sep}"
powerbg=${gray}
tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon} #[fg=${green},bg=${bg_color}]#{?client_prefix,#[fg=${yellow}],}${left_sep}"
powerbg=${bg_color}
else
tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon}"
fi
Expand Down Expand Up @@ -295,12 +310,12 @@ main()

# Window option
if $show_powerline; then
tmux set-window-option -g window-status-current-format "#[fg=${gray},bg=${dark_purple}]${left_sep}#[fg=${white},bg=${dark_purple}] #I #W${current_flags} #[fg=${dark_purple},bg=${gray}]${left_sep}"
tmux set-window-option -g window-status-current-format "#[fg=${window_sep_fg},bg=${window_sep_bg}]${window_sep}#[fg=${white},bg=${dark_purple}] #I #W${current_flags} #[fg=${dark_purple},bg=${bg_color}]${left_sep}"
else
tmux set-window-option -g window-status-current-format "#[fg=${white},bg=${dark_purple}] #I #W${current_flags} "
fi

tmux set-window-option -g window-status-format "#[fg=${white}]#[bg=${gray}] #I #W${flags}"
tmux set-window-option -g window-status-format "#[fg=${white}]#[bg=${bg_color}] #I #W${flags}"
tmux set-window-option -g window-status-activity-style "bold"
tmux set-window-option -g window-status-bell-style "bold"
}
Expand Down
10 changes: 6 additions & 4 deletions scripts/network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ source $current_dir/utils.sh

# set your own hosts so that a wifi is recognised even without internet access
HOSTS=$(get_tmux_option "@dracula-network-hosts" "google.com github.com example.com")
wifi_label=$(get_tmux_option "@dracula-network-wifi-label" "")
ethernet_label=$(get_tmux_option "@dracula-network-ethernet-label" "Ethernet")

get_ssid()
{
Expand All @@ -15,9 +17,9 @@ get_ssid()
Linux)
SSID=$(iw dev | sed -nr 's/^\t\tssid (.*)/\1/p')
if [ -n "$SSID" ]; then
printf '%s' "$wifi_label$SSID"
echo "$wifi_label$SSID"
else
echo "$(get_tmux_option "@dracula-network-ethernet-label" "Ethernet")"
echo "$ethernet_label"
fi
;;

Expand All @@ -26,7 +28,7 @@ get_ssid()
wifi_label=$(get_tmux_option "@dracula-network-wifi-label" "")
echo "$wifi_label$(ipconfig getsummary en0 | awk -F ' SSID : ' '/ SSID : / {print $2}')"
else
echo "$(get_tmux_option "@dracula-network-ethernet-label" "Ethernet")"
echo "$ethernet_label"
fi
;;

Expand All @@ -44,7 +46,7 @@ main()
{
network="$(get_tmux_option "@dracula-network-offline-label" "Offline")"
for host in $HOSTS; do
if ping -q -c 1 -W 1 $host &>/dev/null; then
if ping -q -c 1 -W 1 "$host" &>/dev/null; then
network="$(get_ssid)"
break
fi
Expand Down
20 changes: 10 additions & 10 deletions scripts/utils.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#!/usr/bin/env bash

get_tmux_option() {
local option=$1
local default_value=$2
local option_value=$(tmux show-option -gqv "$option")
local option="$1"
local default_value="$2"
local option_value="$(tmux show-option -gqv "$option")"
if [ -z "$option_value" ]; then
echo $default_value
echo "$default_value"
else
echo $option_value
echo "$option_value"
fi
}

get_tmux_window_option() {
local option=$1
local default_value=$2
local option_value=$(tmux show-window-options -v "$option")
local option="$1"
local default_value="$2"
local option_value="$(tmux show-window-options -v "$option")"
if [ -z "$option_value" ]; then
echo $default_value
echo "$default_value"
else
echo $option_value
echo "$option_value"
fi
}

Expand Down

0 comments on commit 83464a1

Please sign in to comment.