dotfiles

Dotfiles for my OpenBSD environment.
Log | Files | Refs

commit c3120ca532c4ab38cb8e1e7b4079c15a7e0a3050
parent 658c9624f1580f2e107e2c9de061697ebf633149
Author: Matsuda Kenji <ftvda283@gmail.com>
Date:   Sat, 10 Oct 2020 10:06:02 +0900

modified i3block

Diffstat:
M.bash_profile | 3++-
M.config/i3/config | 2++
M.config/i3blocks/battery.sh | 35+++++++++++++++++++----------------
A.config/i3blocks/brightness.sh | 4++++
M.config/i3blocks/config | 8++++----
M.config/i3blocks/volume.sh | 2++
M.config/i3blocks/wifi.sh | 21++++++++++++++-------
A.config/mutt/password.gpg | 0
M.config/nvim/init.vim | 2++
9 files changed, 49 insertions(+), 28 deletions(-)

diff --git a/.bash_profile b/.bash_profile @@ -24,4 +24,5 @@ export PSQL_HISTORY="$XDG_CONFIG_HOME/pg/psql_history" # less export LESSHSTFILE=- -[[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]] && exec startx $XINITRC +export PATH="$PATH:$HOME/.gem/ruby/2.7.0/bin" +[[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]] && exec xinit $XINITRC diff --git a/.config/i3/config b/.config/i3/config @@ -22,6 +22,8 @@ exec --no-startup-id fcitx-autostart set $refresh_volume pkill -SIGRTMIN+1 i3blocks bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_volume bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_volume +bindsym $mod+XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +1% && $refresh_volume +bindsym $mod+XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -1% && $refresh_volume bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_volume bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_volume diff --git a/.config/i3blocks/battery.sh b/.config/i3blocks/battery.sh @@ -1,19 +1,22 @@ #!/bin/sh -online=`cat /sys/class/power_supply/ADP1/online` -capacity=`cat /sys/class/power_supply/BAT0/capacity` -if [ $online = 1 ]; then - state= -elif [ $capacity -gt 95 ]; then - state= -elif [ $capacity -gt 63 ]; then - state= -elif [ $capacity -gt 38 ]; then - state= -elif [ $capacity -gt 10 ]; then - state= -else - state= -fi +if [ -d /sys/class/power_supply/BAT0 ]; then + online=`cat /sys/class/power_supply/ADP1/online 2>/dev/null` + capacity=`cat /sys/class/power_supply/BAT0/capacity 2>/dev/null` + + if [ $online = 1 ]; then + state= + elif [ $capacity -gt 95 ]; then + state= + elif [ $capacity -gt 63 ]; then + state= + elif [ $capacity -gt 38 ]; then + state= + elif [ $capacity -gt 10 ]; then + state= + else + state= + fi -echo "$state ${capacity}" + echo "$state ${capacity}" +fi diff --git a/.config/i3blocks/brightness.sh b/.config/i3blocks/brightness.sh @@ -0,0 +1,4 @@ +#!/bin/bash +brightness=$(xbacklight -get ) +[ -n "$brightness" ] && printf '☀ %.0f\n' $brightness + diff --git a/.config/i3blocks/config b/.config/i3blocks/config @@ -5,13 +5,13 @@ markup=none [volume] label= command=$PWD/volume.sh -interval=once +interval=2 signal=1 [brightness] -label=☀ -command=xbacklight -get | xargs printf '%.0f\n' -interval=once +label= +command=$PWD/brightness.sh +interval=2 signal=2 [battery] diff --git a/.config/i3blocks/volume.sh b/.config/i3blocks/volume.sh @@ -1,10 +1,12 @@ #!/bin/sh mute=`pactl list sinks \ + | sed -n '/State: RUNNING/,/Volume/p' \ | grep 'Mute' | sed 's/[[:space:]]//g' \ | cut -d: -f2 | head -1` [ $mute = "yes" ] && state= || state= volume=`pactl list sinks \ + | sed -n '/State: RUNNING/,/Volume/p' \ | grep 'Volume' | grep -o '[0-9]*%' \ | head -1 | tr -d '%'` echo "$state ${volume}" diff --git a/.config/i3blocks/wifi.sh b/.config/i3blocks/wifi.sh @@ -1,15 +1,22 @@ #!/bin/sh -INTERFACE=wlp3s0 +INTERFACE=$(grep up /sys/class/net/*/operstate | sed 's!/operstate:up$!!;s!^.*/!!') -[ ! -d /sys/class/net/${INTERFACE}/wireless ] && exit - -if [ ! "$(cat /sys/class/net/$INTERFACE/operstate)" = 'up' ]; then +if [ -z $INTERFACE ]; then echo  down exit fi -ssid=`nmcli dev | grep wifi | grep connected | awk '{print $4}'` -quality=`nmcli dev wifi | grep $ssid | awk '{print $8}'` +if [ -d /sys/class/net/${INTERFACE}/wireless ]; then + label= + ssid=`nmcli dev | grep wifi | grep connected | awk '{print $4}'` + quality=`nmcli dev wifi | grep $ssid | awk '{print $8}'` + echo "$label $ssid: $quality%" +else + label= + ssid='ethernet' + echo "$label" +fi + + -echo " $ssid: $quality%" diff --git a/.config/mutt/password.gpg b/.config/mutt/password.gpg Binary files differ. diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim @@ -34,3 +34,5 @@ autocmd Filetype html inoremap ;b <b></b><Esc>3hi autocmd Filetype html inoremap ;i <i></i><Esc>3hi autocmd Filetype html inoremap ;pre <pre></pre><Esc>5hi autocmd Filetype html inoremap ;cd <code></code><Esc>6hi + +autocmd Filetype python set tags=tags;,~/.local/lib/python3.8/site-packages/tags