mirror of
https://github.com/eoli3n/dotfiles
synced 2024-11-22 23:12:32 +01:00
by_host and by_os dirs
This commit is contained in:
parent
df67028d3f
commit
06848fedcf
1
TODO
1
TODO
@ -11,7 +11,6 @@
|
||||
|
||||
- vagrant: chsh in vagrant config file for FreeBSD
|
||||
- powerline: not working with centos|debian|freebsd
|
||||
- zsh: clean zshrc template
|
||||
- playbook: add {{ tag }} to fail module to print in "limit to distrib" task
|
||||
- vagrant: tty in qwerty for debian keyboard
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
packer: name=compton-git state=present
|
||||
|
||||
- name: Configure compton
|
||||
copy: src=files/.compton dest=~/.compton backup=yes
|
||||
copy: src=files/compton dest=~/.compton backup=yes
|
||||
|
||||
- name: Init compton in .xprofile
|
||||
blockinfile:
|
||||
|
@ -2,9 +2,16 @@
|
||||
- \~/.i3/config
|
||||
- \~/.xinitrc
|
||||
|
||||
# Hostname specific configuration for config file
|
||||
Add a dir named as hostname to include specific host configuration in config file
|
||||
# By hostname specific configuration in config file
|
||||
Add a dir named as hostname in by_host dir to include specific host configuration in config file
|
||||
```
|
||||
mkdir templates/$(hostname)
|
||||
echo "#To include in config file" > templates/$(hostname)/config.j2
|
||||
mkdir templates/by_host/$(hostname)
|
||||
echo "#To include in config file" > templates/by_host/$(hostname)/config.j2
|
||||
```
|
||||
|
||||
# By OS specific configuration for config file
|
||||
Add a dir named as OS in by_os to include specific host configuration in config file
|
||||
```
|
||||
mkdir templates/by_os/<archlinux|centos|debian>
|
||||
echo "#To include in config file" > templates/by_os/<archlinux|centos|debian>/config.j2
|
||||
```
|
||||
|
@ -26,7 +26,7 @@
|
||||
ignore_errors: True
|
||||
|
||||
- name: Configure xinitrc
|
||||
copy: src=files/.xinitrc dest=~/.xinitrc backup=yes
|
||||
copy: src=files/xinitrc dest=~/.xinitrc backup=yes
|
||||
|
||||
- name: Template config file
|
||||
template: src=templates/config.j2 dest=~/.i3/config backup=yes
|
||||
|
@ -1,2 +0,0 @@
|
||||
# Vagrant template
|
||||
# test test
|
@ -153,10 +153,9 @@ bindsym $mod+Shift+underscore move container to workspace $tag8
|
||||
bindsym $mod+Shift+ccedilla move container to workspace $tag9
|
||||
bindsym $mod+Shift+agrave move container to workspace $tag10
|
||||
|
||||
### BEGIN includes
|
||||
{% include ansible_hostname + '/config.j2' ignore missing %}
|
||||
{% include 'by_host/' + ansible_hostname + '/config.j2' ignore missing %}
|
||||
|
||||
### END includes
|
||||
{% include 'by_os/' + ansible_distribution|lower + '/config.j2' ignore missing %}
|
||||
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+c reload
|
||||
|
@ -16,9 +16,9 @@ EOF
|
||||
|
||||
It will uncomment monitor values in config.j2 too
|
||||
|
||||
# Modules configuration
|
||||
# Modules configuration by host
|
||||
```
|
||||
mkdir templates/$(hostname)
|
||||
mkdir templates/by_host/$(hostname)
|
||||
# Top modules configuration
|
||||
echo <<\EOF > templates/$(hostname)/modules-top.j2
|
||||
modules-left = i3 xwindow
|
||||
@ -27,21 +27,32 @@ modules-right = backlight volume pkg wlan vpncheck battery date
|
||||
EOF
|
||||
|
||||
# Bottom modules configuration
|
||||
echo <<\EOF > templates/$(hostname)/modules-bottom.j2
|
||||
echo <<\EOF > templates/by_host/$(hostname)/modules-bottom.j2
|
||||
modules-left =
|
||||
modules-center = networkspeedup networkspeeddown
|
||||
modules-right = temperature filesystem-slash filesystem-home cpu memory
|
||||
EOF
|
||||
```
|
||||
|
||||
# Include some modules
|
||||
echo <<\EOF > templates/$(hostname)/modules-def.j2
|
||||
# Modules definition
|
||||
|
||||
## By host
|
||||
|
||||
```
|
||||
echo <<\EOF > templates/by_host/$(hostname)/modules-def.j2
|
||||
[module/example]
|
||||
type = custom/script
|
||||
interval = 1200
|
||||
format = <label>
|
||||
label = "%output:0:100%%"
|
||||
exec = uname -a
|
||||
EOF
|
||||
```
|
||||
|
||||
## By OS
|
||||
|
||||
```
|
||||
echo <<\EOF > templates/by_os/<archlinux|debian|centos>/modules-def.j2
|
||||
[module/example2]
|
||||
type = custom/script
|
||||
interval = 1200
|
||||
|
@ -18,15 +18,15 @@
|
||||
copy: src=files/pkg.sh dest=~/.config/polybar/pkg.sh mode=0755
|
||||
|
||||
- name: Test if node specific template exists for launch.sh
|
||||
stat: path="{{ playbook_dir }}/roles/polybar/templates/{{ ansible_hostname }}/launch.j2"
|
||||
stat: path="{{ playbook_dir }}/roles/polybar/templates/by_host/{{ ansible_hostname }}/launch.j2"
|
||||
register: launch_file
|
||||
|
||||
- name: Test if node specific template exists for modules top
|
||||
stat: path="{{ playbook_dir }}/roles/polybar/templates/{{ ansible_hostname }}/modules-top.j2"
|
||||
stat: path="{{ playbook_dir }}/roles/polybar/templates/by_host/{{ ansible_hostname }}/modules-top.j2"
|
||||
register: polybar_top_file
|
||||
|
||||
- name: Test if node specific template exists for modules bottom
|
||||
stat: path="{{ playbook_dir }}/roles/polybar/templates/{{ ansible_hostname }}/modules-bottom.j2"
|
||||
stat: path="{{ playbook_dir }}/roles/polybar/templates/by_host/{{ ansible_hostname }}/modules-bottom.j2"
|
||||
register: polybar_bottom_file
|
||||
|
||||
- name: Template launch file
|
||||
|
@ -77,7 +77,7 @@ font-2 = siji:pixelsize=10;3
|
||||
font-3 = FontAwesome:pixelsize=14;2
|
||||
|
||||
{% if polybar_top_file.stat.exists %}
|
||||
{% include ansible_hostname + '/modules-top.j2' %}
|
||||
{% include 'by_host/' + ansible_hostname + '/modules-top.j2' %}
|
||||
{% else %}
|
||||
modules-left = i3 xwindow
|
||||
modules-center =
|
||||
@ -139,7 +139,7 @@ font-2 = siji:pixelsize=10;3
|
||||
font-3 = FontAwesome:pixelsize=14;2
|
||||
|
||||
{% if polybar_bottom_file.stat.exists %}
|
||||
{% include ansible_hostname + '/modules-bottom.j2' %}
|
||||
{% include 'by_host/' + ansible_hostname + '/modules-bottom.j2' %}
|
||||
{% else %}
|
||||
modules-left =
|
||||
modules-center = networkspeedup networkspeeddown
|
||||
@ -551,5 +551,8 @@ menu-3-0-exec = i3-msg exit
|
||||
menu-3-1 = cancel
|
||||
menu-3-1-exec = menu-open-0
|
||||
|
||||
{% include ansible_hostname + '/modules-def.j2' ignore missing %}
|
||||
{% include 'by_host/' + ansible_hostname + '/modules-def.j2' ignore missing %}
|
||||
|
||||
{% include 'by_os/' + ansible_distribution|lower + '/modules-def.j2' ignore missing %}
|
||||
|
||||
; vim:ft=dosini
|
||||
|
@ -8,7 +8,7 @@ while pgrep -x polybar >/dev/null; do sleep 1; done
|
||||
|
||||
# Launch top and bottom
|
||||
{% if launch_file.stat.exists %}
|
||||
{% include ansible_hostname + '/launch.j2' %}
|
||||
{% include 'by_host/' + ansible_hostname + '/launch.j2' %}
|
||||
{% else %}
|
||||
polybar top &
|
||||
polybar bottom &
|
||||
|
@ -4,4 +4,4 @@
|
||||
become: True
|
||||
|
||||
- name: Configure screen
|
||||
copy: src=files/.screenrc dest=~/.screenrc backup=yes
|
||||
copy: src=files/screenrc dest=~/.screenrc backup=yes
|
||||
|
@ -36,7 +36,7 @@
|
||||
- ~/.vim/autoload
|
||||
|
||||
- name: Configure vim
|
||||
template: src=templates/.vimrc dest=~/.vimrc backup=yes
|
||||
template: src=templates/vimrc dest=~/.vimrc backup=yes
|
||||
|
||||
- name: Configure pathogen autoload
|
||||
copy: src=files/pathogen.vim dest=~/.vim/autoload/pathogen.vim
|
||||
|
@ -4,7 +4,7 @@
|
||||
become: True
|
||||
|
||||
- name: Configure xbindkeys
|
||||
copy: src=files/.xbindkeysrc dest=~/.xbindkeysrc backup=yes
|
||||
copy: src=files/xbindkeysrc dest=~/.xbindkeysrc backup=yes
|
||||
|
||||
- name: Init xbindkeys in .xprofile
|
||||
blockinfile:
|
||||
|
19
roles/zsh/README.md
Normal file
19
roles/zsh/README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# By hostname specific configuration in zshrc
|
||||
Add a dir named as hostname in by_host dir to include specific host configuration in config file
|
||||
```
|
||||
mkdir templates/by_host/$(hostname)
|
||||
echo << EOF > templates/by_host/$(hostname)/zshrc.j2
|
||||
# Alias to include for $(hostname)
|
||||
alias foo=bar
|
||||
EOF
|
||||
```
|
||||
|
||||
# By OS specific configuration in zshrc
|
||||
Add a dir named as hostname in by_host dir to include specific host configuration in config file
|
||||
```
|
||||
mkdir templates/by_os/<archlinux|debian|centos>
|
||||
echo << EOF > templates/by_os/<archlinux|debian|centos>/zshrc.j2
|
||||
# Alias to include for <archlinux|debian|centos>
|
||||
alias foo2=bar2
|
||||
EOF
|
||||
```
|
@ -69,7 +69,7 @@
|
||||
register: zsh_syntax_highlighting_dir
|
||||
|
||||
- name: Configure zshrc
|
||||
template: src=templates/.zshrc dest=~/.zshrc backup=yes
|
||||
template: src=templates/zshrc.j2 dest=~/.zshrc backup=yes
|
||||
|
||||
- debug:
|
||||
msg: "Do not forget to 'chsh /usr/bin/zsh'"
|
||||
|
4
roles/zsh/templates/by_os/archlinux/zshrc.j2
Normal file
4
roles/zsh/templates/by_os/archlinux/zshrc.j2
Normal file
@ -0,0 +1,4 @@
|
||||
### ARCHLINUX INCLUDE
|
||||
alias installed="pacman -Qqen"
|
||||
dupkg() { expac '%m\t%n' | sort -h | awk '{cmd = "numfmt --to=si "$1; cmd | getline n; close(cmd); print n, $2}' }
|
||||
dupkg_ex() { expac -H M "%011m\t%-20n\t%10d" $(comm -23 <(pacman -Qqen | sort) <(pacman -Qqg base base-devel | sort)) | sort -n }
|
@ -1,30 +1,33 @@
|
||||
# Path to your oh-my-zsh installation.
|
||||
export ZSH=$HOME/.oh-my-zsh
|
||||
|
||||
# Set name of the theme to load.
|
||||
#ZSH_THEME="pure"
|
||||
|
||||
#turn on comments with # in shell
|
||||
setopt interactivecomments
|
||||
|
||||
### ALIASES
|
||||
alias zshconfig="vi ~/.zshrc_node"
|
||||
alias zshconfig_global="vi ~/.zshrc"
|
||||
|
||||
alias startx="ssh-agent startx"
|
||||
|
||||
alias zshconfig="vi ~/.zshrc"
|
||||
alias zshconfig_node="vi ~/.zshrc_node"
|
||||
alias vimconfig="vi ~/.vimrc"
|
||||
alias sshconfig="vi ~/.ssh/config"
|
||||
|
||||
alias lh="du -ahd1 | sort -h"
|
||||
#lhs() { for list in $(ls -a | sed 's/\ /\\ /g'); do du -hs $list; done | sort -hr }
|
||||
#alias sprunge="curl -F 'sprunge=<-' http://sprunge.us"
|
||||
|
||||
wanip() { curl icanhazip.com }
|
||||
lanip() { ip a | grep $(ip r | grep default | head | cut -d\ -f5) | grep inet | awk '{print $2}' | cut -d"/" -f1 }
|
||||
|
||||
alias ix="curl -s -F 'f:1=<-' ix.io"
|
||||
up () {curl -F "c=@${1:--}" https://ptpb.pw/}
|
||||
|
||||
alias vi="vim"
|
||||
alias sudo="sudo "
|
||||
alias installed="pacman -Qqen"
|
||||
alias chrome="google-chrome-stable"
|
||||
alias tmux="tmux -2"
|
||||
#alias neofetch="neofetch --crop_mode fit --image_size 33% --image ~/.config/neofetch/archlinux.png --colors 0 7 7 7 7 7"
|
||||
bak() { cp "$1" "$1.bak" }
|
||||
chromeapp() { google-chrome-stable --app=$1 }
|
||||
alias tmux="tmux -2"
|
||||
bak() { cp "$1" "$1.bak" }
|
||||
extract() {
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
@ -46,12 +49,6 @@ extract() {
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
alias startx="ssh-agent startx"
|
||||
|
||||
### System clean tools
|
||||
|
||||
dupkg() { expac '%m\t%n' | sort -h | awk '{cmd = "numfmt --to=si "$1; cmd | getline n; close(cmd); print n, $2}' }
|
||||
dupkg_ex() { expac -H M "%011m\t%-20n\t%10d" $(comm -23 <(pacman -Qqen | sort) <(pacman -Qqg base base-devel | sort)) | sort -n }
|
||||
|
||||
### EXPORTS
|
||||
export LANG='fr_FR.UTF-8'
|
||||
@ -62,18 +59,20 @@ export POWERLINE_CONFIG_COMMAND='powerline-config'
|
||||
export PAGER='most'
|
||||
export PATH=${PATH}:~/.gem/ruby/2.4.0/bin
|
||||
|
||||
{% include 'by_host/' + ansible_hostname + '/zshrc.j2' ignore missing %}
|
||||
|
||||
{% include 'by_os/' + ansible_distribution|lower + '/zshrc.j2' ignore missing %}
|
||||
|
||||
### ZSHRC NODE
|
||||
source ~/.zshrc_node
|
||||
|
||||
### ZSH CONF
|
||||
### ZSH PURE
|
||||
autoload -U zmv
|
||||
plugins=(git python colored-man-pages colorize sprunge web-search)
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
source {{ zsh_syntax_highlighting_dir.stdout }}
|
||||
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
|
||||
|
||||
### PURE PROMPT
|
||||
fpath=( "$HOME/.zfunctions" $fpath )
|
||||
autoload -U promptinit; promptinit
|
||||
prompt pure
|
Loading…
Reference in New Issue
Block a user