Merge branch 'master' into synchronize-panes
This commit is contained in:
commit
92583ed8b4
9 changed files with 155 additions and 38 deletions
45
INSTALL.md
45
INSTALL.md
|
@ -48,7 +48,8 @@ To enable plugins set up the `@dracula-plugins` option in you `.tmux.conf` file,
|
|||
The order that you define the plugins will be the order on the status bar left to right.
|
||||
|
||||
```bash
|
||||
# available plugins: battery, cpu-usage, git, gpu-usage, ram-usage, network, network-bandwidth, weather, time, synchronize-panes
|
||||
# available plugins: battery, cpu-usage, git, gpu-usage, ram-usage, network, network-bandwidth, network-ping, weather, time, synchronize-panes
|
||||
|
||||
set -g @dracula-plugins "cpu-usage gpu-usage ram-usage"
|
||||
```
|
||||
|
||||
|
@ -119,6 +120,23 @@ Customize label
|
|||
set -g @dracula-cpu-usage-label "CPU"
|
||||
```
|
||||
|
||||
Show system load average instead of CPU usage percentage (default)
|
||||
|
||||
```bash
|
||||
set -g @dracula-cpu-display-load true
|
||||
```
|
||||
|
||||
CPU usage percentage (default) - in percentage (output: %)
|
||||
Load average – is the average system load calculated over a given period of time of 1, 5 and 15 minutes (output: x.x x.x x.x)
|
||||
|
||||
#### battery options
|
||||
|
||||
Customize label
|
||||
|
||||
```bash
|
||||
set -g @dracula-battery-label "Battery"
|
||||
```
|
||||
|
||||
#### gpu-usage options
|
||||
|
||||
Customize label
|
||||
|
@ -135,6 +153,15 @@ Customize label
|
|||
set -g @dracula-ram-usage-label "RAM"
|
||||
```
|
||||
|
||||
#### network-ping options
|
||||
|
||||
You can configure which server (hostname, IP) you want to ping and at which rate (in seconds). Default is google.com at every 5 seconds.
|
||||
|
||||
```bash
|
||||
set -g @dracula-ping-server "google.com"
|
||||
set -g @dracula-ping-rate 5
|
||||
```
|
||||
|
||||
#### time options
|
||||
|
||||
Disable timezone
|
||||
|
@ -180,6 +207,11 @@ Set symbol or message to use when the current pane has no git repo
|
|||
set -g @dracula-git-no-repo-message ""
|
||||
```
|
||||
|
||||
Hide untracked files from being displayed as local changes
|
||||
```bash
|
||||
# default is false
|
||||
set -g @dracula-git-no-untracked-files true
|
||||
```
|
||||
|
||||
#### weather options
|
||||
|
||||
|
@ -189,6 +221,17 @@ Switch from default fahrenheit to celsius
|
|||
set -g @dracula-show-fahrenheit false
|
||||
```
|
||||
|
||||
Set your location manually
|
||||
|
||||
```bash
|
||||
set -g @dracula-fixed-location "Some City"
|
||||
```
|
||||
|
||||
Hide your location
|
||||
|
||||
```bash
|
||||
set -g @dracula-show-location false
|
||||
```
|
||||
|
||||
#### synchronize-panes options
|
||||
|
||||
|
|
44
README.md
44
README.md
|
@ -14,22 +14,22 @@ Configuration and options can be found at [draculatheme.com/tmux](https://dracul
|
|||
|
||||
## Features
|
||||
|
||||
* Support for powerline
|
||||
* Day, date, time, timezone
|
||||
* Current location based on network with temperature and forecast icon (if available)
|
||||
* Network connection status, bandwidth and SSID
|
||||
* Git branch and status
|
||||
* Battery percentage and AC power connection status
|
||||
* Refresh rate control
|
||||
* CPU usage
|
||||
* RAM usage
|
||||
* GPU usage
|
||||
* Color code based on if prefix is active or not
|
||||
* List of windows with current window highlighted
|
||||
* When prefix is enabled smiley face turns from green to yellow
|
||||
* When charging, 'AC' is displayed
|
||||
* If forecast information is available, a ☀, ☁, ☂, or ❄ unicode character corresponding with the forecast is displayed alongside the temperature
|
||||
* Info if the Panes are synchronized
|
||||
- Support for powerline
|
||||
- Day, date, time, timezone
|
||||
- Current location based on network with temperature and forecast icon (if available)
|
||||
- Network connection status, bandwidth and SSID
|
||||
- Git branch and status
|
||||
- Battery percentage and AC power connection status
|
||||
- Refresh rate control
|
||||
- CPU usage (percentage or load average)
|
||||
- RAM usage
|
||||
- GPU usage
|
||||
- Color code based on if prefix is active or not
|
||||
- List of windows with current window highlighted
|
||||
- When prefix is enabled smiley face turns from green to yellow
|
||||
- When charging, 'AC' is displayed
|
||||
- If forecast information is available, a ☀, ☁, ☂, or ❄ unicode character corresponding with the forecast is displayed alongside the temperature
|
||||
- Info if the Panes are synchronized
|
||||
|
||||
## Compatibility
|
||||
|
||||
|
@ -40,9 +40,15 @@ FreeBSD compatibility is in development
|
|||
|
||||
This theme is maintained by the following person(s) and a bunch of [awesome contributors](https://github.com/dracula/tmux/graphs/contributors).
|
||||
|
||||
[![Dane Williams](https://avatars2.githubusercontent.com/u/22798229?s=70&v=4",)](https://github.com/danerwilliams) | [![Ethan Edwards](https://avatars1.githubusercontent.com/u/60861925?s=70&v=4)](https://github.com/ethancedwards8) |
|
||||
--- | --- |
|
||||
[Dane Williams](https://github.com/danerwilliams) | [Ethan Edwards](https://github.com/ethancedwards8) |
|
||||
| [![Dane Williams](https://avatars2.githubusercontent.com/u/22798229?s=70&v=4",)](https://github.com/danerwilliams) | [![Ethan Edwards](https://avatars1.githubusercontent.com/u/60861925?s=70&v=4)](https://github.com/ethancedwards8) |
|
||||
| ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------- |
|
||||
| [Dane Williams](https://github.com/danerwilliams) | [Ethan Edwards](https://github.com/ethancedwards8) |
|
||||
|
||||
## Community
|
||||
|
||||
- [Twitter](https://twitter.com/draculatheme) - Best for getting updates about themes and new stuff.
|
||||
- [GitHub](https://github.com/dracula/dracula-theme/discussions) - Best for asking questions and discussing issues.
|
||||
- [Discord](https://draculatheme.com/discord-invite) - Best for hanging out with the community.
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
# setting the locale, some users have issues with different locales, this forces the correct one
|
||||
export LC_ALL=en_US.UTF-8
|
||||
|
||||
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
source $current_dir/utils.sh
|
||||
|
||||
linux_acpi() {
|
||||
arg=$1
|
||||
BAT=$(ls -d /sys/class/power_supply/BAT* | head -1)
|
||||
|
@ -86,10 +89,10 @@ battery_status()
|
|||
discharging|Discharging)
|
||||
echo ''
|
||||
;;
|
||||
high)
|
||||
high|Full)
|
||||
echo ''
|
||||
;;
|
||||
charging)
|
||||
charging|Charging)
|
||||
echo 'AC'
|
||||
;;
|
||||
*)
|
||||
|
@ -108,15 +111,16 @@ battery_status()
|
|||
|
||||
main()
|
||||
{
|
||||
bat_label=$(get_tmux_option "@dracula-battery-label" "♥")
|
||||
bat_stat=$(battery_status)
|
||||
bat_perc=$(battery_percent)
|
||||
|
||||
if [ -z "$bat_stat" ]; then # Test if status is empty or not
|
||||
echo "♥ $bat_perc"
|
||||
echo "$bat_label $bat_perc"
|
||||
elif [ -z "$bat_perc" ]; then # In case it is a desktop with no battery percent, only AC power
|
||||
echo "♥ $bat_stat"
|
||||
echo "$bat_label $bat_stat"
|
||||
else
|
||||
echo "♥ $bat_stat $bat_perc"
|
||||
echo "$bat_label $bat_stat $bat_perc"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ get_percent()
|
|||
{
|
||||
case $(uname -s) in
|
||||
Linux)
|
||||
percent=$(LC_NUMERIC=en_US.UTF-8 top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
|
||||
percent=$(LC_NUMERIC=en_US.UTF-8 top -bn2 -d 0.01 | grep "Cpu(s)" | tail -1 | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
|
||||
normalize_percent_len $percent
|
||||
;;
|
||||
|
||||
|
@ -27,13 +27,30 @@ get_percent()
|
|||
esac
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
get_load() {
|
||||
case $(uname -s) in
|
||||
Linux | Darwin)
|
||||
loadavg=$(uptime | awk -F'[a-z]:' '{ print $2}' | sed 's/,//g')
|
||||
echo $loadavg
|
||||
;;
|
||||
|
||||
CYGWIN* | MINGW32* | MSYS* | MINGW*)
|
||||
# TODO - windows compatability
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main() {
|
||||
# storing the refresh rate in the variable RATE, default is 5
|
||||
RATE=$(get_tmux_option "@dracula-refresh-rate" 5)
|
||||
cpu_label=$(get_tmux_option "@dracula-cpu-usage-label" "CPU")
|
||||
cpu_percent=$(get_percent)
|
||||
echo "$cpu_label $cpu_percent"
|
||||
cpu_load=$(get_tmux_option "@dracula-cpu-display-load" false)
|
||||
if [ "$cpu_load" = true ]; then
|
||||
echo "$(get_load)"
|
||||
else
|
||||
cpu_label=$(get_tmux_option "@dracula-cpu-usage-label" "CPU")
|
||||
cpu_percent=$(get_percent)
|
||||
echo "$cpu_label $cpu_percent"
|
||||
fi
|
||||
sleep $RATE
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ main()
|
|||
# set configuration option variables
|
||||
show_fahrenheit=$(get_tmux_option "@dracula-show-fahrenheit" true)
|
||||
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)
|
||||
show_flags=$(get_tmux_option "@dracula-show-flags" false)
|
||||
show_left_icon=$(get_tmux_option "@dracula-show-left-icon" smiley)
|
||||
|
@ -66,7 +67,7 @@ main()
|
|||
|
||||
# start weather script in background
|
||||
if [[ "${plugins[@]}" =~ "weather" ]]; then
|
||||
$current_dir/sleep_weather.sh $show_fahrenheit $show_location &
|
||||
$current_dir/sleep_weather.sh $show_fahrenheit $show_location $fixed_location &
|
||||
fi
|
||||
|
||||
# Set timezone unless hidden by configuration
|
||||
|
@ -163,6 +164,11 @@ main()
|
|||
script="#($current_dir/network_bandwidth.sh)"
|
||||
fi
|
||||
|
||||
if [ $plugin = "network-ping" ]; then
|
||||
IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-network-ping-colors" "cyan dark_gray")
|
||||
script="#($current_dir/network_ping.sh)"
|
||||
fi
|
||||
|
||||
if [ $plugin = "weather" ]; then
|
||||
# wait unit $datafile exists just to avoid errors
|
||||
# this should almost never need to wait unless something unexpected occurs
|
||||
|
|
|
@ -7,6 +7,7 @@ IFS=' ' read -r -a hide_status <<< $(get_tmux_option "@dracula-git-disable-statu
|
|||
IFS=' ' read -r -a current_symbol <<< $(get_tmux_option "@dracula-git-show-current-symbol" "✓")
|
||||
IFS=' ' read -r -a diff_symbol <<< $(get_tmux_option "@dracula-git-show-diff-symbol" "!")
|
||||
IFS=' ' read -r -a no_repo_message <<< $(get_tmux_option "@dracula-git-no-repo-message" "")
|
||||
IFS=' ' read -r -a no_untracked_files <<< $(get_tmux_option "@dracula-git-no-untracked-files" "false")
|
||||
|
||||
# Get added, modified, updated and deleted files from git status
|
||||
getChanges()
|
||||
|
@ -16,7 +17,7 @@ getChanges()
|
|||
declare -i updated=0;
|
||||
declare -i deleted=0;
|
||||
|
||||
for i in $(git -C $path status -s)
|
||||
for i in $(git -C $path --no-optional-locks status -s)
|
||||
|
||||
do
|
||||
case $i in
|
||||
|
@ -77,8 +78,9 @@ checkEmptySymbol()
|
|||
# check to see if the current repo is not up to date with HEAD
|
||||
checkForChanges()
|
||||
{
|
||||
[ $no_untracked_files == "false" ] && no_untracked="" || no_untracked="-uno"
|
||||
if [ "$(checkForGitDir)" == "true" ]; then
|
||||
if [ "$(git -C $path status -s)" != "" ]; then
|
||||
if [ "$(git -C $path --no-optional-locks status -s $no_untracked)" != "" ]; then
|
||||
echo "true"
|
||||
else
|
||||
echo "false"
|
||||
|
|
35
scripts/network_ping.sh
Normal file
35
scripts/network_ping.sh
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env bash
|
||||
# setting the locale, some users have issues with different locales, this forces the correct one
|
||||
export LC_ALL=en_US.UTF-8
|
||||
|
||||
# configuration
|
||||
# @dracula-ping-server "example.com"
|
||||
# @dracula-ping-rate 5
|
||||
|
||||
current_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source $current_dir/utils.sh
|
||||
|
||||
ping_function() {
|
||||
case $(uname -s) in
|
||||
Linux | Darwin)
|
||||
# storing the hostname/IP in the variable PINGSERVER, default is google.com
|
||||
pingserver=$(get_tmux_option "@dracula-ping-server" "google.com")
|
||||
pingtime=$(ping -c 1 "$pingserver" | tail -1 | awk '{print $4}' | cut -d '/' -f 2)
|
||||
echo "$pingtime ms"
|
||||
;;
|
||||
|
||||
CYGWIN* | MINGW32* | MSYS* | MINGW*)
|
||||
# TODO - windows compatability
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
echo $(ping_function)
|
||||
RATE=$(get_tmux_option "@dracula-ping-rate" 5)
|
||||
sleep $RATE
|
||||
}
|
||||
|
||||
# run main driver
|
||||
main
|
|
@ -6,6 +6,7 @@ export LC_ALL=en_US.UTF-8
|
|||
|
||||
fahrenheit=$1
|
||||
location=$2
|
||||
fixedlocation=$3
|
||||
|
||||
LOCKFILE=/tmp/.dracula-tmux-weather.lock
|
||||
DATAFILE=/tmp/.dracula-tmux-data
|
||||
|
@ -31,7 +32,7 @@ main()
|
|||
|
||||
while tmux has-session &> /dev/null
|
||||
do
|
||||
$current_dir/weather.sh $fahrenheit $location > $DATAFILE
|
||||
$current_dir/weather.sh $fahrenheit $location $fixedlocation > $DATAFILE
|
||||
if tmux has-session &> /dev/null
|
||||
then
|
||||
sleep 1200
|
||||
|
|
|
@ -4,10 +4,13 @@ export LC_ALL=en_US.UTF-8
|
|||
|
||||
fahrenheit=$1
|
||||
location=$2
|
||||
fixedlocation=$3
|
||||
|
||||
display_location()
|
||||
{
|
||||
if $location; then
|
||||
if $location && [[ ! -z "$fixedlocation" ]]; then
|
||||
echo " $fixedlocation"
|
||||
elif $location; then
|
||||
city=$(curl -s https://ipinfo.io/city 2> /dev/null)
|
||||
region=$(curl -s https://ipinfo.io/region 2> /dev/null)
|
||||
echo " $city, $region"
|
||||
|
@ -20,7 +23,7 @@ fetch_weather_information()
|
|||
{
|
||||
display_weather=$1
|
||||
# it gets the weather condition textual name (%C), and the temperature (%t)
|
||||
curl -sL wttr.in\?format="%C+%t$display_weather"
|
||||
curl -sL wttr.in/$fixedlocation\?format="%C+%t$display_weather"
|
||||
}
|
||||
|
||||
#get weather display
|
||||
|
|
Loading…
Reference in a new issue