Skip to content

Commit

Permalink
feat: add icon options (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrs4ndman committed Jul 18, 2023
1 parent 60426aa commit f0f131e
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 14 deletions.
18 changes: 13 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
set -g @plugin 'rose-pine/tmux'
# ... alongside
set -g @plugin 'tmux-plugins/tpm'
# To update plugin for future revisions, do the "Prefix + U" keycombo
# To update plugin for future revisions or bug fixes, do the "Prefix + U" keycombo
```

3. Set your preferred variant:
Expand All @@ -36,26 +36,34 @@ set -g @rose_pine_variant 'main' # Options are 'main', 'moon' or 'dawn'
```bash
set -g @rose_pine_host 'on' # Enables hostname in the status bar
set -g @rose_pine_date_time '' # It accepts the date UNIX command format (man date for info)
set -g @rose_pine_user 'on' # Turn on the username component in the statusbar
set -g @rose_pine_window_tabs_enabled 'on' # When active, show program instead of current directory
set -g @rose_pine_bar_bg_disabls 'on'
# If set to 'on', disables background color, for transparent terminal emulators

# Example values for these can be:
set -g @rose_pine_left_separator ' > ' # The strings to use as separators are 1-space padded
set -g @rose_pine_right_separator ' < ' # Accepts both normal chars & nerdfont icons
set -g @rose_pine_field_separator ' | ' # Again, 1-space padding, it updates with prefix + I
set -g @rose_pine_host 'on' # Turn on the hostname component in the statusbar
set -g @rose_pine_user 'on' # Turn on the username component in the statusbar

# These are not padded
set -g @rose_pine_session_icon '' # Changes the default icon to the left of the session name
set -g @rose_pine_current_window_icon '' # Changes the default icon to the left of the active window name
set -g @rose_pine_folder_icon '' # Changes the default icon to the left of the current directory folder
set -g @rose_pine_username_icon '' # Changes the default icon to the right of the hostname
set -g @rose_pine_hostname_icon '󰒋' # Changes the default icon to the right of the hostname
set -g @rose_pine_date_time_icon '󰃰' # Changes the default icon to the right of the date module
set -g @rose_pine_window_status_separator "" # Changes the default icon that appears between window names

# Very beta and specific opt-in settings, tested on v3.2a, look at issue #10
set -g @rose_pine_prioritize_windows 'on' # Disables the right side functionality in a certain window count / terminal width
set -g @rose_pine_width_to_hide '80' # Specify a terminal width to toggle off most of the right side functionality
set -g @rose_pine_window_count '5' # Specify a number of windows, if there are more than the number, do the same as width_to_hide
```
- The separator options should go back to the defaults ( →, ← and | NerdFont characters) if you close all tmux sessions (a full restart)
- The separator options should go back to the defaults ( →, ← and | NerdFont characters) if the options are unset and you close all tmux sessions (a full restart)
- Both the `@rose_pine_window_tabs_enabled` and `@rose_pine_bar_bg_disable` operate like the separators.
- The `@rose_pine_width_to_hide` and `rose_pine_window_count` settings do not refresh automatically. They need to be refreshed manually, their current state is discussed [here](https://github.com/rose-pine/tmux/issues/10).

> 5. Currently working on more modularity and powerline aspect toggle. Will try to enable NerdFont substitution


## Gallery
Expand Down
87 changes: 78 additions & 9 deletions rose-pine.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ main() {
set monitor-activity "on"
set status-justify "left"
set status-left-length "200"
set status-right-length "140"
set status-right-length "200"

# Theoretically messages (need to figure out color placement)
set message-style "fg=$thm_muted,bg=$thm_base,align=centre"
Expand All @@ -128,29 +128,70 @@ main() {
# Statusline base command configuration: No need to touch anything here
# Placement is handled below

# Shows username of the user the tmux session is run by
local user
user="$(get_tmux_option "@rose_pine_user" "")"
readonly user

# Shows hostname of the computer the tmux session is run on
local host
host="$(get_tmux_option "@rose_pine_host" "")"
readonly host

# Date and time command: follows the date UNIX command structure
local date_time
date_time="$(get_tmux_option "@rose_pine_date_time" "")"
readonly date_time

# Shows truncated current working directory
local directory
directory="$(get_tmux_option "@rose_pine_directory" "")"

# Changes between directory or current program for the window name
local wt_enabled
wt_enabled="$(get_tmux_option "@rose_pine_window_tabs_enabled" "off")"
readonly wt_enabled

# Changes the background color for the current active window
# TODO: Together with line 251-269, end development for this feature
# local active_window_color
# active_window_color="$(get_tmux_option "@rose_pine_active_window_color" "")"
# readonly active_window_color

# Transparency enabling for status bar
local bar_bg_disable
bar_bg_disable="$(get_tmux_option "@rose_pine_bar_bg_disable" "")"
readonly bar_bg_disable

# Settings that allow user to choose their own icons and status bar behaviour
# START
local current_window_icon
current_window_icon="$(get_tmux_option "@rose_pine_current_window_icon" "")"
readonly current_window_icon

local current_session_icon
current_session_icon="$(get_tmux_option "@rose_pine_session_icon" "")"
readonly current_session_icon

local username_icon
username_icon="$(get_tmux_option "@rose_pine_username_icon" "")"
readonly username_icon

local hostname_icon
hostname_icon="$(get_tmux_option "@rose_pine_hostname_icon" "󰒋")"
readonly hostname_icon

local date_time_icon
date_time_icon="$(get_tmux_option "@rose_pine_date_time_icon" "󰃰")"
readonly date_time_icon

local current_folder_icon
current_folder_icon="$(get_tmux_option "@rose_pine_folder_icon" "")"
readonly current_folder_icon

local window_status_separator
window_status_separator="$(get_tmux_option "@rose_pine_window_status_separator" "")"

local prioritize_windows
prioritize_windows="$(get_tmux_option "@rose_pine_prioritize_windows" "")"

Expand All @@ -169,13 +210,16 @@ main() {
local field_separator
field_separator="$(get_tmux_option "@rose_pine_field_separator" " | " )"

# END

local spacer
spacer=" "
# I know, stupid, right? For some reason, spaces aren't consistent

# These variables are the defaults so that the setw and set calls are easier to parse

local show_window
readonly show_window=" #[fg=$thm_subtle] #[fg=$thm_rose]#W$spacer"
readonly show_window=" #[fg=$thm_subtle]$current_window_icon #[fg=$thm_rose]#W$spacer"

local show_window_in_window_status
show_window_in_window_status="#[fg=$thm_iris]#I#[fg=$thm_iris,]$left_separator#[fg=$thm_iris]#W"
Expand All @@ -184,26 +228,46 @@ main() {
show_window_in_window_status_current="#I#[fg=$thm_gold,bg=""]$left_separator#[fg=$thm_gold,bg=""]#W"

local show_session
readonly show_session=" #[fg=$thm_text] #[fg=$thm_text]#S "
readonly show_session=" #[fg=$thm_text]$current_session_icon #[fg=$thm_text]#S "

local show_user
readonly show_user="#[fg=$thm_iris]#(whoami)#[fg=$thm_subtle]$right_separator#[fg=$thm_subtle]"
readonly show_user="#[fg=$thm_iris]#(whoami)#[fg=$thm_subtle]$right_separator#[fg=$thm_subtle]$username_icon"

local show_host
readonly show_host="$field_separator#[fg=$thm_text]#H#[fg=$thm_subtle]$right_separator#[fg=$thm_subtle]󰒋"
readonly show_host="$field_separator#[fg=$thm_text]#H#[fg=$thm_subtle]$right_separator#[fg=$thm_subtle]$hostname_icon"

local show_date_time