diff --git a/bashrc b/bashrc index 1abcdeb..43b9d7c 100644 --- a/bashrc +++ b/bashrc @@ -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 diff --git a/config/i3/config b/config/i3/config index 00565de..281f907 100644 --- a/config/i3/config +++ b/config/i3/config @@ -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 diff --git a/config/polybar/config b/config/polybar/config index 6758e66..9ffb31a 100644 --- a/config/polybar/config +++ b/config/polybar/config @@ -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] diff --git a/config/pythonstartup.py b/config/pythonstartup.py new file mode 100644 index 0000000..cc23251 --- /dev/null +++ b/config/pythonstartup.py @@ -0,0 +1,3 @@ +import rlcompleter +import readline +readline.parse_and_bind("tab: complete") diff --git a/config/qutebrowser/qutebrowser.conf b/config/qutebrowser/qutebrowser.conf index 56a6c2f..3300234 100644 --- a/config/qutebrowser/qutebrowser.conf +++ b/config/qutebrowser/qutebrowser.conf @@ -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. diff --git a/.dmrc b/dmrc similarity index 100% rename from .dmrc rename to dmrc diff --git a/scripts/html2pdf b/scripts/html2pdf index 8095bd4..9a82d29 100755 --- a/scripts/html2pdf +++ b/scripts/html2pdf @@ -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", diff --git a/scripts/install-prefs b/scripts/install-prefs index b102d2d..42f7043 100755 --- a/scripts/install-prefs +++ b/scripts/install-prefs @@ -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 diff --git a/termux/bin/.gitignore b/termux/bin/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/termux/bin/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/termux/boot/autosvc b/termux/boot/autosvc new file mode 100755 index 0000000..498c6ea --- /dev/null +++ b/termux/boot/autosvc @@ -0,0 +1,2 @@ +#!/data/data/com.termux/files/usr/bin/bash +autosvc diff --git a/termux/boot/symlink b/termux/boot/symlink new file mode 100755 index 0000000..224ed55 --- /dev/null +++ b/termux/boot/symlink @@ -0,0 +1,2 @@ +#!/data/data/com.termux/files/usr/bin/bash +echo "ln -s /data/data/com.termux/files/usr /usr" | tsu diff --git a/termux/colors.properties b/termux/colors.properties new file mode 100644 index 0000000..044848a --- /dev/null +++ b/termux/colors.properties @@ -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 diff --git a/termux/font.ttf b/termux/font.ttf new file mode 100644 index 0000000..d80f390 Binary files /dev/null and b/termux/font.ttf differ diff --git a/termux/scripts/autosvc b/termux/scripts/autosvc new file mode 100755 index 0000000..ec08e05 --- /dev/null +++ b/termux/scripts/autosvc @@ -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 + diff --git a/termux/scripts/service b/termux/scripts/service new file mode 100755 index 0000000..300cdfa --- /dev/null +++ b/termux/scripts/service @@ -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 + diff --git a/termux/scripts/sudo b/termux/scripts/sudo new file mode 100755 index 0000000..d3f49da --- /dev/null +++ b/termux/scripts/sudo @@ -0,0 +1,11 @@ +#!/data/data/com.termux/files/usr/bin/bash +# +# Substitution for sudo +# + +if [ "$(whoami)" != 'root' ] +then + echo "$@" | tsu +else + "$@" +fi diff --git a/termux/services/autosvc b/termux/services/autosvc new file mode 100755 index 0000000..52d22a5 --- /dev/null +++ b/termux/services/autosvc @@ -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 $? diff --git a/termux/services/crond b/termux/services/crond new file mode 100755 index 0000000..0582592 --- /dev/null +++ b/termux/services/crond @@ -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 $? diff --git a/termux/services/sshd b/termux/services/sshd new file mode 100755 index 0000000..030d99f --- /dev/null +++ b/termux/services/sshd @@ -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 $? diff --git a/termux/services/syncthing b/termux/services/syncthing new file mode 100755 index 0000000..70bbaca --- /dev/null +++ b/termux/services/syncthing @@ -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 $?