Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/ enhancement: custom start and end of tmux status bar options #306

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

druxorey
Copy link

Description

This pull request adds a new boolean option @dracula-show-edge-icons to the Dracula Theme plugin for tmux. This option allows the icons defined in the show_left_sep and show_right_sep variables to also be displayed at the beginning and end of the status bar.

@dracula-show-edge-icons = false
before

@dracula-show-edge-icons = true
after

Changes made:

  • Added the @dracula-show-edge-icons option with a default value of false.
  • Modified the status-left and status-right configurations to include edge icons when @dracula-show-edge-icons is enabled.

Issue resolved

This change resolves issue #217, where the option to display icons at the edges of the status bar was requested.

Usage example

To enable this option, add the following line to your tmux configuration file:

set -g @dracula-show-edge-icons true

@Theoreticallyhugo
Copy link
Collaborator

Heya @druxorey
thank you for your contribution, and please excuse the long silence. i've been trying your fork, and it works for the left icon, and windows, but for some reason the widgets on the right side don't change.
this is tested on fedora41, what did you test on?
also do you think you could implement this as an optional feature, instead of a bug?

@druxorey
Copy link
Author

druxorey commented Jan 4, 2025

Hi there @Theoreticallyhugo,

Thank you for your feedback and for testing the feature. I tried this feature with the plugins network-ping and tmux-ram-usage on Arch Linux. Could you please let me know which widgets you have activated on the right side so I can run the necessary tests?

Regarding the optional feature implementation, I will work on it shortly.

@druxorey druxorey changed the title fixes #217 enhancement: custom start and end of tmux status bar options feature #217 enhancement: custom start and end of tmux status bar options Jan 4, 2025
@druxorey druxorey changed the title feature #217 enhancement: custom start and end of tmux status bar options feature/ enhancement: custom start and end of tmux status bar options Jan 4, 2025
@Theoreticallyhugo
Copy link
Collaborator

Theoreticallyhugo commented Jan 14, 2025

Screenshot 2025-01-14 at 15 35 44 Screenshot 2025-01-14 at 15 44 30 Screenshot 2025-01-14 at 16 06 24

looks like i'm getting the same results on those systems i tested. I don't have arch at hand right now, but i could install and test it somewhere if that'd help you. if i can help you in any other way, let me know :D

@druxorey
Copy link
Author

druxorey commented Jan 15, 2025

@Theoreticallyhugo That's weird, can you check how you have configured your tmux.conf? Here I share how mine is configured so that you have a reference.

code

@Theoreticallyhugo
Copy link
Collaborator

the following is the config i use on my mac with tmux 3.5a

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set -g prefix C-Space
bind C-Space send-prefix

bind r source-file ~/.config/tmux/tmux.conf

# paste with leader P

set -sa terminal-overrides ",xterm-256col*:Tc"
set -g default-terminal "xterm-256color"

# Plugin
# plugin manager
set -g @plugin 'tmux-plugins/tpm'

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

set -g @dracula-show-left-icon "#h | #S"
# the default is 5, it can accept any number
set -g @dracula-refresh-rate 5
set -g @dracula-show-empty-plugins false
set -g @dracula-show-fahrenheit false
set -g @dracula-day-month true
set -g @dracula-military-time true
set -g @dracula-show-timezone false
set -g @dracula-show-powerline true
set -g @dracula-time-colors "light_purple dark_gray"
set -g @dracula-git-no-repo-message "󰊠 "
set -g @dracula-battery-label false
set -g @dracula-show-battery-status true
set -g @dracula-spotify-tui-max-len 30
set -g @dracula-network-vpn-verbose true
set -g @dracula-network-ethernet-label "󰈀 Eth"
set -g @dracula-network-offline-label "󱍢 "
set -g @dracula-network-wifi-label " "
set -g @dracula-network-hosts "1.1.1.1 8.8.8.8"
set -g @dracula-show-ssh-only-when-connected true
set -g @dracula-gpu-vram-percent false
set -g @dracula-gpu-vram-used-accuracy ".2f"
set -g @dracula-gpu-vram-total-accuracy ".1f"
set -g @dracula-gpu-power-percent false
set -g @dracula-gpu-power-label "󰢮 "
set -g @dracula-gpu-usage-label "󰢮 "
set -g @dracula-gpu-vram-label "󰢮 "
set -g @dracula-network-vpn-colors "orange dark_gray"
set -g @dracula-ram-usage-label " "
set -g @dracula-show-edge-icons true
set -g @dracula-colors "
# catppuccin Color Pallette
pink='#cba6f7' # replace pink
orange='#fab387' # replacing orange
yellow='#f9e2af' # replacing yellow
green='#a6e3a1' # replacing green
cyan='#89dceb' # replacing cyan
light_purple='#b4befe' # replacing light_purple
white='#cdd6f4' # replacing white
dark_gray='#313244' # replace dark_gray
red='#f38ba8'
gray='#45475a'
dark_purple='#6c7086'
"

set -g @dracula-plugins "git battery attached-clients time"
# set -g @dracula-plugins "ram-usage git battery spotify-tui network ssh-session network-vpn time"


set-option -g status-position top

# Installs TPM if absent.
if "test ! -d ~/.config/tmux/plugins/tpm" \
   "run 'git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm && ~/.config/tmux/plugins/tpm/bin/install_plugins'"

# Runs TPM
run '~/.config/tmux/plugins/tpm/tpm'

@Theoreticallyhugo
Copy link
Collaborator

with these settings applied

set -g @dracula-show-right-sep "A"
set -g @dracula-show-left-sep "B"
set -g @dracula-show-onverse-divider "C"
set -g @dracula-show-edge-icons true

i get As and Bs but not Cs. i dont know if this is relevant to you.
Screenshot 2025-01-21 at 22 30 41

@Theoreticallyhugo
Copy link
Collaborator

Theoreticallyhugo commented Jan 21, 2025

i found the culprit. it only works with set -g @dracula-show-empty-plugins true. if its set to false it wont work. and thats why i got the same behaviour on all my machines. i set the show-empty to false everywhere.

Screenshot 2025-01-21 at 23 31 11

looks kinda weird with empty plugins imo

@druxorey
Copy link
Author

druxorey commented Jan 22, 2025

Ohhh.... It makes sense, I'll have to add it in the show-empty-plugins, we really have to review that code because it's hell to review when yes and when no, it's an amalgamation of if conditionals.

I think we should prioritize refactoring before continuing to add things. Do I add this change then and then we'll see about the refactoring then?

Edit: Forget what I said, I already simplified the border logic a bit to make it easier to understand.

druxorey and others added 3 commits January 22, 2025 00:58
Fixed the logic for setting the `$show_edge_icons` variable when the `$show_empty_plugins` is false.
Refactored the logic for `$show_edge_icons` in the tmux status-right configuration. The edge icon calculation is now done beforehand, reducing the complexity of the if statements and improving code readability.
@Theoreticallyhugo
Copy link
Collaborator

thank you very much for your contribution. i would like to keep the pr open for another few days (less than a week) for others to look at it, and then id merge.
im very much looking forward to your input about the needed refactoring. feel free to open either an issue, or a pr where we can discuss our ideas. whatever you prefer :D

Added a new section in the CONFIG.md to enable edge icons for the Dracula theme. This provides users with an option to display edge icons in their tmux status bar.
@Theoreticallyhugo
Copy link
Collaborator

heya, if you look at the last screenshot i posted, you can see some weird colour fragment at the left tip of the ram info. id like to investigate that before merging, but probably wont look into it today.

@druxorey
Copy link
Author

Yes, I saw it, that must be because when the show-edge-icons is true, I have to change the background colors, and I think I set it to a fixed value instead of a general value, let me review and correct that.

Fixed the background color handling in the status bar. Changed from a fixed value to using the `bg_color` variable for better consistency and customization.
@druxorey
Copy link
Author

It should be fixed now, plus I fixed an issue that caused borders to be inconsistent when $transparent_powerline_bg was disabled.

Fixed the edge icons colors and styles when `$transparent_powerline_bg` is false. This ensures that the correct colors are applied based on the edge icon configuration.
@Theoreticallyhugo
Copy link
Collaborator

Theoreticallyhugo commented Jan 23, 2025

for some reason the colour between the plugins is still different to the colour between the windows and plugin 🧐

EDIT:
as it seems, the background of the right sep is set to the specific background colour we want, but that of the left is the colour of the font of the script.

@druxorey
Copy link
Author

Can you send a screenshot? I tried it with your configuration and it looked good

@Theoreticallyhugo
Copy link
Collaborator

Screenshot 2025-01-23 at 18 09 06

@druxorey
Copy link
Author

It's really strange, with your configuration and mine there seems to be no problems.

image

image

@Theoreticallyhugo
Copy link
Collaborator

thats really odd. the change i suggested in the review fixes it for me tho. would you mind checking whether it breaks nothing for you?

@ethancedwards8
Copy link
Member

It's really strange, with your configuration and mine there seems to be no problems.

image

image

When this occurs it is usually the terminal emulator at work. Which ones are you all using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants