diff --git a/INSTALL.md b/INSTALL.md index 90a6e4e5..b0b0d608 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -83,6 +83,12 @@ Enable high contrast pane border set -g @monokai-border-contrast true ``` +Hide empty plugins + +```bash +set -g @monokai-show-empty-plugins false +``` + #### cpu-usage options Customize label @@ -110,6 +116,8 @@ set -g @monokai-battery-label "Battery" #### gpu-usage options +Note, currently only the Linux NVIDIA Proprietary drivers are supported. Nouveau and AMD Graphics Cards support are still under development. + Customize label ```bash @@ -124,6 +132,26 @@ Customize label set -g @monokai-ram-usage-label "RAM" ``` +#### tmux-ram-usage options + +Customize label + +```bash +set -g @monokai-tmux-ram-usage-label "MEM" +``` + +#### network-bandwidth + +You can configure which network interface you want to view the bandwidth, +Displaying of the interface name, The interval between each bandwidth update. +The most common interfaces name are `eth0` for a wired connection and `wlan0` for a wireless connection. + +```bash +set -g @monokai-network-bandwidth eth0 +set -g @monokai-network-bandwidth-interval 0 +set -g @monokai-network-bandwidth-show-interface true +``` + #### 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. @@ -133,6 +161,14 @@ set -g @monokai-ping-server "google.com" set -g @monokai-ping-rate 5 ``` +### ssh-session options + +Show SSH session port + +```bash +set -g @monokai-show-ssh-session-port true +``` + #### time options Disable timezone @@ -153,6 +189,14 @@ Enable military time set -g @monokai-military-time true ``` +Set custom time format e.g (2023-01-01 14:00) + +```bash +set -g @monokai-time-format "%F %R" +``` + +See [[this page]](https://man7.org/linux/man-pages/man1/date.1.html) for other format symbols. + #### git options Hide details of git changes @@ -189,6 +233,49 @@ Hide untracked files from being displayed as local changes set -g @monokai-git-no-untracked-files true ``` +Show remote tracking branch together with diverge/sync state + +```bash +# default is false +set -g @monokai-git-show-remote-status true +``` + +#### hg options + +Hide details of hg changes + +```bash +set -g @monokai-hg-disable-status true +``` + +Set symbol to use for when branch is up to date with HEAD + +```bash +#default is ✓.Avoid using non unicode characters that bash uses like $, * and ! +set -g @monokai-hg-show-current-symbol ✓ +``` + +Set symbol to use for when branch diverges from HEAD + +```bash +#default is unicode !.Avoid bash special characters +set -g @monokai-hg-show-diff-symbol ! +``` + +Set symbol or message to use when the current pane has no hg repo + +```bash +#default is unicode no message +set -g @monokai-hg-no-repo-message "" +``` + +Hide untracked files from being displayed as local changes + +```bash +#default is false +set -g @monokai-hg-no-untracked-files false +``` + #### weather options Switch from default fahrenheit to celsius @@ -208,3 +295,77 @@ Hide your location ```bash set -g @monokai-show-location false ``` + +#### synchronize-panes options + +Customize label + +```bash +set -g @monokai-synchronize-panes-label "Sync" +``` + +#### attached-clients options + +Set the minimum number of clients to show (otherwise, show nothing) + +```bash +set -g @monokai-clients-minimum 1 +``` + +Set the label when there is one client, or more than one client + +```bash +set -g @monokai-clients-singular client +set -g @monokai-clients-plural clients +``` + +#### Kubernetes options + +Add prefix label before the context + +```bash +set -g @monokai-kubernetes-context-label "Some Label" +``` + +Hide user from the context string + +``` +set -g @monokai-kubernetes-hide-user true +``` + +Hide ARN (show only cluster name) - Available for EKS only (only available for cluster names that are ARNs) + +``` +set -g @monokai-kubernetes-eks-hide-arn true +``` + +Extract the account as a prefix to the cluster name - Available for EKS only (only available for cluster names that are ARNs) + +```` +set -g @monokai-kubernetes-eks-extract-account true + +#### continuum options + +Set the output mode. Options are: +- **countdown**: Show a T- countdown to the next save (default) +- **time**: Show the time since the last save +- **alert**: Hide output if no save has been performed recently +- **interval**: Show the continuum save interval + +```bash +set -g @monokai-continuum-mode countdown +```` + +Show if the last save was performed less than 60 seconds ago (default threshold is 15 seconds) + +```bash +set -g @monokai-continuum-time-threshold 60 +``` + +#### Playerctl format + +Set the playerctl metadata format + +``` +set -g @monokai-playerctl-format "► {{ artist }} - {{ title }}" +``` diff --git a/LICENSE b/LICENSE index e5d7a714..c418fa39 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ MIT License Copyright (c) 2020 Dane Williams -Copyright (c) 2022 Max Petretta, https://maxpetretta.com +Copyright (c) 2022 Max Petretta, https://maxp.co Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 6572abe8..706301b0 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,35 @@ Configuration and options can be found at [draculatheme.com/tmux](https://dracul **NOTE**: Replace all mentions of `@dracula` with `@monokai` +## 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 +- SSH session user, hostname and port of active tmux pane +- Git branch and status +- Battery percentage and AC power connection status +- Refresh rate control +- CPU usage (percentage or load average) +- RAM usage (system and/or tmux server) +- GPU usage +- Custom status texts from external scripts +- GPU VRAM usage +- GPU power draw +- Color code based on whether a prefix is active or not +- List of windows with the current window highlighted +- When prefix is enabled, a 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 +- Spotify playback (needs the tool spotify-tui installed) +- Music Player Daemon status (needs the tool mpc installed) +- Playerctl, get current track metadata +- Current kubernetes context +- Countdown to tmux-continuum save +- Current working directory of tmux pane + ## Compatibility Tested on macOS Monterey, with & without powerline symbols diff --git a/scripts/battery.sh b/scripts/battery.sh index 92abb878..248d541d 100755 --- a/scripts/battery.sh +++ b/scripts/battery.sh @@ -7,7 +7,7 @@ source $current_dir/utils.sh linux_acpi() { arg=$1 - BAT=$(ls -d /sys/class/power_supply/BAT* | head -1) + BAT=$(ls -d /sys/class/power_supply/*) if [ ! -x "$(which acpi 2> /dev/null)" ];then case "$arg" in status) diff --git a/scripts/cpu_info.sh b/scripts/cpu_info.sh index 059f368d..320243f8 100755 --- a/scripts/cpu_info.sh +++ b/scripts/cpu_info.sh @@ -57,7 +57,7 @@ main() { echo "$cpu_label $(get_load)" else cpu_percent=$(get_percent) - echo "$cpu_label $cpu_percent" + echo "$cpu_label$cpu_percent" fi sleep $RATE } diff --git a/scripts/monokai.sh b/scripts/monokai.sh index 333f1866..93c8789f 100755 --- a/scripts/monokai.sh +++ b/scripts/monokai.sh @@ -37,6 +37,7 @@ main() # Monokai Pro Color Pallette white='#fcfcfa' black='#2d2a2e' + dark_gray='#403e41' gray='#727072' red='#ff6188' green='#a9dc76' @@ -124,14 +125,14 @@ 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=${dark_gray},fg=${white}" # Status left if $show_powerline; then - tmux set-option -g status-left "#[fg=${green},bg=${black}]#{?client_prefix,#[fg=${yellow}],}#[bg=${green},fg=${black},bold]#{?client_prefix,#[bg=${yellow}],} ${left_icon} #[fg=${green},bg=${gray}]#{?client_prefix,#[fg=${yellow}],}${left_sep}" - powerbg=${gray} + tmux set-option -g status-left "#[fg=${green},bg=${black}]#{?client_prefix,#[fg=${magenta}],}#[bg=${green},fg=${black},bold]#{?client_prefix,#[bg=${magenta}],} ${left_icon} #[fg=${green},bg=${dark_gray}]#{?client_prefix,#[fg=${magenta}],}${left_sep}" + powerbg=${dark_gray} else - tmux set-option -g status-left "#[bg=${green},fg=${black},bold]#{?client_prefix,#[bg=${yellow}],} ${left_icon} " + tmux set-option -g status-left "#[bg=${green},fg=${black},bold]#{?client_prefix,#[bg=${magenta}],} ${left_icon} " fi # Status right @@ -208,7 +209,7 @@ main() script="#($current_dir/network_bandwidth.sh)" elif [ $plugin = "network-ping" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@monokai-network-ping-colors" "blue black") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@monokai-network-ping-colors" "dark_gray white") script="#($current_dir/network_ping.sh)" elif [ $plugin = "network-vpn" ]; then @@ -248,7 +249,7 @@ main() script="#($current_dir/weather_wrapper.sh $show_fahrenheit $show_location '$fixed_location')" elif [ $plugin = "time" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@monokai-time-colors" "green white") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@monokai-time-colors" "green black") if [ -n "$time_format" ]; then script=${time_format} else @@ -299,12 +300,12 @@ main() # Window option if $show_powerline; then - tmux set-window-option -g window-status-current-format "#[bg=${white},fg=${gray}]${left_sep} #[fg=${black},bg=${white}]#I #W${current_flags} #[bg=${gray},fg=${white}]${left_sep}" + tmux set-window-option -g window-status-current-format "#[bg=${gray},fg=${dark_gray}]${left_sep} #[fg=${white},bg=${gray}]#I #W${current_flags} #[bg=${dark_gray},fg=${gray}]${left_sep}" else - tmux set-window-option -g window-status-current-format "#[fg=${gray},bg=${white}] #I #W${current_flags} " + tmux set-window-option -g window-status-current-format "#[fg=${white},bg=${gray}] #I #W${current_flags} " fi - tmux set-window-option -g window-status-format "#[bg=${gray},fg=${gray}]${left_sep} #[fg=${white},bg=${gray}]#I #W${flags} #[bg=${gray},fg=${gray}]${left_sep}" + tmux set-window-option -g window-status-format "#[bg=${dark_gray},fg=${dark_gray}]${left_sep} #[fg=${white},bg=${dark_gray}]#I #W${flags} #[bg=${dark_gray},fg=${dark_gray}]${left_sep}" tmux set-window-option -g window-status-activity-style "bold" tmux set-window-option -g window-status-bell-style "bold" tmux set-window-option -g window-status-separator "" diff --git a/scripts/network_bandwidth.sh b/scripts/network_bandwidth.sh index 8915f2f9..3001de74 100755 --- a/scripts/network_bandwidth.sh +++ b/scripts/network_bandwidth.sh @@ -112,7 +112,7 @@ main() { IFS=" " read -ra bandwidth <<<"$(get_bandwidth "$network_name")" if [[ $show_interface == "true" ]]; then echo -n "[$network_name] "; fi - printf "↓ %6s %-4s • ↑ %6s %-4s\n" $(bandwidth_to_unit "${bandwidth[$DOWNLOAD]}") $(bandwidth_to_unit "${bandwidth[$UPLOAD]}") + echo "↓ $(bandwidth_to_unit "${bandwidth[$DOWNLOAD]}") • ↑ $(bandwidth_to_unit "${bandwidth[$UPLOAD]}")" ((counter = counter - 1)) sleep "$interval_update" diff --git a/scripts/network_ping.sh b/scripts/network_ping.sh index f1379684..33c055bd 100755 --- a/scripts/network_ping.sh +++ b/scripts/network_ping.sh @@ -12,9 +12,9 @@ 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 "@monokai-ping-server" "google.com") - pingtime=$(ping -c 1 "$pingserver" | tail -1 | awk '{print $4}' | cut -d '/' -f 2) + # storing the hostname/IP in the variable PINGSERVER, default is 1.1.1.1 (Cloudflare) + pingserver=$(get_tmux_option "@monokai-ping-server" "1.1.1.1") + pingtime=$(ping -c 1 "$pingserver" | tail -1 | awk '{print $4}' | cut -d '/' -f 2 | cut -c1-2 | sed 's/\.$//') echo "$pingtime ms" ;; diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index bb51b93e..c001636e 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -22,7 +22,7 @@ get_ratio() # System Profiler performs an activation lock check, which can result in # time outs or a lagged response. (~10 seconds) # total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{print $2 $3}') - total_mem=$(sysctl -n hw.memsize | awk '{print $0/1024/1024/1024 " GB"}') + total_mem=$(sysctl -n hw.memsize | awk '{print $0/1024/1024/1024 "GB"}') if ((used_mem < 1024 )); then echo "${used_mem}MB/$total_mem" else diff --git a/scripts/utils.sh b/scripts/utils.sh index 8f22e894..97206817 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -22,10 +22,10 @@ get_tmux_window_option() { fi } -# normalize the percentage string to always have a length of 5 +# normalize the percentage string to always have a length of 4 normalize_percent_len() { # the max length that the percent can reach, which happens for a two digit number with a decimal house: "99.9%" - max_len=5 + max_len=4 percent_len=${#1} let diff_len=$max_len-$percent_len # if the diff_len is even, left will have 1 more space than right