dot

packages and services management
Log | Files | Refs | README

commit 24f5e73795f0a3d681d0e75f65d43eba0507ec99
parent 574be868af22aacc782705456ef6451293da2c86
Author: josuah <mail@josuah.net>
Date:   Wed,  2 Nov 2016 13:34:07 -0400

Moved gitall to git/config and theme to xorg

Diffstat:
Mbin/status | 2+-
Abin/status-line | 95+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mgit/.config/git/config | 3+++
Mshell/.config/shell/functions | 44++++++++++++++++++--------------------------
Ashell/.config/shell/status-line | 0
Mshell/.profile | 81+------------------------------------------------------------------------------
Rshell/.config/themes/bioelectric -> xorg/.config/themes/bioelectric | 0
Rshell/.config/themes/coal -> xorg/.config/themes/coal | 0
Rshell/.config/themes/drakula -> xorg/.config/themes/drakula | 0
Rshell/.config/themes/ghost -> xorg/.config/themes/ghost | 0
Rshell/.config/themes/gotham -> xorg/.config/themes/gotham | 0
Rshell/.config/themes/gruvbox -> xorg/.config/themes/gruvbox | 0
Rshell/.config/themes/matrix -> xorg/.config/themes/matrix | 0
Rshell/.config/themes/monokai -> xorg/.config/themes/monokai | 0
Rshell/.config/themes/pink -> xorg/.config/themes/pink | 0
Rshell/.config/themes/solarized_dark -> xorg/.config/themes/solarized_dark | 0
Rshell/.config/themes/solarized_light -> xorg/.config/themes/solarized_light | 0
Rshell/.config/themes/zenburn -> xorg/.config/themes/zenburn | 0
18 files changed, 118 insertions(+), 107 deletions(-)

diff --git a/bin/status b/bin/status @@ -12,7 +12,7 @@ mail="${mail:+mail $mail}" date="$(date +'%Y-%m-%d %H:%M')" cpu="$(awk '/cpu/ { - usage = ($2 + $4) * 100 / ($2 + $4 + $5); + usage = ($2 + $4) / ($2 + $4 + $5) * 100; } END { printf("%i%%", usage); diff --git a/bin/status-line b/bin/status-line @@ -0,0 +1,95 @@ +# ,--. | | , * +# `. |-- ,--. |-- , , ,--- | , ---. ,--. +# `. | ,--| | | | `--. | | | | |--' +# `--' ' `--` ' `--` ---' '--- ' ' ' `--' 2016-11-02 +#------------------------------------------------------------------------------- +# +# Display a status line at the top of the terminal window. +# +# This can be put in the prompt to update the status line at every prompt: +# +# PS1='$(status_line)> ' + +# +# Current directory git status, +# +git_status() +{ + git rev-parse &>/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", branch); + + if (untracked + conflicts + changed + staged + behind + ahead \ + == 0) { + printf " \033[32m✔"; + } else { + if (untracked) printf " \033[34m?\033[37m%d", untracked; + if (conflicts) printf " \033[31m!\033[37m%d", conflicts; + if (changed ) printf " \033[32m+\033[37m%d", changed ; + if (staged ) printf " \033[33m*\033[37m%d", staged ; + if (behind ) printf " \033[36m↓\033[37m%d", behind ; + if (ahead ) printf " \033[36m↑\033[37m%d", ahead ; + } + + printf "\033[0m"; + }' +} + +main() +{ + local pwd="$(pwd)" + [ -z "${pwd##$HOME*}" ] && pwd="~${pwd#$HOME}" + + local status="$(status)" + + local col="$(stty size)" + col="$((${col#* } - ${#status} - 1))" + + printf '\n\033[s\033[0;0H\033[K' + + # right part + printf '\033[%sC%s\r' "$col" "$status" + + # left part + printf ' %s %s' "$pwd" "$(git_status)" + + # terminal name + printf '\033]0;%s %s\007' "$pwd" + + printf '\n\033[K\033[u\033[A' +} + +main $@ diff --git a/git/.config/git/config b/git/.config/git/config @@ -34,3 +34,6 @@ # Submodules sma = submodule add -b master --depth 1 smu = !git pull --recurse-submodules && git submodule update + + # Show all repos + all = "!find ~ -name .git -exec sh -c \"cd '{}/..'; printf '\\n'; pwd; git s\" \\;" diff --git a/shell/.config/shell/functions b/shell/.config/shell/functions @@ -26,18 +26,6 @@ color() # MANAGE PROJECTS #------------------------------------------------------------------------------- -gitall() -{ - find "$HOME" -name '.git' -type d | while read git - do - git="${git%/*}" - printf '\n\n\033[1m%s\033[0m\n' "~${git#$HOME}" - cd "$git" - git status -s - cd "$HOME" - done -} - buildit() { [ -f './autogen.sh' ] && ./autogen.sh @@ -117,20 +105,6 @@ remove_prefix() done } -# -# 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" -} - # HARDWARE #------------------------------------------------------------------------------- @@ -147,6 +121,9 @@ mnt() sudo mount -o uid=$USER -o rw "${1-/dev/sdb1}" "${2-/mnt}" } +# +# Works only in tty and with sudo, sadly. +# rotate() { case "$1" in @@ -156,3 +133,18 @@ rotate() 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" +} + diff --git a/shell/.config/shell/status-line b/shell/.config/shell/status-line diff --git a/shell/.profile b/shell/.profile @@ -21,7 +21,7 @@ $( [ "$?" -eq 0 ] && color=32 || color=31 # status - status_line + status-line printf " \033[1;30m>\033[0;%sm>\033[1m>\033[0m " "$color" )' @@ -32,85 +32,6 @@ ps1() { } -status_line() -{ - local pwd="$(pwd)" - [ -z "${pwd##$HOME*}" ] && pwd="~${pwd#$HOME}" - - local status="$(status)" - - local col="$(stty size)" - col="$((${col#* } - ${#status} - 1))" - - printf '\033[s\033[0;0H\033[K' - - # right part - printf '\033[%sC%s\r' "$col" "$status" - - # left part - printf ' %s %s' "$pwd" "$(git_status)" - - # terminal name - printf '\033]0;%s %s\007' "$pwd" - - printf '\n\033[K\033[u' -} - -git_status() -{ - git rev-parse &>/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", branch); - - if (untracked + conflicts + changed + staged + behind + ahead \ - == 0) { - printf " \033[32m✔"; - } else { - if (untracked) printf " \033[34m?\033[37m%d", untracked; - if (conflicts) printf " \033[31m!\033[37m%d", conflicts; - if (changed ) printf " \033[32m+\033[37m%d", changed ; - if (staged ) printf " \033[33m*\033[37m%d", staged ; - if (behind ) printf " \033[36m↓\033[37m%d", behind ; - if (ahead ) printf " \033[36m↑\033[37m%d", ahead ; - } - - printf "\033[0m"; - }' -} - # ALIAS #------------------------------------------------------------------------------- diff --git a/shell/.config/themes/bioelectric b/xorg/.config/themes/bioelectric diff --git a/shell/.config/themes/coal b/xorg/.config/themes/coal diff --git a/shell/.config/themes/drakula b/xorg/.config/themes/drakula diff --git a/shell/.config/themes/ghost b/xorg/.config/themes/ghost diff --git a/shell/.config/themes/gotham b/xorg/.config/themes/gotham diff --git a/shell/.config/themes/gruvbox b/xorg/.config/themes/gruvbox diff --git a/shell/.config/themes/matrix b/xorg/.config/themes/matrix diff --git a/shell/.config/themes/monokai b/xorg/.config/themes/monokai diff --git a/shell/.config/themes/pink b/xorg/.config/themes/pink diff --git a/shell/.config/themes/solarized_dark b/xorg/.config/themes/solarized_dark diff --git a/shell/.config/themes/solarized_light b/xorg/.config/themes/solarized_light diff --git a/shell/.config/themes/zenburn b/xorg/.config/themes/zenburn