dot

packages and services management
Log | Files | Refs | README

commit 1eb08e562298acfdde6e4085f1a55d3601402e73
parent 428d4e8cc861c576f5ad7313033ae0ee127e25d9
Author: josuah <mail@josuah.net>
Date:   Sat, 17 Dec 2016 09:40:41 +0000

Udpated config.h

Diffstat:
A.config/abduco/config.h | 22++++++++++++++++++++++
M.config/dvtm/config.h | 32+++++++++++++++++---------------
A.local/bin/git-prompt | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
M.local/bin/status | 70+---------------------------------------------------------------------
M.profile | 4++--
5 files changed, 93 insertions(+), 86 deletions(-)

diff --git a/.config/abduco/config.h b/.config/abduco/config.h @@ -0,0 +1,22 @@ +/* default command to execute if non is given and $ABDUCO_CMD is unset */ +#define ABDUCO_CMD "dvtm-status" + +/* default detach key, can be overriden at run time using -e option */ +static char KEY_DETACH = CTRL('\\'); + +/* redraw key to send a SIGWINCH signal to underlying process + * (set to 0 to disable the redraw key) */ +static char KEY_REDRAW = CTRL('L'); + +/* Where to place the "abduco" directory storing all session socket files. + * The first directory to succeed is used. */ +static struct Dir { + char *path; /* fixed (absolute) path to a directory */ + char *env; /* environment variable to use if (set) */ + bool personal; /* if false a user owned sub directory will be created */ +} socket_dirs[] = { + { .env = "ABDUCO_SOCKET_DIR", false }, + { .env = "HOME", true }, + { .env = "TMPDIR", false }, + { .path = "/tmp", false }, +}; diff --git a/.config/dvtm/config.h b/.config/dvtm/config.h @@ -80,13 +80,14 @@ const char tags[][8] = { "|", "||", "|||" }; /* by default the first layout entry is used */ static Layout layouts[] = { - { " │├┤f ", tile }, - { " ├┼┤g ", grid }, - { " ├┬┤b ", bstack }, - { " ├┴┤u ", tstack }, - { " ├─┤n ", vstack }, - { " │@│o ", fibonacci }, - { " │ │m ", fullscreen }, + { " │├┤f ", tile }, + { " ├┼┤g ", grid }, + { " ├┬┤b ", bstack }, + { " ├┴┤u ", tstack }, + { " ├─┤n ", vstack }, + { " │@│o ", spiral }, + { " │&│w ", dwindle }, + { " │ │m ", fullscreen }, }; #define MOD CTRL(' ') @@ -94,7 +95,7 @@ static Layout layouts[] = { { { MOD, 'v', KEY, }, { view, { tags[TAG] } } }, \ { { MOD, 't', KEY, }, { tag, { tags[TAG] } } }, \ { { MOD, 'V', KEY, }, { toggleview, { tags[TAG] } } }, \ - { { MOD, 'T', KEY, }, { toggletag, { tags[TAG] } } }, + { { MOD, 'T', KEY, }, { toggletag, { tags[TAG] } } }, /* you can specifiy at most 3 arguments */ static KeyBinding bindings[] = { @@ -105,13 +106,14 @@ static KeyBinding bindings[] = { { { MOD, 'J', }, { focusnextnm, { NULL } } }, { { MOD, 'K', }, { focusprevnm, { NULL } } }, { { MOD, 'k', }, { focusprev, { NULL } } }, - { { MOD, 'f', }, { setlayout, { " │├┤f " } } }, - { { MOD, 'g', }, { setlayout, { " ├┼┤g " } } }, - { { MOD, 'b', }, { setlayout, { " ├┬┤b " } } }, - { { MOD, 'u', }, { setlayout, { " ├┴┤u " } } }, - { { MOD, 'n', }, { setlayout, { " ├─┤n " } } }, - { { MOD, 'o', }, { setlayout, { " │@│o " } } }, - { { MOD, 'm', }, { setlayout, { " │ │m " } } }, + { { MOD, 'f', }, { setlayout, { " │├┤f " } } }, + { { MOD, 'g', }, { setlayout, { " ├┼┤g " } } }, + { { MOD, 'b', }, { setlayout, { " ├┬┤b " } } }, + { { MOD, 'u', }, { setlayout, { " ├┴┤u " } } }, + { { MOD, 'n', }, { setlayout, { " ├─┤n " } } }, + { { MOD, 'o', }, { setlayout, { " │@│o " } } }, + { { MOD, 'w', }, { setlayout, { " │&│w " } } }, + { { MOD, 'm', }, { setlayout, { " │ │m " } } }, { { MOD, ' ', }, { setlayout, { NULL } } }, { { MOD, 'i', }, { incnmaster, { "+1" } } }, { { MOD, 'd', }, { incnmaster, { "-1" } } }, diff --git a/.local/bin/git-prompt b/.local/bin/git-prompt @@ -0,0 +1,51 @@ +cd "$1" + +git rev-parse 2> /dev/null || return 0 + +git status --porcelain -b | awk ' +/^## / { + branch = $0; + sub(/^## /, "", branch); + sub(/\.\.\..*/, "", branch); + + if ($0 ~ /ahead /) { + ahead = $0; + sub(/.*ahead /, "", ahead); + sub(/\].*|, .*/, "", ahead); + } + + if ($0 ~ /behind /) { + behind = $0; + sub(/.*behind /, "", behind); + sub(/\].*|, .*/, "", behind); + } + + m = 1; +} + +m == 0 && /^\?\? / { untracked++; m = 1; } +m == 0 && /^U. / { conflicts++; m = 1; } +m == 0 && /^.U / { conflicts++; m = 1; } +m == 0 && /^DD / { conflicts++; m = 1; } +m == 0 && /^AA / { conflicts++; m = 1; } +m == 0 && /^.M / { changed++; } +m == 0 && /^.D / { changed++; } +m == 0 && /^[^ ]. / { staged++; } +m == 1 { m = 0; } + +END { + printf("\033[1m%s\033[0m", branch); + + if (untracked + conflicts + changed + staged + behind + ahead \ + == 0) { + printf " \033[32mok\033[0m"; + } else { + if (untracked) printf " \033[33m?\033[0m%d", untracked; + if (conflicts) printf " \033[31m!\033[0m%d", conflicts; + if (changed ) printf " \033[32m+\033[0m%d", changed ; + if (staged ) printf " \033[34m*\033[0m%d", staged ; + if (behind ) printf " \033[31m↓\033[0m%d", behind ; + if (ahead ) printf " \033[36m↑\033[0m%d", ahead ; + } +}' + diff --git a/.local/bin/status b/.local/bin/status @@ -12,66 +12,6 @@ STOP=' ' # -# Current path, with "$HOME" replaced by '~' followed by git status -# -status_path() -{ - 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 ' - /^## / { - branch = $0; - sub(/^## /, "", branch); - sub(/\.\.\..*/, "", branch); - - if ($0 ~ /ahead /) { - ahead = $0; - sub(/.*ahead /, "", ahead); - sub(/\].*|, .*/, "", ahead); - } - - if ($0 ~ /behind /) { - behind = $0; - sub(/.*behind /, "", behind); - sub(/\].*|, .*/, "", behind); - } - - m = 1; - } - - m == 0 && /^\?\? / { untracked++; m = 1; } - m == 0 && /^U. / { conflicts++; m = 1; } - m == 0 && /^.U / { conflicts++; m = 1; } - m == 0 && /^DD / { conflicts++; m = 1; } - m == 0 && /^AA / { conflicts++; m = 1; } - m == 0 && /^.M / { changed++; } - m == 0 && /^.D / { changed++; } - m == 0 && /^[^ ]. / { staged++; } - m == 1 { m = 0; } - - END { - printf(" \033[1m%s\033[0m", branch); - - if (untracked + conflicts + changed + staged + behind + ahead \ - == 0) { - printf " \033[32mok\033[0m"; - } else { - if (untracked) printf " \033[33m?\033[0m%d", untracked; - if (conflicts) printf " \033[31m!\033[0m%d", conflicts; - if (changed ) printf " \033[32m+\033[0m%d", changed ; - if (staged ) printf " \033[34m*\033[0m%d", staged ; - if (behind ) printf " \033[31m↓\033[0m%d", behind ; - if (ahead ) printf " \033[36m↑\033[0m%d", ahead ; - } - }' -} - - -# # Maildir format, just file count in "$MAIL/new" # status_mail() @@ -137,15 +77,7 @@ main() printf "$START" while [ "$#" -gt 0 ] do - case "$1" in - path ) - segment="$(status_"$1" "$2")" - shift - ;; - * ) - segment="$(status_"$1")" - ;; - esac + segment="$(status_"$1")" printf %s "$segment" diff --git a/.profile b/.profile @@ -41,7 +41,7 @@ export XDG_RUNTIME_DIR="$HOME/.cache" export PS1='$( [ $? -eq 0 ] && color=2 || color=1 - # cursor shape + # cursor shape it TTY printf "\033[?6c" cd "$1" @@ -51,7 +51,7 @@ export PS1='$( # current path with "$HOME" replaced with '~' [ -z "${PWD##$HOME*}" ] && printf ~%s "${PWD#$HOME}" || printf %s "$PWD" - # git branch + # git branch and status if git rev-parse 2> /dev/null then git -c color.status=always status -sb