diff options
| -rw-r--r-- | .config/i3/config | 46 | ||||
| -rw-r--r-- | .config/vimrc | 129 | ||||
| -rw-r--r-- | .config/xinitrc | 7 | ||||
| -rw-r--r-- | .config/zsh/.zshrc | 74 | ||||
| -rw-r--r-- | .config/zsh/custom/themes/0undefined.zsh-theme | 3 | ||||
| -rwxr-xr-x | .scripts/batinfo | 33 | ||||
| -rwxr-xr-x | .scripts/bt | 29 | ||||
| -rwxr-xr-x | .scripts/checkupdates | 15 | ||||
| -rwxr-xr-x | .scripts/color256 | 7 | ||||
| -rwxr-xr-x | .scripts/commits_by_hour | 64 | ||||
| -rwxr-xr-x | .scripts/cpuinfo | 8 | ||||
| -rwxr-xr-x | .scripts/docker-refresh | 6 | ||||
| -rwxr-xr-x | .scripts/is_docker_running | 5 | ||||
| -rwxr-xr-x | .scripts/meminfo | 2 | ||||
| -rwxr-xr-x | .scripts/netinfo | 34 | ||||
| -rwxr-xr-x | .scripts/select-sink | 4 | ||||
| -rwxr-xr-x | .scripts/vimura | 3 | ||||
| -rw-r--r-- | .xinitrc | 4 |
18 files changed, 268 insertions, 205 deletions
diff --git a/.config/i3/config b/.config/i3/config index 37383e5..921de5d 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -13,27 +13,27 @@ set $down j set $up k set $right l -font pango: DejaVuSans Mono Nerd Font Mono 12 +font pango: DejaVuSansMono Nerd Font Mono 12 ### Output configuration # Default wallpaper (more resolutions are available in /usr/share/sway/) -exec_always feh --bg-scale $HOME/pictures/bg2.png +exec_always feh --no-fehbg --bg-scale $HOME/pictures/background.png # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod ### Key bindings # start a terminal - #bindsym $mod+Return exec $term -f "DejaVuSansMono Nerd Font Mono:pixelsize=16" bindsym $mod+Return exec $term - bindsym $mod+e exec urxvt -bg '[50]#000000' -g 220x40 -t float -e nnn + bindsym $mod+e exec $term -A 0.2 -g 120x40 -t float -e nnn bindsym $mod+Shift+Return exec $term -t float bindsym $mod+Shift+p exec $term -f ":pixelsize=24" bindsym $mod+Shift+o exec $term -f ":pixelsize=18" bindsym $mod+p exec feh -^ float_sticky -R 15 https://www.cafeen.org/test.php - bindsym Print exec import -window root -display :0 ~/scr.png && xclip -selection clip -t image/png ~/scr.png + bindsym Print exec import -window root -display :0 ~/screenshot.png && xclip -selection clip -t image/png ~/screenshot.png + bindsym $mod+z exec zathura bindsym $mod+c exec exec $term -title float -e fsharpi --consolecolors+ --nologo --use:.scripts/fsharpinit.fsx bindsym $mod+Shift+v exec exec $term -t float -e vim @@ -51,17 +51,18 @@ floating_modifier $mod bindsym XF86MonBrightnessUp exec brightnessctl s 10%+ # Volume control - bindsym XF86AudioLowerVolume exec pactl set-sink-volume $(pactl info | grep 'Default Sink' | sed -Ee 's/^.*: (.*)$/\1/g') -5% bindsym XF86AudioRaiseVolume exec pactl set-sink-volume $(pactl info | grep 'Default Sink' | sed -Ee 's/^.*: (.*)$/\1/g') +5% bindsym XF86AudioMute exec pactl set-sink-mute $(pactl info | grep 'Default Sink' | sed -Ee 's/^.*: (.*)$/\1/g') toggle + bindsym $mod+w exec notify-send 'Weather' "$(weather)" + bindsym $mod+c exec notify-send 'Calendar' "$(cal -wm)" + # Your preferred application launcher bindsym $mod+d exec dmenu_run -i -q -fn 'DejaVuSansMono Nerd Font Mono' -#bindsym $mod+d exec rofi -show run -theme Pop-Dark # Lock your computer -bindsym $mod+x exec i3lock -i $HOME/pictures/lock.png -t -f -e +bindsym $mod+x exec i3lock -c 000000 -i $HOME/pictures/lock.png -t -f -e # Drag floating windows by holding down $mod and left mouse button. # Resize them with right mouse button + $mod. @@ -189,8 +190,8 @@ bindsym $mod+v split v # change container layout (stacked, tabbed, toggle split) #bindsym $mod+s layout stacking -bindsym $mod+w layout tabbed -bindsym $mod+s layout toggle split +#bindsym $mod+w layout tabbed +#bindsym $mod+s layout toggle split # Make the current focus fullscreen bindsym $mod+f fullscreen toggle @@ -233,21 +234,22 @@ mode "resize" { # Pressing right will grow the window’s width. # Pressing up will shrink the window’s height. # Pressing down will grow the window’s height. - bindsym $left resize shrink width 10 px or 10 ppt - bindsym $down resize grow height 10 px or 10 ppt - bindsym $up resize shrink height 10 px or 10 ppt - bindsym $right resize grow width 10 px or 10 ppt + bindsym $left resize shrink width 10 px or 10 ppt + bindsym $down resize grow height 10 px or 10 ppt + bindsym $up resize shrink height 10 px or 10 ppt + bindsym $right resize grow width 10 px or 10 ppt # same bindings, but for the arrow keys - bindsym Left resize shrink width 2 px or 2 ppt - bindsym Down resize grow height 10 px or 10 ppt - bindsym Up resize shrink height 2 px or 2 ppt - bindsym Right resize grow width 10 px or 10 ppt + bindsym Left resize shrink width 2 px or 2 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 2 px or 2 ppt + bindsym Right resize grow width 10 px or 10 ppt + # Bigger resize - bindsym Shift+Left resize shrink width 20 px or 20 ppt - bindsym Shift+Down resize grow height 40 px or 40 ppt - bindsym Shift+Up resize shrink height 20 px or 20 ppt - bindsym Shift+Right resize grow width 20 px or 20 ppt + bindsym Shift+Left resize shrink width 20 px or 20 ppt + bindsym Shift+Down resize grow height 40 px or 40 ppt + bindsym Shift+Up resize shrink height 20 px or 20 ppt + bindsym Shift+Right resize grow width 20 px or 20 ppt # back to normal: Enter or Escape bindsym Return mode "default" diff --git a/.config/vimrc b/.config/vimrc deleted file mode 100644 index 63f8fe1..0000000 --- a/.config/vimrc +++ /dev/null @@ -1,129 +0,0 @@ -runtime! archlinux.vim -scriptencoding utf-8 - -" behaviour -set history=200 -set wildmenu -set ruler -set cursorline -set showmatch -set hlsearch -set nocompatible -set backspace=2 -set incsearch -set formatoptions+=tcroqn2bmj -"set formatoptions+=1cjmnoqrw -"set formatoptions+=2acjnoqrtw -set relativenumber -set number - -" Enable mouse support -set mouse=a - -" tabs -set expandtab -set tabstop=2 -set softtabstop=2 -set shiftwidth=2 -set smartindent -set textwidth=80 -set wrap - -" theme -syntax enable - -set background=dark -colorscheme jellybeans - -" Need to set runtimepath before calling pathogen -set runtimepath=~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after - -" adding pathogen -execute pathogen#infect('bundle/{}') -filetype plugin indent on - -" encodings -set fileencoding=utf-8 -set encoding=utf-8 -set ffs=unix - -set viminfofile=${XDG_DATA_HOME:-$HOME/.local/share}/viminfo - -" some syntastics -"set listchars=space:·\,eol:¬ -set listchars= -set list - -set grepprg=grep\ -nH\ $* - -"set statusline+=%#warningmsg# -"set statusline+=%{SyntasticStatuslineFlag()} -"set statusline+=%* - -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 0 - -" filetypes -let g:syntastic_disabled_filetypes=['asm', 's', 'latex', 'tex'] - -let g:tex_flavor='latex' -let g:vimtex_view_method='zathura' -let g:vimtex_quickfix_mode=0 -set conceallevel=2 -let g:tex_conceal='abdmg' -"let g:syntastic_tex_checkers=['lacheck'] -let g:vimtex_compiler_method = 'latexrun' -let g:vimtex_compiler_latexrun = { - \ 'backend' : 'jobs', - \ 'background' : 1, - \ 'build_dir' : 'latex.out', - \ 'options' : [ - \ '-verbose-cmds', - \ '--latex-args="-synctex=1"', - \ ], - \} - -let g:latex_view_general_viewer = 'zathura' -let g:vimtex_view_method = 'zathura' - -function! Synctex() - " remove 'silent' for debugging - execute "silent !mv -u latex.out/" . bufname('%')[:-5] . ".synctex.gz ." - execute "silent !zathura --synctex-forward " . line('.') . ":" . col('.') . ":" . bufname('%') . " " . bufname('%')[:-5] . ".pdf" - redraw! -endfunction - -map <F5> :make<CR> -au BufNewFile,BufRead *.fo setlocal ft=fasto -au BufNewFile,BufRead /tmp/[a-zA-Z0-9]\+/ setlocal ft=sh - - -match ErrorMsg '\%>80v.\+' -match ErrorMsg ' \+$' -match ErrorMsg ' \+$' - -" Remove trailing cancer on write -autocmd BufWritePre * %s/\s\+$//e -autocmd BufWritePost *.tex !latexrun --bibtex-cmd="biber" --latex-args="-synctex=1" % -"autocmd BufWritePost *.tex !latexrun --latex-cmd xelatex % -"autocmd BufWritePost *.tex !latexrun --latex-cmd xelatex --bibtex-cmd biber % - -set makeprg=GCC_COLORS=\ make - -vnoremap // y/\V<C-R>"<CR> - -map <ESC>[1;5A <C-Up> -map <ESC>[1;5B <C-Down> -map <ESC>[1;5C <C-Right> -map <ESC>[1;5D <C-Left> -map! <ESC>[1;5A <C-Up> -map! <ESC>[1;5B <C-Down> -map! <ESC>[1;5C <C-Right> -map! <ESC>[1;5D <C-Left> - -map <ESC>[1;3C <ESC>:tabnext<CR> -map <ESC>[1;3D <ESC>:tabprevious<CR> - -autocmd VimEnter * silent !echo -ne "\e[1 q" diff --git a/.config/xinitrc b/.config/xinitrc deleted file mode 100644 index e1c9c8a..0000000 --- a/.config/xinitrc +++ /dev/null @@ -1,7 +0,0 @@ -systemctl --user import-environment DISPLAY -feh --no-fehbg --bg-scale ~/pictures/bg2.png -# xrdb -m $XDEFAULTS -dunst & -xcompmgr & -# exec i3 -exec dwm diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index df2e863..ef77fcf 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,10 +1,11 @@ -# ~/.zshrc +# zshrc export GPG_TTY=$(tty) # If not running interactively, don't do anything [[ $- != *i* ]] && return +# Add [username@hostname] prefix to prompt when its ssh if [ "$TERM" = "linux" ]; then PROMPT='%(?..(%?%) )' [ -n "$SSH_CLIENT" ] && PROMPT+="[%n@%M] " @@ -25,7 +26,7 @@ CASE_SENSITIVE="true" DISABLE_AUTO_UPDATE="true" # Uncomment the following line to automatically update without prompting. -DISABLE_UPDATE_PROMPT="true" +DISABLE_UPDATE_PROMPT="false" # Uncomment the following line to change how often to auto-update (in days). export UPDATE_ZSH_DAYS=31 @@ -36,33 +37,6 @@ DISABLE_MAGIC_FUNCTIONS=true # Uncomment the following line to disable auto-setting terminal title. DISABLE_AUTO_TITLE="true" -# Uncomment the following line to enable command auto-correction. -# ENABLE_CORRECTION="true" - -# Uncomment the following line to display red dots whilst waiting for completion. -#COMPLETION_WAITING_DOTS="true" - -# Uncomment the following line if you want to disable marking untracked files -# under VCS as dirty. This makes repository status check for large repositories -# much, much faster. -# DISABLE_UNTRACKED_FILES_DIRTY="true" - -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. -# You can set one of the optional three formats: -# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" -# or set a custom format using the strftime function format specifications, -# see 'man strftime' for details. -# HIST_STAMPS="mm/dd/yyyy" - -# Would you like to use another custom folder than $ZSH/custom? -# ZSH_CUSTOM=/path/to/new-custom-folder - -# Which plugins would you like to load? -# Standard plugins can be found in ~/.oh-my-zsh/plugins/* -# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. #plugins=(git) source $ZSH/oh-my-zsh.sh @@ -91,12 +65,16 @@ setopt hist_reduce_blanks setopt no_share_history setopt no_histverify + autoload -Uz compinit compinit -d ~/.cache/zcompdump-$ZSH_VERSION - autoload -Uz promptinit promptinit +zstyle ':completion:*' menu select +zmodload zsh/complist + +bindkey -v export KEYTIMEOUT=1 set -o vi @@ -122,28 +100,32 @@ autoload -Uz edit-command-line zle -N edit-command-line bindkey -M vicmd ' ' edit-command-line +bindkey -v '^?' backward-delete-char + bindkey "^e" end-of-line bindkey "^a" beginning-of-line bindkey -M vicmd "^e" end-of-line bindkey -M vicmd "^a" beginning-of-line +bindkey "" beginning-of-line +bindkey "" end-of-line bindkey "${terminfo[khome]}" beginning-of-line bindkey "${terminfo[kend]}" end-of-line bindkey "^[[3~" delete-char bindkey "^[3;5~" delete-char +bindkey "^[[P" delete-char bindkey "^[[1;5C" forward-word bindkey "^[[1;5D" backward-word -autoload -U up-line-or-beginning-search -autoload -U down-line-or-beginning-search -zle -N up-line-or-beginning-search -zle -N down-line-or-beginning-search +autoload -U up-line-or-beginning-search +autoload -U down-line-or-beginning-search +zle -N up-line-or-beginning-search +zle -N down-line-or-beginning-search bindkey "^[A" up-line-or-beginning-search -bindkey "^[OA" up-line-or-beginning-search bindkey "^[B" down-line-or-beginning-search +bindkey "^[OA" up-line-or-beginning-search bindkey "^[OB" down-line-or-beginning-search - ## Handy functions upload () { curl -F file=@${1} http://0x0.st @@ -196,6 +178,13 @@ calcgrade () { fi } +function screengrab() { + local OUT=screengrab.gif + local SIZE=$1 + local POS=$2 + ffmpeg -f x11grab -r 20 -s ${SIZE} -i :0.0+${POS} -r 20 out.gif +} + fr () { which futhark > /dev/null if [ ! -z $? ]; then @@ -206,9 +195,6 @@ fr () { ## Aliases alias :q='exit' -alias cgpu='sshpass -e ssh -l qgt268 ku-gpu' -alias fsharpi='fsharpi --nologo' -alias fsharpc='fsharpc --nologo --standalone' alias gdb='gdb -q' alias glog2="git log --graph --abbrev-commit --decorate --format=format:'%Cgreen%h%C(reset) [%G?] %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%Cred%d%C(reset)' --all" alias glog='git log --pretty="%Cgreen%H%Creset [%G?] %cn: %s %Cred%d%Creset"' @@ -216,19 +202,17 @@ alias ls='ls --color=auto' alias mutt='neomutt' alias pbcopy='xclip -selection clipboard -i' alias pbpaste='xclip -selection clipboard -o' -alias push='git push && mpg123 ~/Downloads/Mario-coin-sound.mp3' +alias push='git push && mpgv ~/downloads/mario_power_up.mp3' alias s='vim $(fzf)' alias scan='sudo iwlist wlp3s0 scan > /dev/null' alias v='echo -ne "\e[1 q" && vim --servername vim' -alias less='less -R' +alias ptop="ps -o pid,user,size,pcpu,command --sort size cx" ## Do before dropping into shell -source ~/.secrets/sshpass - BANNERFILE=~/.config/texts/todo.md if [[ $(tput cols) -gt 140 ]]; then - pr -mtW 140 $BANNERFILE ~/.config/texts/setsail + pr -mtW 140 $BANNERFILE ~/.config/texts/setsail else - cat $BANNERFILE + cat $BANNERFILE fi diff --git a/.config/zsh/custom/themes/0undefined.zsh-theme b/.config/zsh/custom/themes/0undefined.zsh-theme index 87257cc..8ea2a16 100644 --- a/.config/zsh/custom/themes/0undefined.zsh-theme +++ b/.config/zsh/custom/themes/0undefined.zsh-theme @@ -1,6 +1,5 @@ # vim: ft=zsh: ts=2: sts=2: expandtab append_if_nz() { - # echo " -- $1 --" if [[ "$1" == "0" || "$1" == "" ]]; then echo -n "" else @@ -19,7 +18,7 @@ git_status() { BRANCH=$(echo "$STATUS" | awk '/^# branch.head/{print $3}') AHEAD=$(append_if_nz "$(echo "$STATUS" | sed -n '/^# branch.ab/p' | sed -Ee 's/^.*\+([0-9]+).*/\1/g')" "\u2191") BEHIND=$(append_if_nz "$(echo "$STATUS" | sed -n '/^# branch.ab/p' | sed -Ee 's/^.*-([0-9]+).*/\1/g')" "\u2193") - STAGED=$(append_if_nz "$(echo "$STATUS" | sed -En '/^[0-9]+ (A|M). /p' | wc -l)" "+" "046") # green + STAGED=$(append_if_nz "$(echo "$STATUS" | sed -En '/^[0-9]+ (A|M|D). /p' | wc -l)" "+" "046") # green CONFLICT=$(append_if_nz "$(echo "$STATUS" | sed -En '/^u /p' | wc -l)" "!" "009") # red CHANGED=$(append_if_nz "$(echo "$STATUS" | sed -En '/^[0-9]+ .M /p' | wc -l)" "~" "081") # cyan RENAMED=$(append_if_nz "$(echo "$STATUS" | sed -En '/^[0-9]+ (R.|.R) /p' | wc -l)" "" "226") # YELLOW diff --git a/.scripts/batinfo b/.scripts/batinfo new file mode 100755 index 0000000..92b95c1 --- /dev/null +++ b/.scripts/batinfo @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +set -e + +status=$(acpi -abi) # get battery and adapter info + +case $BLOCK_BUTTON in + 3) notify-send "Battery status" "$status" ;; + 4) brightnessctl -q s 10%+ ;; + 5) brightnessctl -q s 10%- ;; +esac + +power=$(echo $status | awk '/Battery/{s+=$4}; END{printf "%.1f%%", s/NR}') + +icon='?' +if [[ -z $(echo $status | sed -n '/on-line/p') ]]; then + case "${power%.*}" in + 100 | 9[0-9]) icon='\uf578' ;; + 8[0-9]) icon='\uf581';; + 7[0-9]) icon='\uf580';; + 6[0-9]) icon='\uf57f';; + 5[0-9]) icon='\uf57e';; + 4[0-9]) icon='\uf57d';; + 3[0-9]) icon='\uf57c';; + 2[0-9]) icon='\uf57b';; + 1[0-9]) icon='\uf57a';; + [0-9]) icon='\uf579';; + esac +else + icon='\uf583' +fi + +echo -ne "$icon $power" diff --git a/.scripts/bt b/.scripts/bt new file mode 100755 index 0000000..2e4203d --- /dev/null +++ b/.scripts/bt @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -e + +# Check if bluetooth is blocked +(rfkill | grep -E "bluetooth.*\<blocked\>" >/dev/null) && echo "Please check rfkill and unblock bluetooth module." && exit || true + +[ "$1" = "stop" ] && systemctl stop bluetooth.service && exit +systemctl is-active bluetooth.service >/dev/null || systemctl start bluetooth.service + +[ "$(bluetoothctl show | awk '/Powered/ {print $2}')" = "no" ] && bluetoothctl power on && bluetoothctl agent on + +BTID='^([A-F0-9]{2}:){5}[A-F0-9]{2}$' + +if [ $# -gt 0 ]; then + if [ "$#" -eq 1 ]; then + PAIRED=$(bluetoothctl paired-devices | grep "$1" | awk '/Device/ {print $2}') + + if [ $(echo "$1" | grep -E $BTID) ]; then bluetoothctl connect $1 + elif [ $(echo "$PAIRED" | grep -E $BTID) ]; then bluetoothctl connect $PAIRED + else bluetoothctl $* + fi + else bluetoothctl $* + fi +else + CONNECTED="$(bluetoothctl info | awk '/Name/ {print $2}')" || true + + bluetoothctl paired-devices | awk "/Device/ {if(\"$CONNECTED\"==\$3) print \"\033[1;32m\" \$2 \"\t\" \$3 \"\033[0m\"; else print \$2 \"\t\" \$3;}" +fi diff --git a/.scripts/checkupdates b/.scripts/checkupdates new file mode 100755 index 0000000..380afd3 --- /dev/null +++ b/.scripts/checkupdates @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -e + +updates=$(pacman -Qu | sed '/\[ignored\]$/d') + +case $BLOCK_BUTTON in + 1) ;& # fallthrough + 3) if [ -n "${updates}" ]; then + notify-send "Available updates" "$updates" + else + notify-send "Available updates" "No available updates" + fi;; +esac + +[ -n "$updates" ] && echo $(echo "${updates}" | wc -l) || exit 0 diff --git a/.scripts/color256 b/.scripts/color256 new file mode 100755 index 0000000..1ade67c --- /dev/null +++ b/.scripts/color256 @@ -0,0 +1,7 @@ +#!/bin/env bash +for i in {0..255} ; do + printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i" + if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then + printf "\n"; + fi +done diff --git a/.scripts/commits_by_hour b/.scripts/commits_by_hour new file mode 100755 index 0000000..1bfb293 --- /dev/null +++ b/.scripts/commits_by_hour @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +VERBOSE=0 +NO_HOUR=0 +P='.' + +POSITIONAL=() +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -v|--verbose) + VERBOSE=1 + shift + ;; + -n|--no-hour) + NO_HOUR=1 + shift + ;; + -h|--help) + echo "Usage: commits_by_hour [-v] [-n] [path]" + echo " -v,--verbose Be more verbose, print all hours" + echo " -n,--no-hour Don\'t print hours" + echo " -h,--help Show this help message" + echo " path Path to git repository (Default: .)" + exit 0 + ;; + *) + P=$1 + shift + ;; + esac +done + +cd $P + +# Writes number of commits categorized by hour of the day +LOG=$(git log --format="%ad" | \ + sed -Ee 's/.*([0-9]{2})(:[0-9]{2}){2}.*/\1/g' | \ + sort | \ + uniq -c | \ + sed -Ee 's/^ +([0-9]+) ([0-9]+)/\2 \1/g') + +HOURS=({00..23}) + +for h in ${HOURS[*]}; do + l=$(echo "$LOG" | grep -Eo "^$h [0-9]+") + RES=$? + + if [ $RES -gt 0 ]; then # No commits in this hour + if [ $VERBOSE -gt 0 ]; then + if [ $NO_HOUR -gt 0 ]; then + echo 0 + else + echo $h 0 + fi + fi + else + if [ $NO_HOUR -gt 0 ]; then + echo `echo $l | sed -E 's/^[0-9]{2} ([0-9]+)$/\1/g'` + else + echo $l + fi + fi +done diff --git a/.scripts/cpuinfo b/.scripts/cpuinfo new file mode 100755 index 0000000..412e405 --- /dev/null +++ b/.scripts/cpuinfo @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -e + +# Load +sed -Ee 's/^([0-9]+\.[0-9]+) .*/[\1 /g' /proc/loadavg | tr -d '\n' + +# Thermals +awk '{s+=$1}END{printf "%.1f°]", s / (1000*NR)}' /sys/class/thermal/thermal_zone*/temp diff --git a/.scripts/docker-refresh b/.scripts/docker-refresh new file mode 100755 index 0000000..6bb4d71 --- /dev/null +++ b/.scripts/docker-refresh @@ -0,0 +1,6 @@ +#!/bin/bash + +docker-compose stop $1 +docker-compose rm -f $1 +docker-compose create $1 +docker-compose start $1 diff --git a/.scripts/is_docker_running b/.scripts/is_docker_running new file mode 100755 index 0000000..3e5eab5 --- /dev/null +++ b/.scripts/is_docker_running @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +[ -n "$BLOCK_BUTTON" ] && notify-send 'Running containers' "$(docker ps --format '{{.Names}}')" + +systemctl is-active docker >/dev/null && echo -e "\uf308$(docker ps -q | wc -l)" diff --git a/.scripts/meminfo b/.scripts/meminfo new file mode 100755 index 0000000..ddb93f6 --- /dev/null +++ b/.scripts/meminfo @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +free -h | awk '/Mem/{print "[" $3 " RAM " $2 "]" }' | tr -d '\n' diff --git a/.scripts/netinfo b/.scripts/netinfo new file mode 100755 index 0000000..92dd78c --- /dev/null +++ b/.scripts/netinfo @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +netstatus="$(awk '{ + n = split(FILENAME, a, "/") + printf("%-15s %s\n", a[n-1], $1) + }' /sys/class/net/[ew]*/operstate | sort -k 2)" + +function add_connected_address() { + TMPIFS=$IFS + IFS=' +' + for line in $netstatus; do + device=$(echo $line | awk '{print $1}') + address=$(ip addr show $device | sed -En 's/inet ([0-9\.]+).*/\1/p') + # Append Wifi AP if connected + [ -n "$address" ] && address=$address" ("$(iwgetid -r)")" + echo $line $address + done + IFS=$TMPIFS +} + +case $BLOCK_BUTTON in + 3) notify-send "Internet connection" "$(add_connected_address)" ;; +esac + +#echo "$(echo -e "$netstatus" | sed -En '/up$/p')" +#echo ====== + +if [ -z "$(echo -e "${netstatus}" | sed -En '/up$/p' | tr -d '\n')" ]; then + echo -n '' +else + echo -n "${netstatus}" | sed -En 's/^(w[^ ]+).*up//p;s/^(e[^ ]+).*up//p' +fi + diff --git a/.scripts/select-sink b/.scripts/select-sink new file mode 100755 index 0000000..019da37 --- /dev/null +++ b/.scripts/select-sink @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +pactl set-default-sink $(pactl list sinks | grep -B 1 "$(pactl list sinks | awk '/Description/{$1="";print $0;}' | dmenu)" | awk '/Name/{print $2}') +kill -10 $(pidof dwmblocks) diff --git a/.scripts/vimura b/.scripts/vimura new file mode 100755 index 0000000..91f5cf5 --- /dev/null +++ b/.scripts/vimura @@ -0,0 +1,3 @@ +#!/bin/sh +echo ${1:0:5} +zathura --fork -x "vim --servername vim -c \"let g:syncpdf='${1%.*}'\" --remote +%{line} %{input}" $1 @@ -3,4 +3,8 @@ feh --no-fehbg --bg-scale ~/pictures/background.png dunst & xcompmgr & setxkbmap -option compose:caps & +# Disable mouse acceleration +xset m 0 0 & +xset r rate 300 50 & + exec i3 |
