diff --git a/aliases/functions b/aliases/functions index 8ba9051..1f32177 100644 --- a/aliases/functions +++ b/aliases/functions @@ -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() { diff --git a/aliases/void b/aliases/void index 53cfbce..52e91d0 100644 --- a/aliases/void +++ b/aliases/void @@ -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 diff --git a/zplug.zsh b/zplug.zsh index 69eef15..b17b63c 100644 --- a/zplug.zsh +++ b/zplug.zsh @@ -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 diff --git a/zprofile b/zprofile index 05fe3aa..22109b2 100644 --- a/zprofile +++ b/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 diff --git a/zshrc b/zshrc index 7fdbe9a..9dccfcb 100644 --- a/zshrc +++ b/zshrc @@ -102,3 +102,7 @@ if [[ -e $HOME/.calendars ]]; then } __chromaz_extra_left+=_prompt_todos fi +# >>> scala-cli completions >>> +fpath=("/home/crater2150/.local/share/scalacli/completions/zsh" $fpath) +compinit +# <<< scala-cli completions <<<