Powerlevel9k: Making `dir_writable` a default segment

Created on 13 Jun 2018  Â·  17Comments  Â·  Source: Powerlevel9k/powerlevel9k

I would suggest the following two updates for the default POWERLEVEL9K_LEFT_PROMPT_ELEMENTS:

  • Add dir_writable, which is in general very useful in particular in connection with root_indicator.
  • Remove rbenv, which is useful only for rubyists, and therefore IMHO should not be enabled on a general basis but only by people using it (or otherwise all other language segments should be enabled by default...).

So I would suggest to update the default settings to:

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir_writable dir vcs)

Of course I am aware that I can always set those defaults by myself, and this is wonderful, but I wanted to give my 2 cents contribution hopefully to make powerlevel9k even better. Thanks!

Most helpful comment

So I would suggest to update the default settings to:
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir_writable dir vcs)

@dritter You assumed incorrectly, my young padawan. He explicitly added dir_writable to the array. ;)

All 17 comments

Hi @lucatrv !

Thanks for your suggestion. That is something that @bhilburn has to decide. IMHO you got a point to set the defaults to a small, common set of segments that most people find useful. I would even add command_execution_time to the defaults.

dir_writable is now integrated into dir - just set POWERLEVEL9K_DIR_SHOW_WRITABLE=true

@onaforeignshore Setting POWERLEVEL9K_DIR_SHOW_WRITABLE=true could be a default as well. I assumed that @lucatrv meant that..

So I would suggest to update the default settings to:
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir_writable dir vcs)

@dritter You assumed incorrectly, my young padawan. He explicitly added dir_writable to the array. ;)

Yes I know of POWERLEVEL9K_DIR_SHOW_WRITABLE=true but it shows a dark lock on regular blue background, IMHO dir_writable (yellow lock on red background) is a better choice as it stands out.

@lucatrv - Thanks so much for filing this, and as you can tell, everyone agrees with you! We actually removed rbenv before the last release, and as @onaforeignshore, dir_writeable is now merged into the primary dir segment. We should be all set, here!

Let us know if you spot anything else =)

@bhilburn I tested the next branch. By default it shows only dir, so to show the write permission state I need to set P9K_DIR_SHOW_WRITABLE=true manually, and this shows a dark lock on regular blue background (which is difficult to notice). Just to avoid any misunderstandings, I point out that my suggestion was to set P9K_LEFT_PROMPT_ELEMENTS=(context dir_writable dir vcs) by default, which gives the following different outcomes:

  • write permission state is shown by default,
  • the lock is shown in yellow on red background (which stands out).

If you confirm that this is the final decision for the next Powerlevel9k release (which is not what I suggested) I would like to get the previous dir_writable behavior back. I tried with the following commands but it does not seem to work anymore, can you please give me your suggestion:

POWERLEVEL9K_DIR_SHOW_WRITABLE=true
POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_FOREGROUND='yellow'
POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_BACKGROUND='red'

Thanks

Hi @lucatrv -

Ah, yes, I see - your suggestion was to make the writeable icon display by default, and change the default colors. I'm willing to entertain both ideas, actually, but would like input from others who work on OS maintenance and system administration.

@shibumi @rjorgenson @dritter @iScrE4m @docwhat - What do you guys think about turning on the writeable flag by default in the dir segment, so that if you enter a dir without write perms it pops up?

Separately, it sounds like there is a bug in the dir segment on the next branch, because what you tried should work, @lucatrv. The dir_writable segment actually still also exists, too. Can you try putting that segment back into your segment list and let us know if that one works? @onaforeignshore

I just tried with:

P9K_LEFT_PROMPT_ELEMENTS=(context dir_writable dir vcs)

and I do not get the lock.

Note: I'm on Debian Stable, zsh v5.3.1

@lucatrv - Just merged @dritter's fix for dir_writable, #1017. Can you pull next and give it a shot?

I confirm that now with:

P9K_LEFT_PROMPT_ELEMENTS=(context dir_writable dir vcs)

I get my old lock in yellow on red, thanks! :)

However with the following:

P9K_LEFT_PROMPT_ELEMENTS=(context dir vcs)
P9K_DIR_SHOW_WRITABLE=true
P9K_DIR_WRITABLE_FORBIDDEN_FOREGROUND='yellow'
P9K_DIR_WRITABLE_FORBIDDEN_BACKGROUND='red'

I cannot yet control the lock colors...

BTW, another possibility to consider for the default lock colors could be black on yellow (same as BACKGROUND_JOBS). Many options IMHO could be better than the new default which is hardly visible.

The variables are P9K_DIR_NOT_WRITABLE_xxx and not P9K_DIR_WRITABLE_FORBIDDEN_xxx both in master and in next.

@bhilburn To change the defaults of this segment in next just change the values of line 18 of segments/dir.p9k

p9k::register_segment "DIR" 'NOT_WRITABLE'    "blue" "$DEFAULT_COLOR"   $'\uE0A2'  $'\uE138'  $'\uF023'  '\u'${CODEPOINT_OF_AWESOME_LOCK}         $'\uF023'

@onaforeignshore thanks for your hint, I confirm that for instance with the following:

P9K_LEFT_PROMPT_ELEMENTS=(context dir vcs)
P9K_DIR_SHOW_WRITABLE=true
P9K_DIR_NOT_WRITABLE_FOREGROUND='black'
P9K_DIR_NOT_WRITABLE_BACKGROUND='yellow'

I can set all the prompt in black on yellow for not writable directories. I assume that in order to change only the lock colors (for instance yellow on red) we still need to show the separate dir_writable segment:

P9K_LEFT_PROMPT_ELEMENTS=(context dir_writable dir vcs)

You can set the icon foreground colour with P9K_DIR_NOT_WRITABLE_ICON_COLOR

Ok, so maybe one possible option with dir_writable integrated into dir would be to set:

P9K_DIR_SHOW_WRITABLE=true
P9K_DIR_NOT_WRITABLE_ICON_COLOR='red'

For myself, I prefer however to stick with the previous behavior and set by default:

P9K_LEFT_PROMPT_ELEMENTS=(context dir_writable dir vcs)

I am on a issue-cleaning spree. This issue hasn't had motion in quite some time, and so I am closing it out due to inactivity. If anyone would like to re-open it because they feel it is un-resolved and is something they care about, please feel free to re-raise the discussion!

Was this page helpful?
0 / 5 - 0 ratings