Various script and profiles kept here to be quickly efficient in a new environement.
Last active
September 30, 2018 22:47
-
-
Save pmalhaire/3a30af4f6c89b6c9966dcbddeebeebef to your computer and use it in GitHub Desktop.
Various script and profiles kept here to be quickly efficient in a new environement.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# ~/.bashrc | |
# | |
[[ $- != *i* ]] && return | |
colors() { | |
local fgc bgc vals seq0 | |
printf "Color escapes are %s\n" '\e[${value};...;${value}m' | |
printf "Values 30..37 are \e[33mforeground colors\e[m\n" | |
printf "Values 40..47 are \e[43mbackground colors\e[m\n" | |
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n" | |
# foreground colors | |
for fgc in {30..37}; do | |
# background colors | |
for bgc in {40..47}; do | |
fgc=${fgc#37} # white | |
bgc=${bgc#40} # black | |
vals="${fgc:+$fgc;}${bgc}" | |
vals=${vals%%;} | |
seq0="${vals:+\e[${vals}m}" | |
printf " %-9s" "${seq0:-(default)}" | |
printf " ${seq0}TEXT\e[m" | |
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m" | |
done | |
echo; echo | |
done | |
} | |
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion | |
# Change the window title of X terminals | |
case ${TERM} in | |
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*) | |
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"' | |
;; | |
screen*) | |
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"' | |
;; | |
esac | |
use_color=true | |
# Set colorful PS1 only on colorful terminals. | |
# dircolors --print-database uses its own built-in database | |
# instead of using /etc/DIR_COLORS. Try to use the external file | |
# first to take advantage of user additions. Use internal bash | |
# globbing instead of external grep binary. | |
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM | |
match_lhs="" | |
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" | |
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)" | |
[[ -z ${match_lhs} ]] \ | |
&& type -P dircolors >/dev/null \ | |
&& match_lhs=$(dircolors --print-database) | |
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true | |
if ${use_color} ; then | |
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489 | |
if type -P dircolors >/dev/null ; then | |
if [[ -f ~/.dir_colors ]] ; then | |
eval $(dircolors -b ~/.dir_colors) | |
elif [[ -f /etc/DIR_COLORS ]] ; then | |
eval $(dircolors -b /etc/DIR_COLORS) | |
fi | |
fi | |
if [[ ${EUID} == 0 ]] ; then | |
PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] ' | |
else | |
PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] ' | |
fi | |
alias ls='ls --color=auto' | |
alias grep='grep --colour=auto' | |
alias egrep='egrep --colour=auto' | |
alias fgrep='fgrep --colour=auto' | |
else | |
if [[ ${EUID} == 0 ]] ; then | |
# show root@ when we don't have colors | |
PS1='\u@\h \W \$ ' | |
else | |
PS1='\u@\h \w \$ ' | |
fi | |
fi | |
unset use_color safe_term match_lhs sh | |
alias cp="cp -i" # confirm before overwriting something | |
alias df='df -h' # human-readable sizes | |
alias free='free -m' # show sizes in MB | |
alias np='nano -w PKGBUILD' | |
alias more=less | |
xhost +local:root > /dev/null 2>&1 | |
complete -cf sudo | |
# Bash won't get SIGWINCH if another process is in the foreground. | |
# Enable checkwinsize so that bash will check the terminal size when | |
# it regains control. #65623 | |
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11) | |
shopt -s checkwinsize | |
shopt -s expand_aliases | |
# export QT_SELECT=4 | |
# Enable history appending instead of overwriting. #139609 | |
shopt -s histappend | |
# | |
# # ex - archive extractor | |
# # usage: ex <file> | |
ex () | |
{ | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xjf $1 ;; | |
*.tar.gz) tar xzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xf $1 ;; | |
*.tbz2) tar xjf $1 ;; | |
*.tgz) tar xzf $1 ;; | |
*.zip) unzip $1 ;; | |
*.Z) uncompress $1;; | |
*.7z) 7z x $1 ;; | |
*) echo "'$1' cannot be extracted via ex()" ;; | |
esac | |
else | |
echo "'$1' is not a valid file" | |
fi | |
} | |
# better yaourt colors | |
export YAOURT_COLORS="nb=1:pkg=1:ver=1;32:lver=1;45:installed=1;42:grp=1;34:od=1;41;5:votes=1;44:dsc=0:other=1;35" | |
# my personnal commands | |
alias vi='vim' | |
alias ll='ls -ltra --color=auto' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# =========================================================================== # | |
# mbh tmux config | |
# =========================================================================== # | |
col_1=colour98 # main color | |
#col_1=green # main color | |
col_2=colour117 # deactivated tmux color | |
#col_2=cyan # deactivated tmux color | |
col_3=colour8 # deactivated inactive pane color | |
stat_left="➤" | |
# =========================================================================== # | |
# prefix stuff | |
# =========================================================================== # | |
unbind C-b | |
set -g prefix C-q | |
bind q send-prefix | |
# =========================================================================== # | |
# binds | |
# =========================================================================== # | |
# pane navigation | |
bind -n C-Up select-pane -U | |
bind -n C-Down select-pane -D | |
bind -n C-Left select-pane -L | |
bind -n C-Right select-pane -R | |
# pane resizing | |
bind -r C-Down resize-pane -D | |
bind -r C-Up resize-pane -U | |
bind -r C-Left resize-pane -L | |
bind -r C-Right resize-pane -R | |
# window navigation | |
bind -n S-Left previous-window | |
bind -n S-Right next-window | |
bind b previous-window | |
bind n next-window | |
# splits & new windows | |
bind s split-window -h -c "#{pane_current_path}" | |
bind x split-window -v -c "#{pane_current_path}" | |
bind c new-window | |
# close pane | |
bind -n C-w kill-pane | |
# scrollback | |
bind -n C-PPage copy-mode -u | |
unbind -T copy-mode C-Up | |
unbind -T copy-mode C-Down | |
# reload conf | |
bind r source-file ~/.tmux.conf \; display-message '★ conf reloaded ★' | |
# display panes info | |
bind a display-panes | |
# zoom in / out | |
bind z resize-pane -Z | |
bind l resize-pane -Z | |
bind m resize-pane -Z | |
# dump history to file | |
bind P command-prompt -p 'save history to filename:' -I '/tmp/dump.txt' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer' | |
# open man | |
bind / command-prompt -p 'man' "split-window 'exec man %%'" | |
# toggle pane synchronization | |
bind y setw synchronize-panes \; display-message 'toggled pane synchronization' | |
# # conditional command tests | |
# is_ssh="ps -o state= -o comm= -t '#{pane_tty}' | \ | |
# grep -iqE '^[^TXZ ]+ +(\\S+\\/)?ssh$' " | |
# bind h run "($is_ssh && tmux send-keys y) || tmux send-keys n" | |
# bind j if-shell "$is_ssh" "send-keys y" "send-keys n" | |
# =========================================================================== # | |
# tmux godmode, support nested tmux | |
# =========================================================================== # | |
# increment variable TMUX_NEST | |
set-environment -g 'TMUX_NEST' "0" | |
TMUX_NEST_INC='tmux set-environment -g TMUX_NEST $(($(tmux show-environment -g TMUX_NEST 2>/dev/null | cut -d'=' -f2 ) + 1))' | |
TMUX_NEST_DEC='tmux set-environment -g TMUX_NEST $(($(tmux show-environment -g TMUX_NEST 2>/dev/null | cut -d'=' -f2 ) - 1))' | |
TMUX_NEST_GET='tmux show-environment -g TMUX_NEST 2>/dev/null | cut -d'=' -f2 ' | |
theme_on=" \ | |
tmux set -g window-status-current-fg $col_1 ;\ | |
tmux set -g status-right-fg $col_1 ;\ | |
tmux set -g pane-active-border-fg $col_1 ;\ | |
tmux set -g pane-border-fg default ;\ | |
tmux set -g message-bg $col_1 ;\ | |
tmux set -g status-left-fg default ;\ | |
tmux set -g status-left $stat_left " | |
theme_off=" \ | |
tmux set -g window-status-current-fg $col_2 ;\ | |
tmux set -g status-right-fg $col_2 ;\ | |
tmux set -g pane-active-border-fg $col_2 ;\ | |
tmux set -g pane-border-fg colour8 ;\ | |
tmux set -g message-bg $col_2 ;\ | |
tmux set -g status-left-fg $col_2 ;\ | |
tmux set -g status-left \"(inactive)\" " | |
# activate / deactivate tmux theme | |
bind F1 run "$theme_on" | |
bind F2 run "$theme_off" | |
# increase / decrease tmux nest counter | |
bind F3 run "$TMUX_NEST_INC" | |
bind F4 run "$TMUX_NEST_DEC" | |
# relay keys to inside tmux to switch theme on/off | |
in_on="tmux send-keys C-q F1" | |
in_off="tmux send-keys C-q F2" | |
# unbind all direct access keys (no prefix) and remove local prefix (switch it to C-b) | |
keys_unbind=" \ | |
tmux unbind -n C-up ;\ | |
tmux unbind -n C-down ;\ | |
tmux unbind -n C-left ;\ | |
tmux unbind -n C-right ;\ | |
tmux unbind -n C-pageup ;\ | |
tmux unbind -n C-w ;\ | |
tmux unbind -n S-left ;\ | |
tmux unbind -n S-right ;\ | |
tmux set -g prefix C-b ;\ | |
tmux unbind C-q " | |
# rebind all direct access keys (no prefix) and switch back prefix to C-q | |
keys_rebind=' \ | |
tmux bind -n C-up select-pane -U ;\ | |
tmux bind -n C-down select-pane -D ;\ | |
tmux bind -n C-left select-pane -L ;\ | |
tmux bind -n C-right select-pane -R ;\ | |
tmux bind -n C-pageup copy-mode -u ;\ | |
tmux bind -n C-w kill-pane ;\ | |
tmux bind -n S-left previous-window ;\ | |
tmux bind -n S-right next-window ;\ | |
tmux set -g prefix C-q ;\ | |
tmux unbind C-b ' | |
# activate inner tmux & deactivate outer tmux | |
# this bind always stays activated, if local tmux is not currently active, just increase nest_counter & relay key | |
bind -n S-up run "$TMUX_NEST_INC" \; \ | |
if-shell "tmux show-environment -g TMUX_NEST 2>/dev/null | cut -d'=' -f2 | grep '^1$' > /dev/null" \ | |
'run "$in_on ; $keys_unbind ; $theme_off"' \ | |
'send-keys S-up' | |
# reactivate outer tmux & deactivate inner tmux | |
# this bind always stays activated, decrease nest_counter, if nest counter reaches 0 => rebind all keys, if not relay key | |
bind -n S-down run "$TMUX_NEST_DEC" \; \ | |
if-shell "tmux show-environment -g TMUX_NEST 2>/dev/null | cut -d'=' -f2 | grep '^0$' > /dev/null" \ | |
'run "$in_off ; $keys_rebind ; $theme_on"' \ | |
'send-keys S-down' | |
# =========================================================================== # | |
# mouse (tmux 2.3+) | |
# =========================================================================== # | |
set -g mouse on | |
# kill window | |
bind -n MouseUp2Status kill-window -t= | |
# reorder windows | |
bind -n MouseDrag1Status swap-window -t= | |
# new window on double click | |
bind -n DoubleClick1Status new-window | |
# clipboard | |
bind -T copy-mode MouseDragEnd1Pane send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null" | |
bind -T copy-mode Enter send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null" | |
# right click & middle click => paste | |
bind -n MouseDown3Pane run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer" | |
bind -n MouseDown2Pane run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer" | |
# =========================================================================== # | |
# config | |
# =========================================================================== # | |
# term | |
set -g default-terminal "screen-256color" # we want colors | |
set-window-option -g xterm-keys on # dont hijack alt+left / alt+backspace / ... | |
set -g history-limit 40000 # backlog | |
# compatibility with putty for ctrl+arrows | |
#set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@" | |
#set -g terminal-overrides 'xterm*:smcup@:rmcup@' | |
set -ga terminal-overrides ",*:Tc" # for 24bits colors | |
# windows | |
set -g set-titles on | |
set-window-option -g automatic-rename on | |
set -g renumber-windows on | |
# =========================================================================== # | |
# status bar | |
# =========================================================================== # | |
# status bar globals | |
set -g status-bg default | |
set -g status-fg default | |
set -g status-interval 5 | |
set -g status-justify left | |
# left hand status bar | |
set -g status-left-length 30 | |
set -g status-left $stat_left | |
# selected window status | |
setw -g window-status-current-attr none | |
setw -g window-status-current-bg default | |
setw -g window-status-current-fg $col_1 | |
setw -g window-status-current-format " ★ #I #W" | |
# unselected windows status | |
setw -g window-status-attr none | |
setw -g window-status-bg default | |
setw -g window-status-fg white | |
setw -g window-status-format " ☆ #I #W" | |
# status bar right (time / date) | |
# set -g status-right '☀ %d/%m ⌛%H:%M ' #⌛ | |
set -g status-right '%d/%m %H:%M ' | |
set -g status-right-length 30 | |
set -g status-right-bg default | |
set -g status-right-fg $col_1 | |
# =========================================================================== # | |
# other colors | |
# =========================================================================== # | |
# messages | |
set -g message-attr dim | |
set -g message-fg black | |
set -g message-bg $col_1 | |
set -g message-command-attr dim | |
set -g message-command-fg black | |
set -g message-command-bg $col_1 | |
# scroll indicator | |
set -g mode-fg black | |
set -g mode-bg $col_1 | |
set -g mode-attr dim | |
# pane colors | |
set -g pane-active-border-fg $col_1 | |
set -g pane-active-border-bg default | |
set -g pane-border-fg default | |
set -g pane-border-bg default | |
# less colors for when we use the binding C-q / | |
set-environment -g 'LESS_TERMCAP_mb' "\e[01;31m" | |
set-environment -g 'LESS_TERMCAP_md' "\e[01;38;5;12m" | |
set-environment -g 'LESS_TERMCAP_me' "\e[0m" | |
set-environment -g 'LESS_TERMCAP_so' "\e[30m\e[42m" | |
set-environment -g 'LESS_TERMCAP_se' "\e[0m" | |
set-environment -g 'LESS_TERMCAP_us' "\e[04;38;5;6m" | |
set-environment -g 'LESS_TERMCAP_ue' "\e[0m" | |
# =========================================================================== # | |
# not main tmux? starting a secondary tmux inside ssh? | |
# =========================================================================== # | |
# starting inside ssh? deactivate them right away & set mouse off | |
if-shell "env | grep SSH_CLIENT" '\ | |
run "$theme_off" ;\ | |
set -g mouse off ' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Defines Docker aliases. | |
# | |
# Author: | |
# François Vantomme <akarzim@gmail.com> | |
# | |
# Return if requirements are not found. | |
if (( ! $+commands[docker] )); then | |
return 1 | |
fi | |
# | |
# Functions | |
# | |
# Set Docker Machine environment | |
function dkme { | |
if (( ! $+commands[docker-machine] )); then | |
return 1 | |
fi | |
eval $(docker-machine env $1) | |
} | |
# Set Docker Machine default machine | |
function dkmd { | |
if (( ! $+commands[docker-machine] )); then | |
return 1 | |
fi | |
pushd ~/.docker/machine/machines | |
if [[ ! -d $1 ]]; then | |
echo "Docker machine '$1' does not exists. Abort." | |
popd | |
return 1 | |
fi | |
if [[ -L default ]]; then | |
eval $(rm -f default) | |
elif [[ -d default ]]; then | |
echo "A default manchine already exists. Abort." | |
popd | |
return 1 | |
elif [[ -e default ]]; then | |
echo "A file named 'default' already exists. Abort." | |
popd | |
return 1 | |
fi | |
eval $(ln -s $1 default) | |
popd | |
} | |
# | |
# Aliases | |
# | |
# Docker | |
alias dk='docker' | |
alias dka='docker attach' | |
alias dkb='docker build' | |
alias dkd='docker diff' | |
alias dkdf='docker system df' | |
alias dke='docker exec' | |
alias dkE='docker exec -it' | |
alias dkh='docker history' | |
alias dki='docker images' | |
alias dkin='docker inspect' | |
alias dkim='docker import' | |
alias dkk='docker kill' | |
alias dkkh='docker kill -s HUP' | |
alias dkl='docker logs' | |
alias dkli='docker login' | |
alias dklo='docker logout' | |
alias dkls='docker ps' | |
alias dkp='docker pause' | |
alias dkP='docker unpause' | |
alias dkpl='docker pull' | |
alias dkph='docker push' | |
alias dkps='docker ps' | |
alias dkpsa='docker ps -a' | |
alias dkr='docker run' | |
alias dkR='docker run -it --rm' | |
alias dkRe='docker run -it --rm --entrypoint /bin/bash' | |
alias dkRM='docker system prune' | |
alias dkrm='docker rm' | |
alias dkrmi='docker rmi' | |
alias dkrn='docker rename' | |
alias dks='docker start' | |
alias dkS='docker restart' | |
alias dkss='docker stats' | |
alias dksv='docker save' | |
alias dkt='docker tag' | |
alias dktop='docker top' | |
alias dkup='docker update' | |
alias dkV='docker volume' | |
alias dkv='docker version' | |
alias dkw='docker wait' | |
alias dkx='docker stop' | |
alias dkC='docker container' | |
alias dkCa='docker container attach' | |
alias dkCcp='docker container cp' | |
alias dkCd='docker container diff' | |
alias dkCe='docker container exec' | |
alias dkCin='docker container inspect' | |
alias dkCk='docker container kill' | |
alias dkCl='docker container logs' | |
alias dkCls='docker container ls' | |
alias dkCp='docker container pause' | |
alias dkCpr='docker container prune' | |
alias dkCrn='docker container rename' | |
alias dkCS='docker container restart' | |
alias dkCrm='docker container rm' | |
alias dkCr='docker container run' | |
alias dkCR='docker container run -it --rm' | |
alias dkCRe='docker container run -it --rm --entrypoint /bin/bash' | |
alias dkCs='docker container start' | |
alias dkCss='docker container stats' | |
alias dkCx='docker container stop' | |
alias dkCtop='docker container top' | |
alias dkCP='docker container unpause' | |
alias dkCup='docker container update' | |
alias dkCw='docker container wait' | |
alias dkI='docker image' | |
alias dkIb='docker image build' | |
alias dkIh='docker image history' | |
alias dkIim='docker image import' | |
alias dkIin='docker image inspect' | |
alias dkIls='docker image ls' | |
alias dkIpr='docker image prune' | |
alias dkIpl='docker image pull' | |
alias dkIph='docker image push' | |
alias dkIrm='docker image rm' | |
alias dkIsv='docker image save' | |
alias dkIt='docker image tag' | |
alias dkV='docker volume' | |
alias dkVin='docker volume inspect' | |
alias dkVls='docker volume ls' | |
alias dkVpr='docker volume prune' | |
alias dkVrm='docker volume rm' | |
alias dkN='docker network' | |
alias dkNs='docker network connect' | |
alias dkNx='docker network disconnect' | |
alias dkNin='docker network inspect' | |
alias dkNls='docker network ls' | |
alias dkNpr='docker network prune' | |
alias dkNrm='docker network rm' | |
alias dkY='docker system' | |
alias dkYdf='docker system df' | |
alias dkYpr='docker system prune' | |
alias dkK='docker stack' | |
alias dkKls='docker stack ls' | |
alias dkKps='docker stack ps' | |
alias dkKrm='docker stack rm' | |
alias dkW='docker swarm' | |
# Clean up exited containers (docker < 1.13) | |
alias dkrmC='docker rm $(docker ps -qaf status=exited)' | |
# Clean up dangling images (docker < 1.13) | |
alias dkrmI='docker rmi $(docker images -qf dangling=true)' | |
# Pull all tagged images | |
alias dkplI='docker images --format "{{ .Repository }}" | grep -v "^<none>$" | xargs -L1 docker pull' | |
# Clean up dangling volumes (docker < 1.13) | |
alias dkrmV='docker volume rm $(docker volume ls -qf dangling=true)' | |
# Docker Machine | |
alias dkm='docker-machine' | |
alias dkma='docker-machine active' | |
alias dkmcp='docker-machine scp' | |
alias dkmin='docker-machine inspect' | |
alias dkmip='docker-machine ip' | |
alias dkmk='docker-machine kill' | |
alias dkmls='docker-machine ls' | |
alias dkmpr='docker-machine provision' | |
alias dkmps='docker-machine ps' | |
alias dkmrg='docker-machine regenerate-certs' | |
alias dkmrm='docker-machine rm' | |
alias dkms='docker-machine start' | |
alias dkmsh='docker-machine ssh' | |
alias dkmst='docker-machine status' | |
alias dkmS='docker-machine restart' | |
alias dkmu='docker-machine url' | |
alias dkmup='docker-machine upgrade' | |
alias dkmv='docker-machine version' | |
alias dkmx='docker-machine stop' | |
# Docker Compose | |
alias dkc='docker-compose' | |
alias dkcb='docker-compose build' | |
alias dkcB='docker-compose build --no-cache' | |
alias dkcd='docker-compose down' | |
alias dkce='docker-compose exec' | |
alias dkck='docker-compose kill' | |
alias dkcl='docker-compose logs' | |
alias dkcls='docker-compose ps' | |
alias dkcp='docker-compose pause' | |
alias dkcP='docker-compose unpause' | |
alias dkcpl='docker-compose pull' | |
alias dkcph='docker-compose push' | |
alias dkcps='docker-compose ps' | |
alias dkcr='docker-compose run' | |
alias dkcR='docker-compose run --rm' | |
alias dkcrm='docker-compose rm' | |
alias dkcs='docker-compose start' | |
alias dkcsc='docker-compose scale' | |
alias dkcS='docker-compose restart' | |
alias dkcu='docker-compose up' | |
alias dkcU='docker-compose up -d' | |
alias dkcv='docker-compose version' | |
alias dkcx='docker-compose stop' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file has been auto-generated by i3-config-wizard(1). | |
# It will not be overwritten, so edit it as you like. | |
# | |
# Should you change your keyboard layout some time, delete | |
# this file and re-run i3-config-wizard(1). | |
# | |
# i3 config file (v4) | |
# | |
# Please see https://i3wm.org/docs/userguide.html for a complete reference! | |
set $mod Mod4 | |
# Font for window titles. Will also be used by the bar unless a different font | |
# is used in the bar {} block below. | |
font pango:monospace 8 | |
# This font is widely installed, provides lots of unicode glyphs, right-to-left | |
# text rendering and scalability on retina/hidpi displays (thanks to pango). | |
#font pango:DejaVu Sans Mono 8 | |
# Before i3 v4.8, we used to recommend this one as the default: | |
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 | |
# The font above is very space-efficient, that is, it looks good, sharp and | |
# clear in small sizes. However, its unicode glyph coverage is limited, the old | |
# X core fonts rendering does not support right-to-left and this being a bitmap | |
# font, it doesn’t scale on retina/hidpi displays. | |
# Use Mouse+$mod to drag floating windows to their wanted position | |
floating_modifier $mod | |
# start a terminal | |
bindsym $mod+Return exec i3-sensible-terminal | |
# kill focused window | |
bindsym $mod+Shift+q kill | |
# start dmenu (a program launcher) | |
bindsym $mod+d exec dmenu_run | |
# There also is the (new) i3-dmenu-desktop which only displays applications | |
# shipping a .desktop file. It is a wrapper around dmenu, so you need that | |
# installed. | |
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop | |
# change focus | |
bindsym $mod+j focus left | |
bindsym $mod+k focus down | |
bindsym $mod+l focus up | |
bindsym $mod+semicolon focus right | |
# alternatively, you can use the cursor keys: | |
bindsym $mod+Left focus left | |
bindsym $mod+Down focus down | |
bindsym $mod+Up focus up | |
bindsym $mod+Right focus right | |
# move focused window | |
bindsym $mod+Shift+j move left | |
bindsym $mod+Shift+k move down | |
bindsym $mod+Shift+l move up | |
bindsym $mod+Shift+m move right | |
# alternatively, you can use the cursor keys: | |
bindsym $mod+Shift+Left move left | |
bindsym $mod+Shift+Down move down | |
bindsym $mod+Shift+Up move up | |
bindsym $mod+Shift+Right move right | |
# split in horizontal orientation | |
bindsym $mod+h split h | |
# split in vertical orientation | |
bindsym $mod+v split v | |
# enter fullscreen mode for the focused container | |
bindsym $mod+f fullscreen toggle | |
# change container layout (stacked, tabbed, toggle split) | |
bindsym $mod+s layout stacking | |
bindsym $mod+w layout tabbed | |
bindsym $mod+e layout toggle split | |
# toggle tiling / floating | |
bindsym $mod+Shift+space floating toggle | |
# change focus between tiling / floating windows | |
bindsym $mod+space focus mode_toggle | |
# focus the parent container | |
bindsym $mod+a focus parent | |
# focus the child container | |
#bindsym $mod+d focus child | |
# Define names for default workspaces for which we configure key bindings later on. | |
# We use variables to avoid repeating the names in multiple places. | |
set $ws1 "1:term" | |
set $ws2 "2:web" | |
set $ws3 "3" | |
set $ws4 "4" | |
set $ws5 "5" | |
set $ws6 "6" | |
set $ws7 "7" | |
set $ws8 "8" | |
set $ws9 "9" | |
set $ws10 "10" | |
# switch to workspace | |
bindsym $mod+1 workspace $ws1 | |
bindsym $mod+2 workspace $ws2 | |
bindsym $mod+3 workspace $ws3 | |
bindsym $mod+4 workspace $ws4 | |
bindsym $mod+5 workspace $ws5 | |
bindsym $mod+6 workspace $ws6 | |
bindsym $mod+7 workspace $ws7 | |
bindsym $mod+8 workspace $ws8 | |
bindsym $mod+9 workspace $ws9 | |
bindsym $mod+0 workspace $ws10 | |
# move focused container to workspace | |
bindsym $mod+Shift+1 move container to workspace $ws1 | |
bindsym $mod+Shift+2 move container to workspace $ws2 | |
bindsym $mod+Shift+3 move container to workspace $ws3 | |
bindsym $mod+Shift+4 move container to workspace $ws4 | |
bindsym $mod+Shift+5 move container to workspace $ws5 | |
bindsym $mod+Shift+6 move container to workspace $ws6 | |
bindsym $mod+Shift+7 move container to workspace $ws7 | |
bindsym $mod+Shift+8 move container to workspace $ws8 | |
bindsym $mod+Shift+9 move container to workspace $ws9 | |
bindsym $mod+Shift+0 move container to workspace $ws10 | |
# reload the configuration file | |
bindsym $mod+Shift+c reload | |
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) | |
bindsym $mod+Shift+r restart | |
# exit i3 (logs you out of your X session) | |
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" | |
# resize window (you can also use the mouse for that) | |
mode "resize" { | |
# These bindings trigger as soon as you enter the resize mode | |
# Pressing left will shrink the window’s width. | |
# 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 j resize shrink width 10 px or 10 ppt | |
bindsym k resize grow height 10 px or 10 ppt | |
bindsym l resize shrink height 10 px or 10 ppt | |
bindsym semicolon resize grow width 10 px or 10 ppt | |
# same bindings, but for the arrow keys | |
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 | |
# back to normal: Enter or Escape or $mod+r | |
bindsym Return mode "default" | |
bindsym Escape mode "default" | |
bindsym $mod+r mode "default" | |
} | |
bindsym $mod+r mode "resize" | |
# Start i3bar to display a workspace bar (plus the system information i3status | |
# finds out, if available) | |
bar { | |
status_command i3status | |
} | |
# start default session | |
exec --no-startup-id i3-msg 'workspace 1:term; exec termite; exec termite' | |
exec --no-startup-id i3-msg 'workspace 2:web; exec firefox' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment