Merge branch 'master' of frogit:geoffrey/dotfiles

This commit is contained in:
Geoffrey Frogeye 2017-09-20 11:49:07 +02:00
commit 818b0fe922
20 changed files with 373 additions and 21 deletions

8
bashrc
View file

@ -4,10 +4,6 @@
# ENVIRONMENT VARIABLES
# Region preferences
export LANG=fr_FR.utf8
export TZ=/usr/share/zoneinfo/Europe/Paris
# Favourite commands
export PAGER=less
export EDITOR=vim
@ -19,6 +15,9 @@ export PATH="/usr/lib/ccache/bin/:$PATH"
if [ -d $HOME/.gem/ruby/2.4.0/bin ]; then
export PATH="$HOME/.gem/ruby/2.4.0/bin/:$PATH"
fi
if [ -d /data/data/com.termux/ ]; then
export PATH="$HOME/.termux/scripts:$HOME/.termux/bin:$PATH"
fi
#export PATH="$(echo "$PATH" | sed 's|:|\n|g' | sort | uniq | tr '\n' ':' | sed 's|:$||')"
export JAVA_FONTS=/usr/share/fonts/TTF
export ANDROID_HOME=/opt/android-sdk
@ -28,6 +27,7 @@ export XDG_CONFIG_HOME=$HOME/.config
export ARDUINO=/usr/share/arduino
export ARDUINO_DIR=$ARDUINO
export ARDMK_VENDOR=archlinux-arduino
export PYTHONSTARTUP=$HOME/.config/pythonstartup.py
# ALIASES

View file

@ -46,25 +46,22 @@ bindsym $mod+dollar exec --no-startup-id ~/.config/i3/sshmenu root
# start program launcher
bindsym $mod+d exec --no-startup-id ~/.config/i3/dmenu_run
# Update var innformations
set $up_bar killall -USR1 i3status
# Start Applications
bindsym $mod+Return exec xterm
bindsym $mod+p exec thunar
bindsym $mod+m exec qutebrowser --override-restore --backend=webengine
# Volume control
#bindsym XF86AudioRaiseVolume exec amixer -q set Master 5+ unmute; exec $up_bar
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 +5%; exec $up_bar
#bindsym XF86AudioLowerVolume exec amixer -q set Master 5- unmute; exec $up_bar
bindsym XF86AudioLowerVolume exec pactl set-sink-volume 0 -5%; exec $up_bar
bindsym XF86AudioMute exec amixer -q set Master toggle; exec $up_bar
bindsym XF86AudioRaiseVolume exec pactl set-sink-mute @DEFAULT_SINK@ false; exec pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym XF86AudioLowerVolume exec pactl set-sink-mute @DEFAULT_SINK@ false; exec pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ true
bindsym $mod+F7 exec pactl suspend-sink @DEFAULT_SINK@ 1; exec pactl suspend-sink @DEFAULT_SINK@ 0
# Re-synchronize bluetooth headset
bindsym $mod+F8 exec mpc prev
bindsym $mod+F9 exec mpc toggle
bindsym $mod+F10 exec mpc next
bindsym $mod+F11 exec xterm -e 'alsamixer'
bindsym $mod+F12 exec xterm -e 'alsamixer'
bindsym $mod+F11 exec xterm -e 'pacmixer'
bindsym $mod+F12 exec xterm -e 'pacmixer'
#Brightness control
bindsym XF86MonBrightnessDown exec xbacklight -dec 20

View file

@ -75,7 +75,8 @@ enable-ipc = true
[bar/primary]
inherit = bar/base
modules-right = cpu memory temperature eth wlan xbacklight volume battery date
modules-center = mpd
modules-right = eth wlan xbacklight volume battery date
tray-position = right
tray-padding = 2
@ -83,8 +84,7 @@ tray-transparent = false
[bar/secondary]
inherit = bar/base
modules-center = mpd
modules-right = ethMore wlanMore filesystem xbacklight volume date
modules-right = cpu memory temperature ethMore wlanMore filesystem xbacklight volume date
[module/filesystem]

3
config/pythonstartup.py Normal file
View file

@ -0,0 +1,3 @@
import rlcompleter
import readline
readline.parse_and_bind("tab: complete")

View file

@ -831,7 +831,7 @@ geolocation = ask
# Allow websites to show notifications.
# Valid values: true, false, ask
# Default: ask
notifications = ask
notifications = true
# media-capture (BoolAsk):
# Allow websites to record audio/video.

View file

View file

@ -24,6 +24,10 @@ var argv = yargs
.alias('t', 'title')
.default('t', 'Sans titre')
.describe('b', 'Border')
.alias('b', 'border')
.default('b', '2cm')
.demandOption(['o'])
.argv;
@ -33,7 +37,7 @@ options = {
"base": "file://" + process.cwd() + '/',
"format": "A4",
"orientation": "portrait",
"border": "2cm",
"border": argv.border,
"footer": {
"height": "10mm",

View file

@ -176,9 +176,13 @@ fi
inst moreutils screen ncdu lsof htop proxytunnel pv curl wget sshfs netcat mosh bash-completion rsync
if [ $ARCH == 1 ]; then
inst gopass
altInst tldr-bash-git
else
inst pass
wget -qO ~/.bin/ https://raw.githubusercontent.com/pepa65/tldr-bash-client/master/tldr
chmod +x ~/.bin/tldr
fi
tldr -u
if [[ $ARCH == 1 && $ADMIN == 1 ]]; then
inst pkgfile
sudo systemctl enable pkgfile-update.timer
@ -307,7 +311,7 @@ if [ $EXTRA == 1 ]; then
inst cmake clang llvm npm
# Extra CLI
inst sl ffmpeg youtube-dl optipng
inst sl ffmpeg youtube-dl optipng syncthing
if [ $ARCH == 1 ]; then
inst jq
@ -316,10 +320,11 @@ if [ $EXTRA == 1 ]; then
# Extra GUI
if [ $GUI == 1 ]; then
inst vlc gimp mpd vimpc alsa-utils
inst vlc gimp mpd vimpc
if [ $ARCH == 1 ]; then
inst simplescreenrecorder
altInst pacmixer
fi
fi

2
termux/bin/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!.gitignore

2
termux/boot/autosvc Executable file
View file

@ -0,0 +1,2 @@
#!/data/data/com.termux/files/usr/bin/bash
autosvc

2
termux/boot/symlink Executable file
View file

@ -0,0 +1,2 @@
#!/data/data/com.termux/files/usr/bin/bash
echo "ln -s /data/data/com.termux/files/usr /usr" | tsu

29
termux/colors.properties Normal file
View file

@ -0,0 +1,29 @@
# https://github.com/chriskempson/base16-xresources/blob/master/base16-monokai.dark.256.xresources
foreground= #f8f8f2
background= #272822
cursor= #f8f8f2
color0= #272822
color1= #f92672
color2= #a6e22e
color3= #f4bf75
color4= #66d9ef
color5= #ae81ff
color6= #a1efe4
color7= #f8f8f2
color8= #75715e
color9= #f92672
color10= #a6e22e
color11= #f4bf75
color12= #66d9ef
color13= #ae81ff
color14= #a1efe4
color15= #f9f8f5
color16= #fd971f
color17= #ae81ff
color18= #383830
color19= #49483e
color20= #a59f85
color21= #f5f4f1

BIN
termux/font.ttf Normal file

Binary file not shown.

39
termux/scripts/autosvc Executable file
View file

@ -0,0 +1,39 @@
#!/data/data/com.termux/files/usr/bin/bash
#
# Start services based on phone state
#
function act() {
# Services that should be always on
service sshd start
service autosvc start
# Services that should be on depending on battery
bat="$(termux-battery-status | jq -r '.status')"
if [[ "$bat" == "FULL" || "$bat" == "CHARGING" ]]
then
service syncthing start
else
service syncthing stop
fi
}
if [ "$1" == "-d" ]
then
# Daemon mode
while true
do
echo 29
act &>> $HOME/.local/log/autosvc.log
echo 31
sleep 60
done
else
# One shot mode
# TODO Soft-code the log destination & the program arguments
act
fi

22
termux/scripts/service Executable file
View file

@ -0,0 +1,22 @@
#!/data/data/com.termux/files/usr/bin/bash
#
# Run & stop Termux services
#
if [ $# -lt 1 ]
then
echo "Expected a service name as first argument."
exit 1
fi
service="$1"
file="$HOME/.termux/services/$1"
if [ -f "$file" ]
then
shift
$file "$@"
else
echo "Service not found: $1"
fi

11
termux/scripts/sudo Executable file
View file

@ -0,0 +1,11 @@
#!/data/data/com.termux/files/usr/bin/bash
#
# Substitution for sudo
#
if [ "$(whoami)" != 'root' ]
then
echo "$@" | tsu
else
"$@"
fi

59
termux/services/autosvc Executable file
View file

@ -0,0 +1,59 @@
#!/data/data/com.termux/files/usr/bin/bash
#
# Charge services based on phone state
#
PIDFILE="$HOME/.local/run/autosvc.pid"
LOGFILE="$HOME/.local/log/autosvc.log"
start() {
printf "Starting autosvc: "
start-stop-daemon -p "$PIDFILE" -x /data/data/com.termux/files/usr/bin/bash -S -b -m -- "$HOME/.termux/scripts/autosvc" -d -l "$LOGFILE"
echo "OK"
}
stop() {
printf "Stopping autosvc: "
start-stop-daemon -p "$PIDFILE" -x /data/data/com.termux/files/usr/bin/bash -K
echo "OK"
}
status() {
printf "autosvc: "
PID="$(cat "$PIDFILE" 2> /dev/null)"
if [[ -n "$PID" && -d "/proc/$PID" ]]
then
echo "running"
else
echo "stopped"
fi
}
log() {
tail "$@" "$LOGFILE"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
status)
status
;;
log)
shift
log "$@"
;;
*)
echo "Usage: $0 {start|stop|restart|status|log}"
exit 1
esac
exit $?

59
termux/services/crond Executable file
View file

@ -0,0 +1,59 @@
#!/data/data/com.termux/files/usr/bin/bash
#
# Start crond
#
PIDFILE="$HOME/.local/run/crond.pid"
LOGFILE="$HOME/.local/log/crond.log"
start() {
printf "Starting crond: "
start-stop-daemon -p "$PIDFILE" -x crond -S -b -m -- -f -L "$LOGFILE"
echo "OK"
}
stop() {
printf "Stopping crond: "
start-stop-daemon -p "$PIDFILE" -x crond -K
echo "OK"
}
status() {
printf "crond: "
PID="$(cat "$PIDFILE" 2> /dev/null)"
if [[ -n "$PID" && -d "/proc/$PID" ]]
then
echo "running"
else
echo "stopped"
fi
}
log() {
tail "$@" "$LOGFILE"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
status)
status
;;
log)
shift
log "$@"
;;
*)
echo "Usage: $0 {start|stop|restart|status|log}"
exit 1
esac
exit $?

59
termux/services/sshd Executable file
View file

@ -0,0 +1,59 @@
#!/data/data/com.termux/files/usr/bin/bash
#
# Start SSH server daemon
#
PIDFILE="/data/data/com.termux/files/usr/var/run/sshd.pid"
LOGFILE="$HOME/.local/log/sshd.log"
start() {
printf "Starting SSHD: "
start-stop-daemon -p "$PIDFILE" -x sshd -S -- -E "$LOGFILE"
echo "OK"
}
stop() {
printf "Stopping SSHD: "
start-stop-daemon -p "$PIDFILE" -x sshd -K
echo "OK"
}
status() {
printf "SSHD: "
PID="$(cat "$PIDFILE" 2> /dev/null)"
if [[ -n "$PID" && -d "/proc/$PID" ]]
then
echo "running"
else
echo "stopped"
fi
}
log() {
tail "$@" "$LOGFILE"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
status)
status
;;
log)
shift
log "$@"
;;
*)
echo "Usage: $0 {start|stop|restart|status|log}"
exit 1
esac
exit $?

59
termux/services/syncthing Executable file
View file

@ -0,0 +1,59 @@
#!/data/data/com.termux/files/usr/bin/bash
#
# Start Syncthing synchronization service
#
PIDFILE="$HOME/.local/run/syncthing.pid"
LOGFILE="$HOME/.local/log/syncthing.log"
start() {
printf "Starting Syncthing: "
sudo start-stop-daemon -p "$PIDFILE" -x syncthing -S -b -N 5 -m -- -logfile="$LOGFILE"
echo "OK"
}
stop() {
printf "Stopping Syncthing: "
sudo start-stop-daemon -p "$PIDFILE" -x syncthing -K
echo "OK"
}
status() {
printf "Syncthing: "
PID="$(sudo cat "$PIDFILE" 2> /dev/null)"
if [[ -n "$PID" && -d "/proc/$PID" ]]
then
echo "running"
else
echo "stopped"
fi
}
log() {
sudo tail "$@" "$LOGFILE"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
status)
status
;;
log)
shift
log "$@"
;;
*)
echo "Usage: $0 {start|stop|restart|status|log}"
exit 1
esac
exit $?