Update i3(add i3blocks), bspwm, nvim, tmux, ranger, zsh

This commit is contained in:
Smirnov Olexandr 2021-02-23 10:57:25 +02:00
parent 53d009b671
commit 5374db696a
11 changed files with 137 additions and 33 deletions

View file

@ -46,8 +46,9 @@ bspc rule -a Code desktop='^3' focus=on follow=on
bspc rule -a '*:nvim' desktop='^3' focus=on follow=on
bspc rule -a '*:ranger' desktop='^4' focus=on follow=off
bspc rule -a Thunar desktop='^4' focus=on follow=off
bspc rule -a Joplin desktop='^5' focus=on follow=off
bspc rule -a discord desktop='^6' focus=on follow=off
bspc rule -a Joplin desktop='^5' focus=on follow=on
bspc rule -a Simplenote desktop='^5' focus=on follow=on
bspc rule -a discord desktop='^6' focus=off follow=off
bspc rule -a telegram-desktop desktop='^6' focus=off follow=off
bspc rule -a KeePassXC desktop='^7' focus=on follow=off
bspc rule -a Spotify desktop='^9' focus=on follow=on

View file

@ -21,9 +21,9 @@ foreground = ${colors.foreground}
wm-restack = bspwm
font-0 = Iosevka Nerd Font:style=Medium:size=8;3
font-1 = FontAwesome5Free:style=Solid:size=7.5;2.5
modules-left = bspwm
modules-center = windowname
modules-right = keyboard pulseaudio weather wifi-signal archupd time
modules-left = bspwm windowname
modules-center = time date weather
modules-right = keyboard pulseaudio archupd wifi-signal
tray-position = right
tray-padding = 0
@ -74,7 +74,7 @@ interval = 3
[module/keyboard]
type = internal/xkeyboard
format-prefix = ""
label-layout = %layout%
label-layout = %layout%
blacklist-0 = num lock
blacklist-1 = scroll lock
blacklist-2= caps lock
@ -93,12 +93,12 @@ format-prefix = " "
[module/windowname]
type = internal/xwindow
label = %title%
label-maxlen = 90
label-maxlen = 50
[module/date]
type = internal/date
interval = 600
date = %d.%m.%Y
date = %d.%m
label =  %date%
[module/time]

View file

@ -17,7 +17,7 @@ hide_edge_borders smart
############ Variables ###########
set $terminal alacritty
set $browser firefox
set $browser google-chrome-stable
set $filemanager alacritty --title=ranger -e ranger
set $codeeditor alacritty --title=nvim -e nvim
set $guicode code
@ -73,7 +73,6 @@ bindsym $mod+Shift+w exec $browser
bindsym $mod+Shift+f exec $filemanager
bindsym $mod+Shift+e exec $codeeditor
bindsym $mod+Shift+c exec $guicode
bindsym $mod+Shift+d exec $documentationreader
# Sceenshot
bindsym --release Print exec scrot -s /home/${USER}/$(date +%Y-%m-%d-%H-%M-%S).png
@ -88,8 +87,8 @@ bindsym $mod+minus exec "amixer sset Master 2%-"
bindsym $mod+Shift+minus exec "amixer sset Master toggle"
######### Window preferens ########
assign [class="Alacritty"] $ws1
assign [class="(?i)firefox"] $ws2
assign [class="(?i)alacritty|kitty"] $ws1
assign [class="(?i)firefox|google-chorome-stable"] $ws2
assign [class="(?i)code|vscodium|subl"] $ws3
assign [title="nvim"] $ws3
assign [class="(?!)thunar"] $ws4
@ -164,7 +163,8 @@ bindsym $mod+Shift+9 move container to workspace $ws9
############### Bar ###############
bar {
status_command i3status-rs ~/.config/i3/i3status-rs.toml
#status_command i3status -c ~/.config/i3/i3status
status_command i3blocks -c ~/.config/i3/i3blocks
font pango:JetBrains Mono 10
position top
colors {
@ -186,3 +186,5 @@ client.unfocused #262A2B #262A2B #DFDFDF #262A2B #262A2B
client.urgent #002b36 #262A2B #FFFFFF #262A2B #262A2B
client.placeholder #000000 #000000 #FFFFFF #000000 #000000
client.background #FFFFFF
# vim: ft=i3config

31
config/i3/i3blocks Normal file
View file

@ -0,0 +1,31 @@
separator=true
separator_block_width=15
[keyboard]
command=$HOME/.script/kblayout
label=
interval=repeat
[volume]
command=$HOME/.script/volume
interval=repeat
label=
signal=10
[weather]
command=python $HOME/.config/polybar/scripts/weather.py
interval=10
[wiki-signal]
command=$HOME/.config/polybar/scripts/wifi-signal.sh
label=
interval=5
[updates-arch]
command=$HOME/.config/polybar/scripts/updates-pacman-aur.sh
interval=60
[time]
command=date +%H:%M
label=
interval=60

View file

@ -3,6 +3,7 @@ call plug#begin('~/.vim/plugged')
Plug 'itchyny/lightline.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'maxboisvert/vim-simple-complete'
Plug 'preservim/nerdcommenter'
Plug 'sheerun/vim-polyglot'
call plug#end()
@ -50,6 +51,11 @@ set smartcase
" Enable mode line
set modeline
" File explorer
let g:netrw_banner = 0
let g:netrw_browse_split = 2
let g:netrw_winsize = 15
" Auto reload file
set autoread
@ -57,7 +63,7 @@ set autoread
set hidden
" Spell checker
set spell spelllang=en_us
set nospell spelllang=en_us
" Space/tab indicator
set list listchars=tab:>·,trail:~,extends:>,precedes:<,space
@ -66,10 +72,10 @@ set list listchars=tab:>·,trail:~,extends:>,precedes:<,space:·
set visualbell t_vb=
" == Settings for specific files
"== Settings for specific files
autocmd BufWritePre *.py normal m`:%s/\s\+$//e ``
autocmd FileType python,go,json setlocal expandtab shiftwidth=4 tabstop=4
autocmd FileType html,css,javascript,yaml setlocal expandtab shiftwidth=2 tabstop=2
autocmd FileType html,css,javascript,javascriptreact,yaml setlocal expandtab shiftwidth=2 tabstop=2
"== Aliases
@ -93,14 +99,21 @@ let g:lightline = {
\ [ 'readonly', 'modified' ] ],
\ 'right': [ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'filename', 'filetype' ] ]
\ }, }
\ [ 'filename', 'filetype' ] ] }
\ }
let g:NERDCreateDefaultMappings = 1
let g:NERDSpaceDelims = 1
let g:NERDCompactSexyComs = 1
"== Mapping
let mapleader="'"
" Alternative keys
noremap <C-s> :w<CR>
noremap <C-n> :tabnew<CR>
noremap <leader>ww :Wiki<CR>
noremap <leader>e :Ve<CR>
" Window
noremap <C-h> :wincmd h<CR>

View file

@ -101,10 +101,6 @@ map ss shell tar -czvf file.tar.gz %s
map sd shell 7z a file.7z %s
map se shell extract %s
# "e" key
map ee encrypt
map ed decrypt
# "q"/quit keys/alias
map Q quitall
alias qa quitall
@ -135,13 +131,13 @@ map ? help
# Go keys
map gh cd ~
map gc cd ~/code
map gd cd ~/docs
map gb cd ~/docs/books
map gd cd ~/Documents
map gb cd ~/Documents/books
map gm cd ~/.dotfiles
map gn cd ~/bin
map gs cd ~/.script
map gv cd /media/veracrypt1
map gw cd ~/downl
map gw cd ~/Downloads
# Console
map : console

6
script/kblayout Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
case "$(xkblayout)" in
Eng) echo "en" ;;
Ukr) echo "ua" ;;
*) echo " " ;;
esac

53
script/volume Executable file
View file

@ -0,0 +1,53 @@
#!/usr/bin/env bash
if [[ -z "$MIXER" ]] ; then
MIXER="default"
if command -v pulseaudio >/dev/null 2>&1 && pulseaudio --check ; then
if amixer -D pulse info >/dev/null 2>&1 ; then
MIXER="pulse"
fi
fi
[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug"
MIXER="${2:-$MIXER}"
fi
if [[ -z "$SCONTROL" ]] ; then
SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols |
sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" |
head -n1
)}"
fi
if [[ -z "$STEP" ]] ; then
STEP="${1:-5%}"
fi
NATURAL_MAPPING=${NATURAL_MAPPING:-0}
if [[ "$NATURAL_MAPPING" != "0" ]] ; then
AMIXER_PARAMS="-M"
fi
capability() {
amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL |
sed -n "s/ Capabilities:.*cvolume.*/Capture/p"
}
volume() {
amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL $(capability)
}
format() {
perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)'
perl_filter+='{CORE::say $4 eq "off" ? "M" : "'
perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
perl_filter+='"; exit}'
output=$(perl -ne "$perl_filter")
echo "$LABEL$output"
}
case $BLOCK_BUTTON in
3) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) toggle ;;
4) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;;
5) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;;
esac
volume | format

View file

@ -22,8 +22,8 @@ set-option -sa terminal-overrides ",*:Tc"
###== Keybindongs
## HOME/END key support
bind -n End send-key C-e
bind -n Home send-key C-a
bind-key -n End send-key C-e
bind-key -n Home send-key C-a
bind-key -n Home send Escape "OH"
bind-key -n End send Escape "OF"

View file

@ -1,8 +1,8 @@
{
// Apperence
"workbench.colorTheme": "Ayu Dark Bordered",
"workbench.colorTheme": "Ayu Dark",
"workbench.iconTheme": "ayu",
"editor.fontFamily": "'Jetbrain Mono', 'FontAwesome5Free', 'Droid Sans Mono', 'monospace', 'Droid Sans Fallback'",
"editor.fontFamily": "Jetbrain Mono, Droid Sans Mono, monospace",
"editor.wordWrap": "off",
"editor.fontSize": 14,
@ -46,7 +46,6 @@
// Minimap
"editor.minimap.side": "left",
"editor.minimap.size": "fit",
"editor.minimap.enabled": false,
// Sidebar
"workbench.sideBar.location": "right",
@ -115,5 +114,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"git.autofetch": true,
"editor.formatOnPaste": true,
"editor.minimap.enabled": false,
}

7
zshrc
View file

@ -1,4 +1,4 @@
export PATH="$HOME/.yarn/bin:$HOME/bin:$HOME/.application:$PATH"
export PATH="$HOME/.yarn/bin:$HOME/bin:$HOME/.application:$HOME/.local/bin:$PATH"
### Oh my zsh ###
export ZSH="$HOME/.oh-my-zsh"
@ -14,7 +14,7 @@ DISABLE_AUTO_TITLE="true" # Disable auto-setting terminal title.
#COMPLETION_WAITING_DOTS="true" # Display red dots whilst waiting for completion.
export UPDATE_ZSH_DAYS=7 # Change how often to auto-update.
plugins=(yarn)
plugins=(yarn nvm)
source $ZSH/oh-my-zsh.sh
### Variables
@ -23,7 +23,7 @@ export VISUAL="nvim"
### Functions
bgcolor() {
convert -size 1x1 xc:"$1" /tmp/bgc.png
convert -size 1x1 xc:"#$1" /tmp/bgc.png
feh --bg-tile /tmp/bgc.png}
backup() {
cp $1 $1.bak}
@ -36,6 +36,7 @@ alias du="du -sh"
alias df="df -h"
alias vim="nvim"
alias vi="vim"
alias wiki="vi +Wiki"
alias tmux="tmux -2"
alias :q="exit"
alias ..="cd .."