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

Right prompt username color when root #155

Closed
Kidlike opened this issue May 6, 2018 · 5 comments
Closed

Right prompt username color when root #155

Kidlike opened this issue May 6, 2018 · 5 comments

Comments

@Kidlike
Copy link

Kidlike commented May 6, 2018

Is it possible to change the color of the username display when it's root ?

Instead of adding text next to the username like tmux_conf_theme_root.

Maybe change the behavior of tmux_conf_theme_root_fg/bg or create other variables similar to this ?

@gpakosz
Copy link
Owner

gpakosz commented May 6, 2018

Hello @Kidlike,

Currently it's not possible. But I'll figure out a way to do so.

@gpakosz
Copy link
Owner

gpakosz commented Aug 16, 2018

Hey @Kidlike 👋

I still don't know how to generalize it, but I gave it 5 minutes today 🎁

Here's what you can do in your ~/.tmux.conf.local copy:

tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} #{?battery_status, #{battery_status},}#{?battery_vbar, #{battery_vbar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{?#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} #D),#[fg=#ffff00]#[bold]#[blink],}#{username}#[inherit] | #{hostname_ssh} '

#{?#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} #D),#[fg=#ffff00]#[bold]#[blink],}#{username}#[inherit] will make the username bold, yellow and blinking when root.
Please note you can't use #[fg=#ffff00,bold,blink] as my parser is not robust enough 🤷‍♂️

Hope that helps!

@warp4
Copy link

warp4 commented Oct 1, 2018

Changed the line, and now I have a blinking red "root" on a yellow background, while the hostname is white and the username yellow on green :

....#[fg=#d70000]#[bold]#[blink]#[bg=##ffff00],}#{username}#[inherit] | #[fg=#e4e4e4]#{hostname}'

Status right:

tmux_conf_theme_status_right_fg='#e4e4e4,#ffff00,#000000'        # white, yellow, black
tmux_conf_theme_status_right_bg='#080808,#107132,#107132'   # dark gray, green, green
tmux_conf_theme_status_right_attr='none,bold,bold'

@diego898
Copy link

diego898 commented Mar 9, 2019

I think this is a great idea, and is also related to #189

@gpakosz
Copy link
Owner

gpakosz commented Mar 5, 2020

Closing. The solution in #321 is more elegant.

@gpakosz gpakosz closed this as completed Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants