Skip to content

Commit

Permalink
Merge pull request #110 from o0th/customizations
Browse files Browse the repository at this point in the history
Customizations
  • Loading branch information
ethancedwards8 authored Jul 22, 2021
2 parents dbdc65d + 832d064 commit cd5e751
Show file tree
Hide file tree
Showing 12 changed files with 572 additions and 515 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*]
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
143 changes: 120 additions & 23 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

If you are a tpm user, you can install the theme and keep up to date by adding the following to your .tmux.conf file:

set -g @plugin 'dracula/tmux'
set -g @plugin 'dracula/tmux'

Add any configuration options below this line in your tmux config.

Expand Down Expand Up @@ -44,25 +44,122 @@ programs.tmux = {

#### Configuration

Customize the status bar by adding any of these lines to your .tmux.conf as desired:
* Disable battery functionality: `set -g @dracula-show-battery false`
* Disable network functionality: `set -g @dracula-show-network false`
* Enable network bandwith functionality: `set -g @dracula-network-bandwith $network_name`
- You could get the `$network_name` through the command: `sudo lshw -class network -short | grep wl | awk '{print $2}'`
* Disable weather functionality: `set -g @dracula-show-weather false`
* Disable time functionality: `set -g @dracula-show-time false`
* Disable location information: `set -g @dracula-show-location false`
* Switch from default fahrenheit to celsius: `set -g @dracula-show-fahrenheit false`
* 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 (can set any symbol you like as seperator)
* Enable window flags: `set -g @dracula-show-flags true`
* Adjust the refresh rate for the bar `set -g @dracula-refresh-rate 5` the default is 5, it can accept any number
* Enable military time: `set -g @dracula-military-time true`
* Disable timezone: `set -g @dracula-show-timezone false`
* Switch the left smiley icon `set -g @dracula-show-left-icon session` it can accept `session`, `smiley`, `window`, or any character.
* Add padding to the left smiley icon `set -g @dracula-left-icon-padding` default is 1, it can accept any number and 0 disables padding.
* Enable high contrast pane border: `set -g @dracula-border-contrast true`
* Enable cpu usage: `set -g @dracula-cpu-usage true`
* Enable ram usage: `set -g @dracula-ram-usage true`
* Enable gpu usage: `set -g @dracula-gpu-usage true`
* Swap date to day/month `set -g @dracula-day-month true`
To enable plugins set up the `@dracula-plugins` option in you `.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
# available plugins: battery, cpu-usage, gpu-usage, ram-usage, network, network-bandwith, weather, time
set -g @dracula-plugins "cpu-usage gpu-usage ram-usage"
```

For each plugin is possible to customize background and foreground colors

```bash
# available colors: white, gray, dark_gray, light_purple, dark_purple, cyan, green, orange, red, pink, yellow
# set -g @dracula-[plugin-name]-colors "[background] [foreground]"
set -g @dracula-cpu-usage-colors "pink dark_gray"
```

#### Status bar options

Enable powerline symbols

```bash
set -g @dracula-show-powerline true
```

Switch powerline symbols

```bash
# for left
set -g @dracula-show-left-sep 

# for right symbol (can set any symbol you like as seperator)
set -g @dracula-show-right-sep 
```

Enable window flags

```bash
set -g @dracula-show-flags true
```

Adjust the refresh rate for the status bar

```bash
# the default is 5, it can accept any number
set -g @dracula-refresh-rate 5
```

Switch the left smiley icon

```bash
# it can accept `session`, `smiley`, `window`, or any character.
set -g @dracula-show-left-icon session
```

Add padding to the left smiley icon

```bash
# default is 1, it can accept any number and 0 disables padding.
set -g @dracula-left-icon-padding 1
```

Enable high contrast pane border

```bash
set -g @dracula-border-contrast true
```

#### cpu-usage options

Customize label

```bash
set -g @dracula-cpu-usage-label "CPU"
```

#### gpu-usage options

Customize label

```bash
set -g @dracula-gpu-usage-label "GPU"
```

#### ram-usage options

Customize label

```bash
set -g @dracula-ram-usage-label "RAM"
```

#### time options

Disable timezone

```bash
set -g @dracula-show-timezone false
```

Swap date to day/month

```bash
set -g @dracula-day-month true
```

Enable military time

```bash
set -g @dracula-military-time true
```

#### weather options

Switch from default fahrenheit to celsius

```bash
set -g @dracula-show-fahrenheit false
```

206 changes: 103 additions & 103 deletions scripts/battery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,121 +3,121 @@
export LC_ALL=en_US.UTF-8

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
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()
{
# Check OS
case $(uname -s) in
Linux)
percent=$(linux_acpi percent)
[ -n "$percent" ] && echo " $percent"
;;

Darwin)
echo $(pmset -g batt | grep -Eo '[0-9]?[0-9]?[0-9]%')
;;

FreeBSD)
echo $(apm | sed '8,11d' | grep life | awk '{print $4}')
;;

CYGWIN*|MINGW32*|MSYS*|MINGW*)
# leaving empty - TODO - windows compatability
;;

*)
;;
esac
# Check OS
case $(uname -s) in
Linux)
percent=$(linux_acpi percent)
[ -n "$percent" ] && echo " $percent"
;;

Darwin)
echo $(pmset -g batt | grep -Eo '[0-9]?[0-9]?[0-9]%')
;;

FreeBSD)
echo $(apm | sed '8,11d' | grep life | awk '{print $4}')
;;

CYGWIN*|MINGW32*|MSYS*|MINGW*)
# leaving empty - TODO - windows compatability
;;

*)
;;
esac
}

battery_status()
{
# Check OS
case $(uname -s) in
Linux)
status=$(linux_acpi status)
;;

Darwin)
status=$(pmset -g batt | sed -n 2p | cut -d ';' -f 2 | tr -d " ")
;;

FreeBSD)
status=$(apm | sed '8,11d' | grep Status | awk '{printf $3}')
;;

CYGWIN*|MINGW32*|MSYS*|MINGW*)
# leaving empty - TODO - windows compatability
;;

*)
;;
esac

case $status in
discharging|Discharging)
echo ''
;;
high)
echo ''
;;
charging)
echo 'AC'
;;
*)
echo 'AC'
;;
esac
### Old if statements didn't work on BSD, they're probably not POSIX compliant, not sure
# if [ $status = 'discharging' ] || [ $status = 'Discharging' ]; then
# echo ''
# # elif [ $status = 'charging' ]; then # This is needed for FreeBSD AC checking support
# # echo 'AC'
# else
# echo 'AC'
# fi
# Check OS
case $(uname -s) in
Linux)
status=$(linux_acpi status)
;;

Darwin)
status=$(pmset -g batt | sed -n 2p | cut -d ';' -f 2 | tr -d " ")
;;

FreeBSD)
status=$(apm | sed '8,11d' | grep Status | awk '{printf $3}')
;;

CYGWIN*|MINGW32*|MSYS*|MINGW*)
# leaving empty - TODO - windows compatability
;;

*)
;;
esac

case $status in
discharging|Discharging)
echo ''
;;
high)
echo ''
;;
charging)
echo 'AC'
;;
*)
echo 'AC'
;;
esac
### Old if statements didn't work on BSD, they're probably not POSIX compliant, not sure
# if [ $status = 'discharging' ] || [ $status = 'Discharging' ]; then
# echo ''
# # elif [ $status = 'charging' ]; then # This is needed for FreeBSD AC checking support
# # echo 'AC'
# else
# echo 'AC'
# fi
}

main()
{
bat_stat=$(battery_status)
bat_perc=$(battery_percent)

if [ -z "$bat_stat" ]; then # Test if status is empty or not
echo "$bat_perc"
elif [ -z "$bat_perc" ]; then # In case it is a desktop with no battery percent, only AC power
echo "$bat_stat"
else
echo "$bat_stat $bat_perc"
fi
bat_stat=$(battery_status)
bat_perc=$(battery_percent)

if [ -z "$bat_stat" ]; then # Test if status is empty or not
echo "$bat_perc"
elif [ -z "$bat_perc" ]; then # In case it is a desktop with no battery percent, only AC power
echo "$bat_stat"
else
echo "$bat_stat $bat_perc"
fi
}

#run main driver program
Expand Down
Loading

0 comments on commit cd5e751

Please sign in to comment.