Skip to content

Commit

Permalink
fix battery
Browse files Browse the repository at this point in the history
  • Loading branch information
xvzc committed Jan 5, 2024
1 parent 092180a commit 1fe6f50
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 60 deletions.
45 changes: 3 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,9 @@
# dotfiles
A repository for personal dotfiles. uses [chezmoi](https://github.com/twpayne/chezmoi) to manage cross platform environment.
Personal dotfiles managed by [chezmoi](https://github.com/twpayne/chezmoi).

# chezmoi init
`chezmoi init https://github.com/xvzc/dotfiles`

# Dependencies
## Terminal environment
```
zsh
oh-my-zsh
node
packer
tmux
oh-my-tmux
fzf
ripgrep
sdkman
```
# install with curl
`curl -fsSL https://dotfiles.xvzc.dev | bash`

## Window manager environment (For Arch Linux)
```
- bspwm # window manager
- polybar # for top bar.
- xorg, xorg-xinit # for keyborad input settings.
- compton(picom) # A compositor that gives each window a buffer to render
- nitrogen # Background image manager
- ibus-hangul # korean input source
- xdo # a utility that enables showing and hiding applications
```

# Trouble shooting log
## Make ALT_R work as ALT_R in Hangul layout (For Arch Linux)
```
cd /usr/share/X11/xkb/symbols
sudo vim kr
```
find 'ralt_hangul' key, and then change the symbols to `symbols[Group1] = [ Alt_R, Meta_R ] };`

## How to get .tmux.reset.conf
```bash
$ tmux -f /dev/null -L temp start-server \; list-keys > ./.tmux.reset.conf

```

## Nerd Font issue with Alacritty on Mac OS Ventura >= 13.0
Open Font Book and right click All Fonts on the side bar, and then click `activate all fonts`
2 changes: 1 addition & 1 deletion dot_config/tmux/tmux.style.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set -g status-right-length 140
set -g status-right-style default

# Display the date
set -g status-right "#(battery) #[default] #[fg=white, bg=default]%H:%M"
set -g status-right "#(battery) #[fg=white, bg=default]%H:%M"
# set -g status-right "#[fg=white,bg=default]"

# Set the inactive window color and style
Expand Down
43 changes: 26 additions & 17 deletions dot_scripts/executable_battery
Original file line number Diff line number Diff line change
@@ -1,38 +1,47 @@
#!/usr/bin/env zsh

CUR_OS=$(uname)

darwin_batt() {
cmd=$(pmset -g batt)
amount=$(echo "$cmd" | grep -Eo "\d+%" | cut -d% -f1)
label=$amount%

if echo "$cmd" | grep -q "AC Power"; then
label="AC"
fi

if (( $amount < 20 )) then
echo "#[fg=$(get_color $amount),bg=default] $amount%";
}

linux_batt() {
echo "AC"
}

get_color() {
if (( $1 < 22 )) then
color="color9"
elif (( $amount < 40 )) then
elif (( $1 < 44 )) then
color="color208"
elif (( $amount < 60 )) then
elif (( $1 < 66 )) then
color="color214"
elif (( $amount < 80 )) then
color="color184"
elif (( $1 < 88 )) then
color="color186"
else
color="color148"
fi

echo "#[fg=black,bg=$color] $label";
echo $color
}

not_applicable() {
echo ""
}

case $(uname -s) in
Linux)
echo "AC"
;;
Darwin)
darwin_batt
;;
*)
echo "N/A"
Linux*)
linux_batt
;;
Darwin*)
darwin_batt
;;
*)
not_applicable
esac

0 comments on commit 1fe6f50

Please sign in to comment.