Skip to content

Instantly share code, notes, and snippets.

@unstabler
Last active December 27, 2015 07:48
Show Gist options
  • Save unstabler/7291276 to your computer and use it in GitHub Desktop.
Save unstabler/7291276 to your computer and use it in GitHub Desktop.
oh my zsh theme
#!/usr/bin/env perl
use 5.014;
use strict;
my $switch = $ARGV[0];
my $battery_state = `acpi`;
if ($battery_state =~ m{Battery \d: (?<status>\w+), (?<percentage>\d+)}) {
my ($status, $percentage);
$percentage = $+{percentage};
if ($+{status} =~ /(Full|Charging|Unknown)/) {#!/usr/bin/env perl
use 5.014;
use strict;
my $switch = $ARGV[0];
my $battery_state = `acpi`;
if ($battery_state =~ m{Battery \d: (?<status>\w+), (?<percentage>\d+)}) {
my ($status, $percentage);
$percentage = $+{percentage};
if ($+{status} =~ /(Full|Charging|Unknown)/) {
$status = '⚡';
} else {
$status = '☀' if $+{percentage} >= 70;
$status = '☼'if $+{percentage} < 70;
$status = '☁'if $+{percentage} < 50;
$status = '☔' if $+{percentage} < 30;
$status = '☹'if $+{percentage} < 10;
}
printf("%s]─[%d", $status, $percentage);
}
$status = '⚡';
} else {
$status = '☀' if $+{percentage} >= 70;
$status = '☼'if $+{percentage} < 70;
$status = '☁'if $+{percentage} < 50;
$status = '☔' if $+{percentage} < 30;
$status = '☹'if $+{percentage} < 10;
}
printf("%s]─[%d", $status, $percentage);
}
PROMPT='[%(?.%{$fg_bold[green]%} OK .%{$fg_bold[red]%}fail)%{$reset_color%}]─[%{$fg_bold[yellow]%}%n@%m%{$reset_color%} : %{$fg_bold[blue]%}%~%{$reset_color%}]─[$(_battery_status)%%]
$(git_prompt_info)'"' ')> "
RPROMPT='[%T%{$reset_color%}]'
ZSH_THEME_GIT_PROMPT_PREFIX="[%{$fg[cyan]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="] %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[cyan]%})%{$fg_bold[yellow]%}!%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[cyan]%})%{$reset_color%}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment