Merge pull request #24 from uttarayan21/master

Added option to change the smiley face
This commit is contained in:
Dane Williams 2020-05-26 14:49:13 -07:00 committed by GitHub
commit 4234d14477
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 8 deletions

View file

@ -20,4 +20,6 @@ Customize the status bar by adding any of these lines to your .tmux.conf as desi
* Disable weather functionality: `set -g @dracula-show-weather false` * Disable weather functionality: `set -g @dracula-show-weather false`
* Switch from default fahrenheit to celsius: `set -g @dracula-show-fahrenheit false` * Switch from default fahrenheit to celsius: `set -g @dracula-show-fahrenheit false`
* Enable powerline symbols: `set -g @dracula-show-powerline true` * Enable powerline symbols: `set -g @dracula-show-powerline true`
* Switch powerline symbols `set -g @dracula-show-left-sep ` for left and `set -g @dracula-show-right-sep ` for right symbol
* Enable military time: `set -g @dracula-military-time true` * Enable military time: `set -g @dracula-military-time true`
* Switch the left smiley icon `set -g @dracula-show-left-icon session` it can accept `session`, `smiley`, or any charachter.

View file

@ -1,11 +1,39 @@
#!/usr/bin/env bash #!/usr/bin/env bash
linux_acpi() {
arg=$1
BAT=$(ls -d /sys/class/power_supply/BAT* | head -1)
if [ ! -x "$(which acpi 2> /dev/null)" ];then
case "$arg" in
status)
cat $BAT/status
;;
percent)
cat $BAT/capacity
;;
*)
;;
esac
else
case "$arg" in
status)
acpi | cut -d: -f2- | cut -d, -f1 | tr -d ' '
;;
percent)
acpi | cut -d: -f2- | cut -d, -f2 | tr -d '% '
;;
*)
;;
esac
fi
}
battery_percent() battery_percent()
{ {
# Check OS # Check OS
case $(uname -s) in case $(uname -s) in
Linux) Linux)
cat /sys/class/power_supply/BAT0/capacity linux_acpi percent
;; ;;
Darwin) Darwin)
@ -26,7 +54,7 @@ battery_status()
# Check OS # Check OS
case $(uname -s) in case $(uname -s) in
Linux) Linux)
status=$(cat /sys/class/power_supply/BAT0/status) status=$(linux_acpi status)
;; ;;
Darwin) Darwin)
@ -41,7 +69,7 @@ battery_status()
;; ;;
esac esac
if [[ $status = 'discharging' ]] || [[ $status = 'Discharging' ]]; then if [[ "$status" = 'discharging' ]] || [[ "$status" = 'Discharging' ]]; then
echo '' echo ''
else else
echo 'AC ' echo 'AC '

View file

@ -21,8 +21,10 @@ main()
show_weather=$(get_tmux_option "@dracula-show-weather" true) show_weather=$(get_tmux_option "@dracula-show-weather" true)
show_fahrenheit=$(get_tmux_option "@dracula-show-fahrenheit" true) show_fahrenheit=$(get_tmux_option "@dracula-show-fahrenheit" true)
show_powerline=$(get_tmux_option "@dracula-show-powerline" false) show_powerline=$(get_tmux_option "@dracula-show-powerline" false)
show_left_icon=$(get_tmux_option "@dracula-show-left-icon" smiley)
show_military=$(get_tmux_option "@dracula-military-time" false) show_military=$(get_tmux_option "@dracula-military-time" false)
show_left_sep=$(get_tmux_option "@dracula-show-left-sep")
show_right_sep=$(get_tmux_option "@dracula-show-right-sep")
# Dracula Color Pallette # Dracula Color Pallette
white='#f8f8f2' white='#f8f8f2'
gray='#44475a' gray='#44475a'
@ -36,9 +38,18 @@ main()
pink='#ff79c6' pink='#ff79c6'
yellow='#f1fa8c' yellow='#f1fa8c'
case $show_left_icon in
smiley)
left_icon="☺ ";;
session)
left_icon="#W ";;
*)
left_icon=$show_left_icon;;
esac
if $show_powerline; then if $show_powerline; then
right_sep='' right_sep="$show_right_sep"
left_sep='' left_sep="$show_left_sep"
fi fi
# start weather script in background # start weather script in background
if $show_weather; then if $show_weather; then
@ -67,7 +78,7 @@ main()
if $show_powerline; then if $show_powerline; then
tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} #[fg=${green},bg=${gray}]#{?client_prefix,#[fg=${yellow}],}${left_sep} " 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}"
tmux set-option -g status-right "" tmux set-option -g status-right ""
powerbg=${gray} powerbg=${gray}
@ -95,7 +106,7 @@ main()
# window tabs # window tabs
tmux set-window-option -g window-status-current-format "#[fg=${gray},bg=${dark_purple}]${left_sep}#[fg=${white},bg=${dark_purple}] #I #W #[fg=${dark_purple},bg=${gray}]${left_sep}" tmux set-window-option -g window-status-current-format "#[fg=${gray},bg=${dark_purple}]${left_sep}#[fg=${white},bg=${dark_purple}] #I #W #[fg=${dark_purple},bg=${gray}]${left_sep}"
else else
tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} " tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon}"
tmux set-option -g status-right "" tmux set-option -g status-right ""