Update config, among other things improve batstat
This commit is contained in:
parent
77214e5f5e
commit
d86ef1c7b9
|
@ -311,6 +311,49 @@ alias luarocks="luarocks --local"
|
|||
|
||||
alias icat="kitty +kitten icat"
|
||||
|
||||
local function hour-float-to-time() {
|
||||
printf "%d:%02dh" $1 $(( $1 * 60 % 60 ))
|
||||
}
|
||||
|
||||
batstat() {
|
||||
for bat in /sys/class/power_supply/BAT*; do
|
||||
local energy_full=$(<$bat/energy_full)
|
||||
local energy_now=$(<$bat/energy_now)
|
||||
local power_now=$(<$bat/power_now)
|
||||
local bat_status=$(<$bat/status)
|
||||
local remain_text
|
||||
local remain
|
||||
case $bat_status in
|
||||
Charging)
|
||||
remain=$(((energy_full - energy_now) / power_now))
|
||||
remain_text=", $(hour-float-to-time $remain) until full"
|
||||
;;
|
||||
Discharging)
|
||||
remain=$((energy_now / power_now))
|
||||
remain_text=", $(hour-float-to-time $remain) left"
|
||||
;;
|
||||
*)
|
||||
remain_text=""
|
||||
;;
|
||||
esac
|
||||
|
||||
printf "%s: %.1f %%, %s%s\n" \
|
||||
${bat:t} \
|
||||
$(( energy_now * 100.0 / energy_full )) \
|
||||
$bat_status \
|
||||
$remain_text
|
||||
done
|
||||
}
|
||||
|
||||
if [[ $DISPLAY ]] && xinput | grep -q Wacom && xrandr | grep -q eDP1; then
|
||||
xrandr() {
|
||||
command xrandr $@
|
||||
for dev in $(xinput | grep Wacom | grep -oP '(?<=id=)\d*'); do
|
||||
xinput map-to-output $dev eDP1
|
||||
done
|
||||
}
|
||||
fi
|
||||
|
||||
# vim: foldmethod=marker
|
||||
|
||||
function lastdl() {
|
||||
|
|
|
@ -62,12 +62,12 @@ sv-manage() {
|
|||
case "$action" in
|
||||
add)
|
||||
for service in "$@"; do
|
||||
ln -s /etc/sv/${service:s#/##} /var/service
|
||||
ln -s ${SVDIR_TEMPLATES:-/etc/sv}/${service:s#/##} ${SVDIR:-/var/service}
|
||||
done
|
||||
;;
|
||||
remove|rm)
|
||||
for service in "$@"; do
|
||||
rm /var/service/${service:s#/##}
|
||||
rm ${SVDIR:-/var/service}/${service:s#/##}
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -3,7 +3,7 @@ source $(zdotfile zplug/init.zsh)
|
|||
|
||||
zplug 'zplug/zplug', hook-build:'zplug --self-manage'
|
||||
|
||||
zplug "MichaelAquilina/zsh-you-should-use"
|
||||
#zplug "MichaelAquilina/zsh-you-should-use"
|
||||
zplug 'jreese/zsh-titles'
|
||||
|
||||
zplug 'crater2150-zsh/fzf-widgets'
|
||||
|
@ -40,6 +40,7 @@ if zplug check 'crater2150-zsh/fzf-widgets'; then
|
|||
bindkey '\ec' fzf-change-directory
|
||||
bindkey '^r' fzf-insert-history
|
||||
bindkey '^xf' fzf-insert-files
|
||||
bindkey '^xF' fzf-insert-files-global
|
||||
bindkey '^xd' fzf-insert-directory
|
||||
bindkey '^xn' fzf-insert-named-directory
|
||||
|
||||
|
@ -49,7 +50,7 @@ if zplug check 'crater2150-zsh/fzf-widgets'; then
|
|||
# use fd for finding directories and files
|
||||
FZF_CHANGE_DIR_FIND_COMMAND="fd -t d"
|
||||
FZF_INSERT_DIR_COMMAND="fd -t d"
|
||||
FZF_INSERT_FILES_COMMAND="fd -t f"
|
||||
FZF_INSERT_FILE_COMMAND="fd -t f . $HOME"
|
||||
FZF_EDIT_FILES_COMMAND="fd -t f"
|
||||
|
||||
# modify history command to remove duplicates
|
||||
|
|
9
zprofile
9
zprofile
|
@ -1,6 +1,15 @@
|
|||
# /etc/zsh/zprofile
|
||||
# $Header: /var/cvsroot/gentoo-x86/app-shells/zsh/files/zprofile-1,v 1.1 2010/08/15 12:21:56 tove Exp $
|
||||
|
||||
append_path () {
|
||||
case ":$PATH:" in
|
||||
*:"$1":*)
|
||||
;;
|
||||
*)
|
||||
PATH="${PATH:+$PATH:}$1"
|
||||
esac
|
||||
}
|
||||
|
||||
# Load environment settings from profile.env, which is created by
|
||||
# env-update from the files in /etc/env.d
|
||||
if [ -e /etc/profile.env ] ; then
|
||||
|
|
Loading…
Reference in a new issue