dot

packages and services management
Log | Files | Refs | README

commit 8fb40a3477110581fd97c7accafcbbd56cdf0cf9
parent 1aba827b92aba123ba4f1a3f5f49342dac35150f
Author: josuah <mail@josuah.net>
Date:   Tue, 13 Dec 2016 17:58:16 +0000

Switched from tmux to dvtm.

Diffstat:
M.config/dvtm/dvtm-status | 11++++-------
D.config/shell/alias | 15---------------
D.config/shell/exports | 29-----------------------------
D.config/shell/functions | 186-------------------------------------------------------------------------------
M.local/bin/status | 33++++++++++++---------------------
M.local/share/build/dvtm | 13-------------
D.local/share/build/fbida | 3---
M.local/share/build/iomenu | 2+-
A.local/share/build/less | 3+++
M.profile | 280++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
R.vim/vimrc -> .vimrc | 0
11 files changed, 299 insertions(+), 276 deletions(-)

diff --git a/.config/dvtm/dvtm-status b/.config/dvtm/dvtm-status @@ -1,20 +1,17 @@ -#!/bin/sh - export STATUS_FIFO="/tmp/dvtm-status.$$" export CMD_FIFO="/tmp/dvtm-cmd.$$" [ -p "$STATUS_FIFO" ] || mkfifo -m 600 "$STATUS_FIFO" || exit 1 [ -p "$CMD_FIFO" ] || mkfifo -m 600 "$CMD_FIFO" || exit 1 -while true +while printf '%s\n' "$(status)" do - status - printf '\n' - sleep 10 + sleep 5 done > "$STATUS_FIFO" & - STATUS_PID=$! + dvtm -s "$STATUS_FIFO" -c "$CMD_FIFO" "$@" 2> /dev/null + kill $STATUS_PID wait $STATUS_PID 2> /dev/null rm -f "$STATUS_FIFO" "$CMD_FIFO" diff --git a/.config/shell/alias b/.config/shell/alias @@ -1,15 +0,0 @@ -alias l='ls -lh --color' -alias la='ls -Alh --color' -alias a='io-abduco' -alias g='io-grep' -alias v='io-abduco $PAGER +' -alias m='io-man' -alias t='tmux attach &>/dev/null || tmux new' -alias f='find . -type f ! -path "*/.git/*" | cut -c 3- | sort | iomenu' -alias d='find . -type d ! -path "*/.git/*" | cut -c 3- | sort | iomenu' -alias c='cd "$(d)"' -alias .p='. ~/.profile' -alias cl='printf "\033[H\033[2J"' -alias bh='busybox --help' -alias myip='curl icanhazip.com' -alias lines='find . -name "*.[ch]" | xargs wc -l' diff --git a/.config/shell/exports b/.config/shell/exports @@ -1,29 +0,0 @@ -export ENV="$HOME/.profile" - -export NAME='Josuah Demangeon' -export EMAIL='mail@josuah.net' -export MAIL="$HOME/Mail/INBOX" - -export EDITOR="vim" -export ALTERNATE_EDITOR="vi" -export VISUAL="$EDITOR" -export FCEDIT="$EDITOR" -export PAGER="iode" -export MANPAGER="$PAGER" - -export XDG_DATA_HOME="$HOME/.local/share" -export XDG_CONFIG_HOME="$HOME/.config" -export XDG_CACHE_HOME="$HOME/.cache" -export XDG_RUNTIME_DIR="$HOME/.cache" - -export PS1='$( - [ $? -eq 0 ] && color=2 || color=1 - - # cursor shape - printf "\033[?6c" - - # status - printf "\n\033[1;30m>\033[0;3%sm>\033[1m>\033[m " "$color" -)' -export PS2=' > ' -export PS3=' > ' diff --git a/.config/shell/functions b/.config/shell/functions @@ -1,186 +0,0 @@ -# Shell functions for interactive use - - -matrix() -{ - setfont ~/.local/share/consolefonts/terminus-16b.psf - io-tty-theme matrix - cmatrix -abu 3 -} - - -predator() -{ - setfont ~/.local/share/consolefonts/cybercafe.fnt - io-tty-theme exo -} - - -tron() -{ - setfont ~/.local/share/consolefonts/lode-16.psf - io-tty-theme gotham - printf 'Starting the grid' - sleep 1; printf .; sleep 1; printf .; sleep 1; printf .; - sleep 3; pipes -p 2 -f 40 -} - - -alien() -{ - setfont ~/.local/share/consolefonts/vector-16.psf - io-tty-theme alien -} - - -starwars() -{ - setfont ~/.local/share/consolefonts/vector-16.psf - io-tty-theme coal - printf "\033[40CMay the force be with you" - sleep 2 - lightsaber -} - - -color() -{ - for i in 1 2 3 4 5 6 7 - do - printf ' \033[3%sm███\033[1m███\033[0m' $i - done - printf '\n' -} - - -# -# Build most projects without installing them. -# -buildit() -{ - [ -f './autogen.sh' ] && ./autogen.sh - [ -f './configure' ] && ./configure - make -} - - -extract() -{ - case "$1" in - *.tar.bz2) tar xvjf "$1" ;; - *.tar.gz ) tar xvzf "$1" ;; - *.bz2 ) bunzip2 "$1" ;; - *.rar ) unrar x "$1" ;; - *.gz ) gunzip "$1" ;; - *.tar ) tar xvf "$1" ;; - *.tbz2 ) tar xvjf "$1" ;; - *.tgz ) tar xvzf "$1" ;; - *.zip ) unzip "$1" ;; - *.Z ) uncompress "$1" ;; - *.7z ) 7z x "$1" ;; - *.xz ) xz -d "$1" ;; - *.deb ) ar vx "$1" ;; - * ) printf 'extract: Unknown archive type\n';; - esac -} - - -weather() -{ - curl -4 "wttr.in/$1" -} - - -# -# Remove spaces and other nasty characters from $1, recursively -# -sanitize() -{ - find . -mindepth 1 | tac | while IFS= read -r p - do - mv "$p" "${p%/*}/$( - printf %s "${p##*/}" | sed 's/[^[:alnum:],._/+-]/_/g' - )" - done -} - - -# -# Transform a separator ($1) into '/': directory and subdirectory -# -split_at() -{ - ls | while read -r f - do - mkdir -p "${f%%$1*}" - mv "$f" "${f%%$1*}/${f#*$1}" - done -} - - -# -# Remove prefix from all files in current directory up to "$1" separator -# -remove_prefix() -{ - ls | while read -r f - do mv "$f" "${f#*$1}" - done -} - - -# -# Sudo, sudo, sudo, sudo, sudo, screen brightness, sudo, sudo... -# -light() -{ - printf '%s\n' "$1" | sudo tee "$( - sudo find -L /sys/class/backlight -maxdepth 2 -name brightness | - head -n 1 - )" -} - - -# -# Why sudo to mount a pendrive! -# -mnt() -{ - sudo mount -o uid=$USER -o rw "${1-/dev/sdb1}" "${2-/mnt}" -} - - -# -# Works only in TTY and with sudo, unfortunately. -# -rotate() -{ - case "$1" in - u | up ) printf 0 ;; - r | right ) printf 1 ;; - d | down ) printf 2 ;; - l | left ) printf 3 ;; - esac | sudo tee /sys/class/graphics/fbcon/rotate_all > /dev/null -} - - -# -# FrameBuffer Video player based on mplayer -# -fbv() -{ - local x="$(sed 's/,.*//' /sys/class/graphics/fb0/virtual_size)" - local y="$(sed 's/.*,//' /sys/class/graphics/fb0/virtual_size)" - local video="$1" - - trap "kill -9 0" INT EXIT - - mplayer -vm -vo fbdev2 "$video" -vf scale -zoom -x "$x" -y "$y" -} - - -screencast() -{ - ffmpeg -video_size 1366x768 -framerate 25 -f x11grab -i :0.0 \ - ~/${1:-screencast}.mp4 -} diff --git a/.local/bin/status b/.local/bin/status @@ -1,9 +1,9 @@ -# | | -# ,--- |-- ,--. |-- , , ,--- -# `--. | ,--| | | | `--. -# ---' ' `--` ' `--` ---' 2016-11-01 -#------------------------------------------------------------------------------- -# Plain text status line for wherever useful +# Plain text status line for wherever useful 2016-12-13 +# +# _ |_ _ |_ _ +# _\ | (_| | |_| _\ +# +#_______________________________________________________________________________ SEPARATOR=' ' @@ -12,23 +12,14 @@ STOP=' ' # -# Current path, with "$HOME" replaced by '~' +# Current path, with "$HOME" replaced by '~' followed by git status # status_path() { - local pwd="$1" - - [ -z "${pwd##$HOME*}" ] && printf ~%s "${pwd#$HOME}" || printf %s "$pwd" -} - - -# -# Current directory git status, -# -status_git() -{ cd "$1" + [ -z "${PWD##$HOME*}" ] && printf ~%s "${PWD#$HOME}" || printf %s "$PWD" + git rev-parse 2> /dev/null || return 0 git status --porcelain -b | awk ' @@ -63,11 +54,11 @@ status_git() m == 1 { m = 0; } END { - printf("\033[1m%s\033[0m", branch); + printf(" \033[1m%s\033[0m", branch); if (untracked + conflicts + changed + staged + behind + ahead \ == 0) { - printf " \033[32mok\033[0m"; + printf " \033[32mok\033[0m"; } else { if (untracked) printf " \033[33m?\033[0m%d", untracked; if (conflicts) printf " \033[31m!\033[0m%d", conflicts; @@ -147,7 +138,7 @@ main() while [ "$#" -gt 0 ] do case "$1" in - path | git ) + path ) segment="$(status_"$1" "$2")" shift ;; diff --git a/.local/share/build/dvtm b/.local/share/build/dvtm @@ -9,19 +9,6 @@ build() cp -f "$CONFIG/$1/config.h" . cp -f "$CONFIG/$1/dvtm-status" . - printf %s "$( - while IFS='' read -r line - do - if [ -z "${line##CFLAGS * ncurses}" ] - then - printf '%s %s\n' \ - "$line" "-I$HOME/.local/include/ncurses" - else - printf '%s\n' "$line" - fi - done < config.mk - )" > config.mk - make && make PREFIX="$PREFIX" install clean tic -s dvtm.info diff --git a/.local/share/build/fbida b/.local/share/build/fbida @@ -1,3 +0,0 @@ -# Framebuffer image viewer - -tar=http://github.com/fcarlier/fbida/archive/master.tar.gz diff --git a/.local/share/build/iomenu b/.local/share/build/iomenu @@ -1,3 +1,3 @@ # Input/Output interactive menu and completion engine. -tar=http://repo.or.cz/iomenu.git/snapshot/9c3bd8101c94dbd668aa9c50226520b22c3f14ed.tar.gz +tar=http://repo.or.cz/iomenu.git/snapshot/167a2366fa33f5a76410b55339ee67f6ec52e1d0.tar.gz diff --git a/.local/share/build/less b/.local/share/build/less @@ -0,0 +1,3 @@ +# Great pager + +tar=http://ftp.gnu.org/gnu/less/less-481.tar.gz diff --git a/.profile b/.profile @@ -10,14 +10,266 @@ [ "$PROFILE" ] && return 0 || PROFILE=1 +# Environment variables +#_______________________________________________________________________________ + +export ENV="$HOME/.profile" + +export NAME='Josuah Demangeon' +export EMAIL='mail@josuah.net' +export MAIL="$HOME/Mail/INBOX" + +export EDITOR="vim" +export ALTERNATE_EDITOR="vi" +export VISUAL="$EDITOR" +export FCEDIT="$EDITOR" + +export PAGER="less" +export MANPAGER="$PAGER" + +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_RUNTIME_DIR="$HOME/.cache" + +export PS1='$( + [ $? -eq 0 ] && color=2 || color=1 + + # cursor shape + printf "\033[?6c" + + # status + printf "\n" + status path "$PWD" + printf "\n\033[1;30m>\033[0;3%sm>\033[1m>\033[m " "$color" +)' +export PS2=' > ' +export PS3=' > ' + + +# Software-specific shell alias and variables + while IFS='' read -r script do . "$script" done << EOF -$(find ~/.config/shell ! -type d) $(find ~/.config/ -name shell ! -type d) EOF + +# Aliases +#_______________________________________________________________________________ + +alias l='ls -lh --color' +alias la='ls -Alh --color' +alias a='io-abduco' +alias g='io-grep' +alias v='io-abduco $PAGER +' +alias m='io-man' +alias t='tmux attach &>/dev/null || tmux new' +alias f='find . -type f ! -path "*/.git/*" | cut -c 3- | sort | iomenu' +alias d='find . -type d ! -path "*/.git/*" | cut -c 3- | sort | iomenu' +alias c='cd "$(d)"' +alias .p='. ~/.profile' +alias cl='printf "\033[H\033[2J"' +alias bh='busybox --help' +alias myip='curl icanhazip.com' +alias lines='find . -name "*.[ch]" | xargs wc -l' + + +# Functions +#_______________________________________________________________________________ + + +matrix() +{ + setfont ~/.local/share/consolefonts/terminus-16b.psf + io-tty-theme matrix + cmatrix -abu 3 +} + + +predator() +{ + setfont ~/.local/share/consolefonts/cybercafe.fnt + io-tty-theme exo +} + + +tron() +{ + setfont ~/.local/share/consolefonts/lode-16.psf + io-tty-theme gotham + printf 'Starting the grid' + sleep 1; printf .; sleep 1; printf .; sleep 1; printf .; + sleep 3; pipes -p 2 -f 40 +} + + +alien() +{ + setfont ~/.local/share/consolefonts/vector-16.psf + io-tty-theme alien +} + + +starwars() +{ + setfont ~/.local/share/consolefonts/vector-16.psf + io-tty-theme coal + printf "\033[40CMay the force be with you" + sleep 2 + lightsaber +} + + +color() +{ + for i in 1 2 3 4 5 6 7 + do + printf ' \033[3%sm███\033[1m███\033[0m' $i + done + printf '\n' +} + + +# +# Build most projects without installing them. +# +buildit() +{ + [ -f './autogen.sh' ] && ./autogen.sh + [ -f './configure' ] && ./configure + make +} + + +extract() +{ + case "$1" in + *.tar.bz2) tar xvjf "$1" ;; + *.tar.gz ) tar xvzf "$1" ;; + *.bz2 ) bunzip2 "$1" ;; + *.rar ) unrar x "$1" ;; + *.gz ) gunzip "$1" ;; + *.tar ) tar xvf "$1" ;; + *.tbz2 ) tar xvjf "$1" ;; + *.tgz ) tar xvzf "$1" ;; + *.zip ) unzip "$1" ;; + *.Z ) uncompress "$1" ;; + *.7z ) 7z x "$1" ;; + *.xz ) xz -d "$1" ;; + *.deb ) ar vx "$1" ;; + * ) printf 'extract: Unknown archive type\n';; + esac +} + + +weather() +{ + curl -4 "wttr.in/$1" +} + + +# +# Remove spaces and other nasty characters from $1, recursively +# +sanitize() +{ + find . -mindepth 1 | tac | while IFS= read -r p + do + mv "$p" "${p%/*}/$( + printf %s "${p##*/}" | sed 's/[^[:alnum:],._/+-]/_/g' + )" + done +} + + +# +# Transform a separator ($1) into '/': directory and subdirectory +# +split_at() +{ + ls | while read -r f + do + mkdir -p "${f%%$1*}" + mv "$f" "${f%%$1*}/${f#*$1}" + done +} + + +# +# Remove prefix from all files in current directory up to "$1" separator +# +remove_prefix() +{ + ls | while read -r f + do mv "$f" "${f#*$1}" + done +} + + +# +# Sudo, sudo, sudo, sudo, sudo, screen brightness, sudo, sudo... +# +light() +{ + printf '%s\n' "$1" | sudo tee "$( + sudo find -L /sys/class/backlight -maxdepth 2 -name brightness | + head -n 1 + )" +} + + +# +# Why sudo to mount a pendrive! +# +mnt() +{ + sudo mount -o uid=$USER -o rw "${1-/dev/sdb1}" "${2-/mnt}" +} + + +# +# Works only in TTY and with sudo, unfortunately. +# +rotate() +{ + case "$1" in + u | up ) printf 0 ;; + r | right ) printf 1 ;; + d | down ) printf 2 ;; + l | left ) printf 3 ;; + esac | sudo tee /sys/class/graphics/fbcon/rotate_all > /dev/null +} + + +# +# FrameBuffer Video player based on mplayer +# +fbv() +{ + local x="$(sed 's/,.*//' /sys/class/graphics/fb0/virtual_size)" + local y="$(sed 's/.*,//' /sys/class/graphics/fb0/virtual_size)" + local video="$1" + + trap "kill -9 0" INT EXIT + + mplayer -vm -vo fbdev2 "$video" -vf scale -zoom -x "$x" -y "$y" +} + + +screencast() +{ + ffmpeg -video_size 1366x768 -framerate 25 -f x11grab -i :0.0 \ + ~/${1:-screencast}.mp4 +} + + + +# Startup +#_______________________________________________________________________________ + case "$(tty)" in /dev/tty1) io-tty-theme matrix @@ -45,7 +297,33 @@ case "$(tty)" in ;; /dev/tty6) + io-tty-theme drakula + setfont ~/.local/share/consolefonts/terminus-16n.psf + ;; +/dev/tty7) + io-tty-theme ghost + setfont ~/.local/share/consolefonts/tcvn-16.psf + ;; +/dev/tty8) + io-tty-theme gruvbox + setfont ~/.local/share/consolefonts/terminus-16b.psf + ;; +/dev/tty9) io-tty-theme solarized-dark + setfont ~/.local/share/consolefonts/t.fnt + ;; +/dev/tty10) + io-tty-theme solarized-light + setfont ~/.local/share/consolefonts/solarize-29.psf + ;; +/dev/tty11) + io-tty-theme zenburn setfont ~/.local/share/consolefonts/tamzen-16.psf ;; +/dev/tty12) + io-tty-theme monokai + setfont ~/.local/share/consolefonts/default-9.psf + ;; esac + +[ "$ABDUCO" ] || TERM='screen' ABDUCO='dvtm' abduco -A dvtm dvtm-status diff --git a/.vim/vimrc b/.vimrc