diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-09-16 16:00:00 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-09-16 16:14:09 -0400 |
commit | b249135c9be2c85c4d854141e5cae5e8506b99ee (patch) | |
tree | 3b7ac4f02c407e5078811bf7e179c2f91f250f6a /bin | |
parent | f458a454279d80827a9bc44c80ed02e7a4c498a1 (diff) | |
download | conf-b249135c9be2c85c4d854141e5cae5e8506b99ee.tar.gz conf-b249135c9be2c85c4d854141e5cae5e8506b99ee.zip |
cleanups
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/fancy-prompt | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/bin/fancy-prompt b/bin/fancy-prompt index f889cf4..0e2630a 100755 --- a/bin/fancy-prompt +++ b/bin/fancy-prompt @@ -63,50 +63,55 @@ else { } my %colornames = ( - bishamon => 'blue', - erim => 'white', - magus => 'darkgrey', - tozt => 'yellow', - xtahua => 'lightmagenta', - zaon => 'lightgreen', - unknown_host => 'brown', + host_bishamon => 'blue', + host_erim => 'white', + host_magus => 'darkgrey', + host_tozt => 'yellow', + host_xtahua => 'lightmagenta', + host_zaon => 'lightgreen', + unknown_host => 'brown', - error => 'red', + error => 'red', user_doy => 'lightblue', root => 'lightred', unknown_user => 'brown', - path => 'darkgrey', - ropath => 'red', + path => 'darkgrey', + ropath => 'red', vcs => 'darkgrey', vcsmodified => 'cyan', - battwarn => 'brown', - battcrit => 'red', - battemerg => 'lightred', - battfull => 'green', + battwarn => 'brown', + battcrit => 'red', + battemerg => 'lightred', + battfull => 'green', - time => 'darkgrey', + time => 'darkgrey', background => 'darkgrey', reset => 'reset', ); -$colornames{hostname} = $colornames{$hostname} || $colornames{unknown_host}; -$colornames{user} = - $root ? $colornames{root} - : $colornames{"user_$user"} ? $colornames{"user_$user"} - : $colornames{"unknown_user"}; -$colornames{path} = $colornames{ropath} unless -w $pwd; -$colornames{error} = $colornames{background} unless $err; -$colornames{battery} = $battery >= 80 ? $colornames{battfull} - : $charging ? $colornames{background} - : !defined($battery) ? $colornames{battemerg} - : $battery >= 40 ? $colornames{background} - : $battery >= 15 ? $colornames{battwarn} - : $battery >= 5 ? $colornames{battcrit} - : $colornames{battemerg}; + +$colornames{hostname} = + $colornames{"host_$hostname"} || $colornames{unknown_host}; +$colornames{user} = $root + ? $colornames{root} + : $colornames{"user_$user"} || $colornames{"unknown_user"}; + +$colornames{path} = $colornames{ropath} unless -w $pwd; +$colornames{error} = $colornames{background} unless $err; + +$colornames{battery} = + $battery >= 80 ? $colornames{battfull} + : $charging ? $colornames{background} + : !defined($battery) ? $colornames{battemerg} + : $battery >= 40 ? $colornames{background} + : $battery >= 15 ? $colornames{battwarn} + : $battery >= 5 ? $colornames{battcrit} + : $colornames{battemerg}; + sub color { my $code = $colors{$colornames{$_[0]}}; $code = '\[' . $code . '\]' if $prompt_escape eq 'bash'; |