Skip to content

Commit cd5e751

Browse files
Merge pull request #110 from o0th/customizations
Customizations
2 parents dbdc65d + 832d064 commit cd5e751

12 files changed

+572
-515
lines changed

.editorconfig

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[*]
2+
indent_size = 2
3+
indent_style = space
4+
insert_final_newline = true
5+
trim_trailing_whitespace = true

INSTALL.md

+120-23
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
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:
66

7-
set -g @plugin 'dracula/tmux'
7+
set -g @plugin 'dracula/tmux'
88

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

@@ -44,25 +44,122 @@ programs.tmux = {
4444

4545
#### Configuration
4646

47-
Customize the status bar by adding any of these lines to your .tmux.conf as desired:
48-
* Disable battery functionality: `set -g @dracula-show-battery false`
49-
* Disable network functionality: `set -g @dracula-show-network false`
50-
* Enable network bandwith functionality: `set -g @dracula-network-bandwith $network_name`
51-
- You could get the `$network_name` through the command: `sudo lshw -class network -short | grep wl | awk '{print $2}'`
52-
* Disable weather functionality: `set -g @dracula-show-weather false`
53-
* Disable time functionality: `set -g @dracula-show-time false`
54-
* Disable location information: `set -g @dracula-show-location false`
55-
* Switch from default fahrenheit to celsius: `set -g @dracula-show-fahrenheit false`
56-
* Enable powerline symbols: `set -g @dracula-show-powerline true`
57-
* 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)
58-
* Enable window flags: `set -g @dracula-show-flags true`
59-
* Adjust the refresh rate for the bar `set -g @dracula-refresh-rate 5` the default is 5, it can accept any number
60-
* Enable military time: `set -g @dracula-military-time true`
61-
* Disable timezone: `set -g @dracula-show-timezone false`
62-
* Switch the left smiley icon `set -g @dracula-show-left-icon session` it can accept `session`, `smiley`, `window`, or any character.
63-
* 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.
64-
* Enable high contrast pane border: `set -g @dracula-border-contrast true`
65-
* Enable cpu usage: `set -g @dracula-cpu-usage true`
66-
* Enable ram usage: `set -g @dracula-ram-usage true`
67-
* Enable gpu usage: `set -g @dracula-gpu-usage true`
68-
* Swap date to day/month `set -g @dracula-day-month true`
47+
To enable plugins set up the `@dracula-plugins` option in you `.tmux.conf` file, separate plugin by space.
48+
The order that you define the plugins will be the order on the status bar left to right.
49+
50+
```bash
51+
# available plugins: battery, cpu-usage, gpu-usage, ram-usage, network, network-bandwith, weather, time
52+
set -g @dracula-plugins "cpu-usage gpu-usage ram-usage"
53+
```
54+
55+
For each plugin is possible to customize background and foreground colors
56+
57+
```bash
58+
# available colors: white, gray, dark_gray, light_purple, dark_purple, cyan, green, orange, red, pink, yellow
59+
# set -g @dracula-[plugin-name]-colors "[background] [foreground]"
60+
set -g @dracula-cpu-usage-colors "pink dark_gray"
61+
```
62+
63+
#### Status bar options
64+
65+
Enable powerline symbols
66+
67+
```bash
68+
set -g @dracula-show-powerline true
69+
```
70+
71+
Switch powerline symbols
72+
73+
```bash
74+
# for left
75+
set -g @dracula-show-left-sep 
76+
77+
# for right symbol (can set any symbol you like as seperator)
78+
set -g @dracula-show-right-sep 
79+
```
80+
81+
Enable window flags
82+
83+
```bash
84+
set -g @dracula-show-flags true
85+
```
86+
87+
Adjust the refresh rate for the status bar
88+
89+
```bash
90+
# the default is 5, it can accept any number
91+
set -g @dracula-refresh-rate 5
92+
```
93+
94+
Switch the left smiley icon
95+
96+
```bash
97+
# it can accept `session`, `smiley`, `window`, or any character.
98+
set -g @dracula-show-left-icon session
99+
```
100+
101+
Add padding to the left smiley icon
102+
103+
```bash
104+
# default is 1, it can accept any number and 0 disables padding.
105+
set -g @dracula-left-icon-padding 1
106+
```
107+
108+
Enable high contrast pane border
109+
110+
```bash
111+
set -g @dracula-border-contrast true
112+
```
113+
114+
#### cpu-usage options
115+
116+
Customize label
117+
118+
```bash
119+
set -g @dracula-cpu-usage-label "CPU"
120+
```
121+
122+
#### gpu-usage options
123+
124+
Customize label
125+
126+
```bash
127+
set -g @dracula-gpu-usage-label "GPU"
128+
```
129+
130+
#### ram-usage options
131+
132+
Customize label
133+
134+
```bash
135+
set -g @dracula-ram-usage-label "RAM"
136+
```
137+
138+
#### time options
139+
140+
Disable timezone
141+
142+
```bash
143+
set -g @dracula-show-timezone false
144+
```
145+
146+
Swap date to day/month
147+
148+
```bash
149+
set -g @dracula-day-month true
150+
```
151+
152+
Enable military time
153+
154+
```bash
155+
set -g @dracula-military-time true
156+
```
157+
158+
#### weather options
159+
160+
Switch from default fahrenheit to celsius
161+
162+
```bash
163+
set -g @dracula-show-fahrenheit false
164+
```
165+

scripts/battery.sh

+103-103
Original file line numberDiff line numberDiff line change
@@ -3,121 +3,121 @@
33
export LC_ALL=en_US.UTF-8
44

55
linux_acpi() {
6-
arg=$1
7-
BAT=$(ls -d /sys/class/power_supply/BAT* | head -1)
8-
if [ ! -x "$(which acpi 2> /dev/null)" ];then
9-
case "$arg" in
10-
status)
11-
cat $BAT/status
12-
;;
13-
14-
percent)
15-
cat $BAT/capacity
16-
;;
17-
18-
*)
19-
;;
20-
esac
21-
else
22-
case "$arg" in
23-
status)
24-
acpi | cut -d: -f2- | cut -d, -f1 | tr -d ' '
25-
;;
26-
percent)
27-
acpi | cut -d: -f2- | cut -d, -f2 | tr -d '% '
28-
;;
29-
*)
30-
;;
31-
esac
32-
fi
6+
arg=$1
7+
BAT=$(ls -d /sys/class/power_supply/BAT* | head -1)
8+
if [ ! -x "$(which acpi 2> /dev/null)" ];then
9+
case "$arg" in
10+
status)
11+
cat $BAT/status
12+
;;
13+
14+
percent)
15+
cat $BAT/capacity
16+
;;
17+
18+
*)
19+
;;
20+
esac
21+
else
22+
case "$arg" in
23+
status)
24+
acpi | cut -d: -f2- | cut -d, -f1 | tr -d ' '
25+
;;
26+
percent)
27+
acpi | cut -d: -f2- | cut -d, -f2 | tr -d '% '
28+
;;
29+
*)
30+
;;
31+
esac
32+
fi
3333
}
3434

3535
battery_percent()
3636
{
37-
# Check OS
38-
case $(uname -s) in
39-
Linux)
40-
percent=$(linux_acpi percent)
41-
[ -n "$percent" ] && echo " $percent"
42-
;;
43-
44-
Darwin)
45-
echo $(pmset -g batt | grep -Eo '[0-9]?[0-9]?[0-9]%')
46-
;;
47-
48-
FreeBSD)
49-
echo $(apm | sed '8,11d' | grep life | awk '{print $4}')
50-
;;
51-
52-
CYGWIN*|MINGW32*|MSYS*|MINGW*)
53-
# leaving empty - TODO - windows compatability
54-
;;
55-
56-
*)
57-
;;
58-
esac
37+
# Check OS
38+
case $(uname -s) in
39+
Linux)
40+
percent=$(linux_acpi percent)
41+
[ -n "$percent" ] && echo " $percent"
42+
;;
43+
44+
Darwin)
45+
echo $(pmset -g batt | grep -Eo '[0-9]?[0-9]?[0-9]%')
46+
;;
47+
48+
FreeBSD)
49+
echo $(apm | sed '8,11d' | grep life | awk '{print $4}')
50+
;;
51+
52+
CYGWIN*|MINGW32*|MSYS*|MINGW*)
53+
# leaving empty - TODO - windows compatability
54+
;;
55+
56+
*)
57+
;;
58+
esac
5959
}
6060

6161
battery_status()
6262
{
63-
# Check OS
64-
case $(uname -s) in
65-
Linux)
66-
status=$(linux_acpi status)
67-
;;
68-
69-
Darwin)
70-
status=$(pmset -g batt | sed -n 2p | cut -d ';' -f 2 | tr -d " ")
71-
;;
72-
73-
FreeBSD)
74-
status=$(apm | sed '8,11d' | grep Status | awk '{printf $3}')
75-
;;
76-
77-
CYGWIN*|MINGW32*|MSYS*|MINGW*)
78-
# leaving empty - TODO - windows compatability
79-
;;
80-
81-
*)
82-
;;
83-
esac
84-
85-
case $status in
86-
discharging|Discharging)
87-
echo ''
88-
;;
89-
high)
90-
echo ''
91-
;;
92-
charging)
93-
echo 'AC'
94-
;;
95-
*)
96-
echo 'AC'
97-
;;
98-
esac
99-
### Old if statements didn't work on BSD, they're probably not POSIX compliant, not sure
100-
# if [ $status = 'discharging' ] || [ $status = 'Discharging' ]; then
101-
# echo ''
102-
# # elif [ $status = 'charging' ]; then # This is needed for FreeBSD AC checking support
103-
# # echo 'AC'
104-
# else
105-
# echo 'AC'
106-
# fi
63+
# Check OS
64+
case $(uname -s) in
65+
Linux)
66+
status=$(linux_acpi status)
67+
;;
68+
69+
Darwin)
70+
status=$(pmset -g batt | sed -n 2p | cut -d ';' -f 2 | tr -d " ")
71+
;;
72+
73+
FreeBSD)
74+
status=$(apm | sed '8,11d' | grep Status | awk '{printf $3}')
75+
;;
76+
77+
CYGWIN*|MINGW32*|MSYS*|MINGW*)
78+
# leaving empty - TODO - windows compatability
79+
;;
80+
81+
*)
82+
;;
83+
esac
84+
85+
case $status in
86+
discharging|Discharging)
87+
echo ''
88+
;;
89+
high)
90+
echo ''
91+
;;
92+
charging)
93+
echo 'AC'
94+
;;
95+
*)
96+
echo 'AC'
97+
;;
98+
esac
99+
### Old if statements didn't work on BSD, they're probably not POSIX compliant, not sure
100+
# if [ $status = 'discharging' ] || [ $status = 'Discharging' ]; then
101+
# echo ''
102+
# # elif [ $status = 'charging' ]; then # This is needed for FreeBSD AC checking support
103+
# # echo 'AC'
104+
# else
105+
# echo 'AC'
106+
# fi
107107
}
108108

109109
main()
110110
{
111-
bat_stat=$(battery_status)
112-
bat_perc=$(battery_percent)
113-
114-
if [ -z "$bat_stat" ]; then # Test if status is empty or not
115-
echo "$bat_perc"
116-
elif [ -z "$bat_perc" ]; then # In case it is a desktop with no battery percent, only AC power
117-
echo "$bat_stat"
118-
else
119-
echo "$bat_stat $bat_perc"
120-
fi
111+
bat_stat=$(battery_status)
112+
bat_perc=$(battery_percent)
113+
114+
if [ -z "$bat_stat" ]; then # Test if status is empty or not
115+
echo "$bat_perc"
116+
elif [ -z "$bat_perc" ]; then # In case it is a desktop with no battery percent, only AC power
117+
echo "$bat_stat"
118+
else
119+
echo "$bat_stat $bat_perc"
120+
fi
121121
}
122122

123123
#run main driver program

0 commit comments

Comments
 (0)