Commit db3ceb6d authored by Joris's avatar Joris

Add configuration files

parents
#!/bin/sh
if [ -t 0 ]
then
cat "$1" | xsel --clipboard
cat "$1" | xsel --primary
else
content=''
while read -r line
do
content=$content$line"\n"
done
echo -e $content | xsel --input --clipboard
echo -e $content | xsel --input --primary
fi
#!/bin/sh
cd "$HOME/downloads"
aria2c $(xsel)
echo "Done!"
read
#!/bin/sh
GREP=$(ps -elf | grep 'offlineimap' | grep -v 'grep offlineimap' | grep -v 'my-offlineimap')
# If offlineimap is not running
if [ -z "$GREP" ]
then
# Free the lock if it exists
if [ -e ~/.offlineimap/perso.lock ]
then
rm ~/.offlineimap/perso.lock
fi
# Check for new mails
if [ "$1" = "--feedback" ]
then
touch ~/.checkingMails
offlineimap
rm ~/.checkingMails
else
offlineimap
fi
fi
#!/bin/sh
cd "$HOME/downloads"
youtube-dl $(xsel)
echo "Done!"
read
#!/bin/sh
function type_password() {
KEY="$1"
PASSWORD=$(pass show "$KEY" 2>/dev/null)
if [ -n "$PASSWORD" ]
then
xdotool type "$PASSWORD"
xdotool key Tab
fi
}
if [ "$#" -eq 0 ]
then
if [ -e ~/.pw-key ]
then
KEY=$(cat ~/.pw-key)
if [ -n "$KEY" ]
then
type_password "$KEY"
else
echo "key in ~/.pw-key is null"
fi
echo "$KEY"
else
echo "~/.pw-key does not exist"
fi
elif [ "$#" -eq 1 ]
then
KEY="$1"
echo "$KEY" > ~/.pw-key
type_password "$KEY"
else
echo "Usage: $(basename "$0") [key]"
fi
#!/bin/sh
for FILEPATH in ~/pictures/capture/*
do
FILE_OLD=$(expr $(date +%s) - $(stat -c %Y "$FILEPATH"))
DAY_DURATION="$((24 * 60 * 60))"
if [[ "$FILE_OLD" -gt "$DAY_DURATION" ]]
then
rm "$FILEPATH"
fi
done
#!/bin/sh
COUNT=$(ps -elf | grep .config/motion/motion.conf | wc -l)
if [ "$COUNT" -lt 2 ]
then
echo "Run motion"
motion -c ~/.config/motion/motion.conf
else
echo "Motion already running"
fi
#!/bin/sh
VIDEO=$(mktemp /tmp/screencast_XXXXXXXXXX.avi)
PALETTE="/tmp/palette.png"
FILTERS="fps=15,scale=1000:-1:flags=lanczos"
GIF=$(date +"$HOME/pictures/capture/%Y-%m-%d_%H-%M-%S.gif")
mkdir -p ~/pictures/capture
ffcast -s % ffmpeg -y -f x11grab -show_region 1 -framerate 15 \
-video_size %s -i %D+%c -codec:v huffyuv \
-vf crop="iw-mod(iw\\,2):ih-mod(ih\\,2)" "$VIDEO" \
&& ffmpeg -i "$VIDEO" -vf "$FILTERS,palettegen" -y "$PALETTE" \
&& ffmpeg -i "$VIDEO" -i "$PALETTE" -lavfi "$FILTERS [x]; [x][1:v] paletteuse" -y "$GIF" \
&& rm "$VIDEO"
#!/bin/sh
VOLUME="$1"
if [[ "$VOLUME" == 0 ]]
then
pamixer --mute
else
pamixer --unmute
fi
pamixer --set-volume "$VOLUME"
#!/bin/sh
tmux kill-session -t screencast &> /dev/null
tmux new-session -s screencast -d
tmux send-keys -t screencast 'screencast' Enter
#!/bin/sh
touch ~/.screencast
tmux send-keys -t screencast 'q'
while [ -n "$(ps -elf | grep '.bin/screencast' | grep -v 'grep .bin/screencast')" ]
do
sleep 1
done
rm ~/.screencast
tmux kill-session -t screencast
#!/bin/sh
MIC_SOURCE=$(pamixer --list-sources | grep '"Built-in Audio Analog Stereo"' | cut -d ' ' -f 1)
MIC_MUTED=$(pamixer --source "$MIC_SOURCE" --get-mute)
VOLUME=30
if [[ "$MIC_MUTED" == "true" ]]
then
pamixer --source "$MIC_SOURCE" --unmute
pamixer --source "$MIC_SOURCE" --set-volume 30
else
pamixer --source "$MIC_SOURCE" --set-volume 0
pamixer --source "$MIC_SOURCE" --mute
fi
#!/bin/sh
XRESOURCES=~/user-config/conf/xorg/Xresources
DPI=$(grep Xft.dpi "$XRESOURCES")
USERJS=~/.mozilla/firefox/"$(grep Path ~/.mozilla/firefox/profiles.ini | cut -d '=' -f 2)"/user.js
if [[ -n $(echo "$DPI" | grep 120) ]]
then
sed -i 's/Xft.dpi:.*$/Xft.dpi: 160/' "$XRESOURCES"
sed -i 's/layout.css.devPixelsPerPx", ".*"/layout.css.devPixelsPerPx", "1.4"/' "$USERJS"
else
sed -i 's/Xft.dpi:.*$/Xft.dpi: 120/' "$XRESOURCES"
sed -i 's/layout.css.devPixelsPerPx", ".*"/layout.css.devPixelsPerPx", "0.9"/' "$USERJS"
fi
(cd ~/user-config; ./deploy >nul 2>&1)
xrdb -merge ~/.config/Xresources
pkill -9 firefox
nohup firefox &
#!/bin/sh
SYNAPTICS=`which synclient`
if [[ "$SYNAPTICS" == "" ]]
then
echo "$0: install synaptics touchpad driver."
echo "Also make sure that 'Option \"SHMConfig\" \"on\"'"
echo " is added in Touchpad device Section in /etc/X11/xorg.conf"
exit
fi
TOUCHPAD_OFF=$("$SYNAPTICS" | grep TouchpadOff | grep 1)
if [[ $1 = "--info" ]]
then
if [ -n "$TOUCHPAD_OFF" ]
then
echo "<span color='#5555EE'>Touchpad off</span>"
fi
else
if [ -n "$TOUCHPAD_OFF" ]
then
"$SYNAPTICS" TouchpadOff=0
pkill unclutter
else
"$SYNAPTICS" TouchpadOff=1
unclutter -idle 0 &
fi
fi
#!/bin/sh
setxkbmap fr bepo
if [[ -n $(lsusb | grep TypeMatrix) ]]
then
# Remap Alt_Gr to Alt_L
xmodmap -e "keycode 108 = Alt_L NoSymbol Alt_L"
# Remap Shuffle to Escape
xmodmap -e "keycode 102 = Escape NoSymbol Escape"
# Remap Desktop to Alt_Gr
xmodmap -e "keycode 100 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift"
# Get back missing ç
xmodmap -e "keycode 97 = ccedilla NoSymbol Ccedilla"
else
# Remap Alt_Gr to Alt_L
xmodmap -e "keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift"
fi
#!/bin/sh
MOUNT_PATH="$1"
DISK=$(cat /etc/mtab | grep "$MOUNT_PATH" | cut -d ' ' -f1)
if [ -n "$DISK" ]
then
rm -rf "$MOUNT_PATH/.Trash"
udevil umount "$DISK"
fi
#!/bin/sh
# Usage
if [ $# -lt 1 ]
then
echo "Usage: $(basename "$0") command [directory]" 1>&2
exit 1
else
CMD=$1
DIR=$2
fi
# Run process and set PID
function runProcess {
eval "$CMD &"
PID=$!
}
# Kill PID process
function killProcess {
kill $PID 2> /dev/null
}
# Kill the PID process at the end
trap killProcess EXIT
while true
do
runProcess
if [ -n "$DIR" ]
then
inotifywait -r -e modify "$DIR" 2> /dev/null
else
read
fi
killProcess
done
! Solarized color theme
#define S_yellow #b58900
#define S_orange #cb4b16
#define S_red #dc322f
#define S_magenta #d33682
#define S_violet #6c71c4
#define S_blue #268bd2
#define S_cyan #2aa198
#define S_green #859900
! Dark
! #define S_base03 #002b36
! #define S_base02 #073642
! #define S_base01 #586e75
! #define S_base00 #657b83
! #define S_base0 #839496
! #define S_base1 #93a1a1
! #define S_base2 #eee8d5
! #define S_base3 #fdf6e3
! Light
#define S_base03 #fdf6e3
#define S_base02 #eee8d5
#define S_base01 #93a1a1
#define S_base00 #839496
#define S_base0 #657b83
#define S_base1 #586e75
#define S_base2 #073642
#define S_base3 #002b36
! Urxvt
urxvt*scrollBar: false
urxvt*font: xft:Inconsolata:size=10
urxvt*intensityStyles: false
urxvt*perl-ext-common: font-size
urxvt*keysym.C-minus: perl:font-size:decrease
urxvt*keysym.C-plus: perl:font-size:increase
urxvt*font-size.step: 4
urxvt.perl-ext: default,url-select
urxvt.keysym.C-i: perl:url-select:select_next
urxvt.url-select.launcher: firefox -new-window
urxvt.url-select.underline: true
urxvt*background: S_base03
urxvt*foreground: S_base0
urxvt*fadeColor: S_base03
urxvt*cursorColor: S_base1
urxvt*pointerColorBackground: S_base01
urxvt*pointerColorForeground: S_base1
urxvt*color0: S_base02
urxvt*color1: S_red
urxvt*color2: S_green
urxvt*color3: S_yellow
urxvt*color4: S_blue
urxvt*color5: S_magenta
urxvt*color6: S_cyan
urxvt*color7: S_base2
urxvt*color9: S_orange
urxvt*color8: S_base03
urxvt*color10: S_base01
urxvt*color11: S_base00
urxvt*color12: S_base0
urxvt*color13: S_violet
urxvt*color14: S_base1
urxvt*color15: S_base3
Xcursor.size: 48
Xft.antialias: true
Xft.hinting: true
Xft.rgba: rgb
Xft.hintstyle: hintlight
Xft.dpi: 120
# Exec at startup
exec --no-startup-id hsetroot -solid "#FDF6E3"
exec --no-startup-id wmname LG3D
exec --no-startup-id xset -dpms && xset s off
exec --no-startup-id mpd
exec --no-startup-id xss-lock -- i3lock -n -c 222222
# TODO: Ask at startup for GPG-password
# Exec at startup and at reload
exec_always --no-startup-id ~/.bin/typematrix
exec_always --no-startup-id xrdb -merge .config/Xresources
exec_always --no-startup-id xrandr --auto
# Font
font pango:DejaVu Sans Mono 10
# font pango:DejaVu Sans Mono 14
# Constants
set $mod Mod1
set $term urxvt
set $up s
set $down t
set $left c
set $right r
# Drag floating windows with Mouse+Mod1
floating_modifier Mod1
# Kill focused window
bindsym $mod+d kill
# Change focus
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+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Split
bindsym $mod+h split h
bindsym $mod+v split v
# Fullscreen
bindsym $mod+f fullscreen toggle
# Layouts
# bindsym $mod+a layout toggle split
# bindsym $mod+u layout tabbed
# 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
# Switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# Move workspace
bindsym $mod+w move workspace to output right
bindsym $mod+i move workspace to output left
bindsym $mod+Shift+i move workspace to output right
# Focus does not follow the mouse
focus_follows_mouse no
# Desktop menu
bindsym $mod+m exec --no-startup-id dmenu_run -i
# class border backgr. text indicator child_border
client.focused #4c7899 #285577 #ffffff #A57A27 #E1A635
client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a
client.unfocused #333333 #222222 #888888 #292d2e #222222
client.urgent #2f343a #900000 #ffffff #900000 #900000
client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c
# No title bar
new_window pixel 4
hide_edge_borders both
bar {
# mode hide
# hidden_state hide
# modifier Mod1
status_command i3blocks
separator_symbol "~"
tray_output none
colors {
background "#222222"
}
}
# Submodes
bindsym $mod+space mode $mode_application
bindsym $mod+p mode $mode_player
bindsym $mod+q mode $mode_system
# bindsym $mod+e mode "resize"
bindsym $mod+l mode "light"
set $mode_application "(t)erm (f)irefox (g)imp (r)anger (m)ail (p)layer (c)apture (u)pdate (d)ownload (s)wap"
mode $mode_application {
bindsym t exec --no-startup-id $term; mode "default"
bindsym f exec --no-startup-id firefox; mode "default"
bindsym g exec --no-startup-id gimp; mode "default"
bindsym r exec --no-startup-id $term -e zsh -c ranger; mode "default"
bindsym m exec --no-startup-id "~/.bin/my-offlineimap --feedback"; exec --no-startup-id $term -e zsh -c mutt; mode "default"
bindsym p exec gmpc; mode "default"
# Volume control
bindsym dollar exec --no-startup-id "~/.bin/set-volume 0"; mode "default"
bindsym 1 exec --no-startup-id "~/.bin/set-volume 10"; mode "default"
bindsym 2 exec --no-startup-id "~/.bin/set-volume 20"; mode "default"
bindsym 3 exec --no-startup-id "~/.bin/set-volume 30"; mode "default"
bindsym 4 exec --no-startup-id "~/.bin/set-volume 40"; mode "default"
bindsym 5 exec --no-startup-id "~/.bin/set-volume 50"; mode "default"
bindsym 6 exec --no-startup-id "~/.bin/set-volume 60"; mode "default"
bindsym 7 exec --no-startup-id "~/.bin/set-volume 70"; mode "default"
bindsym 8 exec --no-startup-id "~/.bin/set-volume 80"; mode "default"
bindsym 9 exec --no-startup-id "~/.bin/set-volume 90"; mode "default"
bindsym 0 exec --no-startup-id "~/.bin/set-volume 100"; mode "default"
# Submodes
bindsym c mode $mode_capture
bindsym u mode $mode_update
bindsym d mode $mode_download
bindsym s mode $mode_swap
bindsym Escape mode "default"
bindsym Return mode "default"
}
set $mode_capture "(a)ll (p)art (b)egin (e)nd"
mode $mode_capture {
bindsym a exec --no-startup-id "mkdir -p ~/pictures/capture && scrot '%Y-%m-%d_%H-%M-%S.png' -e 'mv $f ~/pictures/capture'"; mode "default"
bindsym --release p exec --no-startup-id "mkdir -p ~/pictures/capture && scrot '%Y-%m-%d_%H-%M-%S.png' -s -e 'mv $f ~/pictures/capture'"; mode "default"
bindsym b exec --no-startup-id ~/.bin/start-screencast-bg; mode "default"
bindsym e exec --no-startup-id ~/.bin/stop-screencast-bg; mode "default"
bindsym Escape mode "default"
bindsym Return mode "default"
}
set $mode_update "(m)ails"
mode $mode_update {
bindsym m exec --no-startup-id "~/.bin/my-offlineimap --feedback"; mode "default"
bindsym Escape mode "default"
bindsym Return mode "default"
}
set $mode_download "(y)outube (f)ile"
mode $mode_download {
bindsym y exec --no-startup-id $term -e "/home/joris/.bin/my-youtube-dl"; mode "default"
bindsym f exec --no-startup-id $term -e "/home/joris/.bin/my-aria2c"; mode "default"
bindsym Escape mode "default"
bindsym Return mode "default"
}
set $mode_swap "(t)ouchpad (r)esolution (m)icro"
mode $mode_swap {
bindsym t exec --no-startup-id "~/.bin/touchpad"; mode "default"
bindsym r exec --no-startup-id "~/.bin/swap-resolution"; mode "default"
bindsym m exec --no-startup-id "~/.bin/swap-micro"; mode "default"
bindsym Escape mode "default"
bindsym Return mode "default"
}
# mode "resize" {
# bindsym $left resize shrink width 2 px or 2 ppt
# bindsym $down resize grow height 2 px or 2 ppt
# bindsym $up resize shrink height 2 px or 2 ppt
# bindsym $right resize grow width 2 px or 2 ppt
#
# bindsym Shift+$left resize shrink width 10 px or 10 ppt
# bindsym Shift+$down resize grow height 10 px or 10 ppt
# bindsym Shift+$up resize shrink height 10 px or 10 ppt
# bindsym Shift+$right resize grow width 10 px or 10 ppt
#
# bindsym Escape mode "default"
# bindsym Return mode "default"
# }
mode "light" {
bindsym dollar exec --no-startup-id "xbacklight -set 0"; mode "default"
bindsym 1 exec --no-startup-id "xbacklight -set 10"; mode "default"
bindsym 2 exec --no-startup-id "xbacklight -set 20"; mode "default"
bindsym 3 exec --no-startup-id "xbacklight -set 30"; mode "default"
bindsym 4 exec --no-startup-id "xbacklight -set 40"; mode "default"
bindsym 5 exec --no-startup-id "xbacklight -set 50"; mode "default"
bindsym 6 exec --no-startup-id "xbacklight -set 60"; mode "default"
bindsym 7 exec --no-startup-id "xbacklight -set 70"; mode "default"
bindsym 8 exec --no-startup-id "xbacklight -set 80"; mode "default"
bindsym 9 exec --no-startup-id "xbacklight -set 90"; mode "default"
bindsym 0 exec --no-startup-id "xbacklight -set 100"; mode "default"
bindsym Escape mode "default"
bindsym Return mode "default"
}
# Player
set $mode_player "(t)oggle (p)rev (n)ext"
mode $mode_player {
bindsym t exec --no-startup-id "mpc toggle"; mode "default"
bindsym p exec --no-startup-id "mpc prev"; mode "default"
bindsym n exec --no-startup-id "mpc next"; mode "default"
bindsym Escape mode "default"
bindsym Return mode "default"
}
# System
set $mode_system "(l)ock (e)xit (s)uspend (r)eboot (p)oweroff"
mode $mode_system {
bindsym l exec --no-startup-id xset s activate, mode "default"
bindsym e exec --no-startup-id i3-msg exit, mode "default"
bindsym s exec --no-startup-id systemctl suspend, mode "default"
bindsym r exec --no-startup-id systemctl reboot, mode "default"
bindsym p exec --no-startup-id systemctl poweroff -i, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
# Reload
bindsym $mod+z reload
bindsym $mod+Shift+z restart
This diff is collapsed.
db_file "~/.config/mpd/database"
log_file "~/.config/mpd/log"
music_directory "~/music"
playlist_directory "~/.config/mpd/playlists"
pid_file "~/.config/mpd/pid"
state_file "~/.config/mpd/state"
sticker_file "~/.config/mpd/sticker.sql"
audio_output {
type "pulse"
name "Local MPD"
server "127.0.0.1"
}
" [HJKL] -> {CTSR}
" {cr} = « gauche / droite »
noremap c h
noremap r l
" {ts} = « haut / bas »
noremap t j
noremap s k
" {CR} = « haut / bas de l'écran »
noremap C H
noremap R L
" {TS} = « joindre / aide »
noremap T J
noremap S K
" Corollaire : repli suivant / précédent
noremap zs zj
noremap zt zk
" {HJKL} <- [CTSR]
" {J} = « Jusqu'à » (j = suivant, J = précédant)
noremap j t
noremap J T
" {L} = « Change » (h = bloc, H = jusqu'à la fin de ligne)
noremap l c
noremap L C
" {H} = « Remplace » (l = caractère, L = texte)
noremap h r
noremap H R
" {K} = « Substitue » (k = caractère, K = ligne)
noremap k s
noremap K S
" Corollaire : correction orthographique
noremap ]k ]s
noremap [k [s
" Désambiguation de {g}
" ligne écran précédente / suivante (à l'intérieur d'une phrase)
noremap gs gk
noremap gt gj
" onglet précédant / suivant
noremap gb gT
noremap gé gt
" optionnel : {gB} / {gÉ} pour aller au premier / dernier onglet
noremap gB :exe "silent! tabfirst"<CR>
noremap gÉ :exe "silent! tablast"<CR>
" optionnel : {g"} pour aller au début de la ligne écran
noremap g" g0
" Chiffres en accès direct
noremap " 1
noremap 1 "
noremap « 2
noremap 2 <
noremap » 3
noremap 3 >
noremap ( 4
noremap 4 (
noremap ) 5
noremap 5 )
noremap @ 6
noremap 6 @
noremap + 7
noremap 7 +
noremap - 8
noremap 8 -
noremap / 9
noremap 9 /
noremap * 0
noremap 0 *
" Page movements
noremap é <C-b>
noremap è <C-f>
noremap É <C-u>
noremap È <C-d>
" Remap char search in line
noremap , ;
noremap ; ,
" NERDTree
let NERDTreeMapOpenInTab='h'
let NERDTreeMapOpenInTabSilent='H'
let NERDTreeMapOpenVSplit='<C-v>'
let NERDTreeMapJumpFirstChild='S'
let NERDTreeMapJumpLastChild='T'
let NERDTreeMapJumpNextSibling='<C-T>'
let NERDTreeMapJumpPrevSibling='<C-S>'
"let NERDTreeMapChdir='L'
"let NERDTreeMapRefresh='j'
"let NERDTreeMapRefreshRoot='J'
" Plugins
" -------
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-abolish'
Plug 'tpope/vim-eunuch'
Plug 'junegunn/fzf' | Plug 'junegunn/fzf.vim'
Plug 'ldong/vim_loremipsum'
Plug 'tomtom/tcomment_vim'
Plug 'bling/vim-airline'