dot

packages and services management
Log | Files | Refs | README

commit 2dd04b7d8b18e4148550303b55bc033d33f708b1
parent 234a7bd26c1870912d2468624dd5e0958e43af7c
Author: sshbio <josuah.demangeon@gmail.com>
Date:   Thu, 31 Mar 2016 05:07:07 +0200

Re-orgianised, much cleaner.

Diffstat:
Abin/bkm | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dbin/bookmark | 82-------------------------------------------------------------------------------
Dbin/color-table | 15---------------
Dbin/colors | 27---------------------------
Mbin/etc | 30+++++++++++-------------------
Mbin/gits | 41+++++++++++++++++------------------------
Dbin/todo | 46----------------------------------------------
Tetc/bash_profile | 0
Metc/bashrc | 152++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------
Detc/cgorc | 17-----------------
Metc/profile | 27+++++++++------------------
Detc/readline/inputrc | 26--------------------------
Msrc/dwm/config.h | 2+-
13 files changed, 231 insertions(+), 303 deletions(-)

diff --git a/bin/bkm b/bin/bkm @@ -0,0 +1,69 @@ +#!/bin/sh + +# ▌=====▌========▌============================================================== +# ▛▌▛▌▛▌▙▘▛▛▌▀▌▛▘▙▘ +# ▙▌▙▌▙▌▛▖▌▌▌█▌▌ ▛▖ - Manage bookmarks stored in $BOOKMARKS +# ============================================================================== + +BOOKMARKS="${BOOKMARKS-$HOME/.bookmarks}" +BROWSER="${BROWSER-surf}" + +bookmarks() { + n=0 + + # Search all bookmarks with #$1 tag in $BOOKMARKS + sed -n "/^#$1$/ { N; N; p }" "$BOOKMARKS" | + { + while read -r tag + do + read -r name + read -r url + + n=$(($n + 1)) + + if [ -z "$2" ] || [ "$n" -eq "$2" ] 2> /dev/null + then + printf '\033[91m%4s \033[0;1m%-30s \033[0;96m%s\033[0m\n' \ + "$n" "$name" "$url" + + elif [ "$n" -eq "$2" ] 2> /dev/null + then + $BROWSER $url 2> /dev/null & + fi + done + } +} + +if [ -z "$1" ] || [ "$1" = "-l" ] || [ "$1" = "${1#-}" ] +then + # Search all tags in $BOOKMARKS and make a _set_ of these + m=0 + for tag in $(sed -n "/^#/ s/^#\(.*\)/\1/ p" "$BOOKMARKS" | sort | uniq) + do + m=$(($m + 1 )) + + # Uppercase arg 1 and tag for case insensitive comparison + ut="$(printf '%s' "$tag" | tr [:lower:] [:upper:])" + u1="$(printf '%s' "$1" | tr [:lower:] [:upper:])" + + if [ -z "$1" ] + then + printf '\033[91m%3s \033[0;1m%s\033[0m\n' "$m" "$tag" + + elif ([ -z "$2" ] && ([ "$1" = "$m" ] || [ "$u1" = "$ut" ])) || [ "$1" = "-l" ] + then + printf '\n\033[91m%3s \033[0;1m%s\033[0m\n\n' "$m" "$tag" + bookmarks "$tag" + + elif [ "$2" -eq "$2" ] 2> /dev/null && ([ "$1" = "$m" ] || [ "$u1" = "$ut" ]) + then + bookmarks "$tag" "$2" + fi + done +else + printf '%s\n' 'Usage: + bookmark list all available tags + bookmark [tag_nb|tag_name|] list bookmarks withe specified tag + bookmark -l list all bookmarks + bookmark [tag_nb|tag_name] [0-9] open bookmark' +fi diff --git a/bin/bookmark b/bin/bookmark @@ -1,82 +0,0 @@ -#!/bin/sh - -# ▌=====▌========▌============================================================== -# ▛▌▛▌▛▌▙▘▛▛▌▀▌▛▘▙▘ -# ▙▌▙▌▙▌▛▖▌▌▌█▌▌ ▛▖ - Manage bookmarks stored in $BOOKMARKS -# ============================================================================== - -BOOKMARKS="$HOME/.bookmarks" -OPEN_COMMAND='surf' - -bookmarks() { - n=0 - - # Search all bookmarks with #$1 tag in $BOOKMARKS - sed -n "/^#$1$/ { N; N; p }" "$BOOKMARKS" | - { - while read -r tag - do - read -r name - read -r url - - n=$(($n + 1)) - - if [ -z "$2" ] || [ "$n" -eq "$2" ] 2> /dev/null - then - printf '\033[91m%4s \033[0;1m%-30s \033[0;96m%s\033[0m\n' \ - "$n" "$name" "$url" - fi - - if [ "$n" -eq "$2" ] 2> /dev/null - then - $OPEN_COMMAND $url 2> /dev/null & - fi - done - } -} - -m=0 # Tag count - -if [ -z "$1" ] || [ "$1" = "-l" ] || [ "$1" = "${1#-}" ] -then - # Search all tags in $BOOKMARKS and make a _set_ of these - sed -n "/^#/ s/^#\(.*\)/\1/ p" "$BOOKMARKS" | sort | uniq | - { - while read -r tag - do - # increment tag count - m=$(($m + 1 )) - - # Uppercase arg 1 and tag for case insensitive comparison - ut="$(printf '%s' "$tag" | tr [:lower:] [:upper:])" - u1="$(printf '%s' "$1" | tr [:lower:] [:upper:])" - - if [ -z "$1" ] - then - printf '\033[91m%3s \033[0;1m%s\033[0m\n' "$m" "$tag" - - elif ([ -z "$2" ] && ([ "$1" = "$m" ] || [ "$u1" = "$ut" ])) || [ "$1" = "-l" ] - then - printf '\n\033[91m%3s \033[0;1m%s\033[0m\n\n' "$m" "$tag" - bookmarks "$tag" - - elif [ "$2" -eq "$2" ] 2> /dev/null && [ -z $3 ] && ([ "$1" = "$m" ] || [ "$u1" = "$ut" ]) - then - bookmarks "$tag" "$2" - fi - done - } -else - printf '%s\n' 'Usage: - - Listing bookmarks: - bookmark list all available tags - bookmark [tag_number|tag_name|] list bookmarks withe specified tag - bookmark -l list all bookmarks - - Opening bookmark: - bookmark [tag_number|tag_name] bookmark_number - - Adding bookmark: (not implemented yet) - bookmark url tag name' -fi diff --git a/bin/color-table b/bin/color-table @@ -1,15 +0,0 @@ -#!/bin/sh -for fgbg in 38 48 ; do - for color in {0..256} - do - printf "\e[${fgbg};5;${color}m ${color}\t\e[0m" - - if [ $((($color + 1) % 10)) == 0 ] - then - printf '\n' - fi - done - printf '\n' -done - -exit 0 diff --git a/bin/colors b/bin/colors @@ -1,27 +0,0 @@ -#!/bin/bash -# -# This file echoes a bunch of color codes to the -# terminal to demonstrate what's available. Each -# line is the color code of one forground color, -# out of 17 (default + 16 escapes), followed by a -# test use of that color on all nine background -# colors (default + 8 escapes). -# - -T='niX' # The test text - -echo -e "\n 40m 41m 42m 43m\ - 44m 45m 46m 47m"; - -for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \ - '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \ - ' 36m' '1;36m' ' 37m' '1;37m'; - do FG=${FGs// /} - echo -en " $FGs \033[$FG $T " - for BG in 40m 41m 42m 43m 44m 45m 46m 47m; - do echo -en "$EINS \033[$FG\033[$BG $T \033[0m"; - done - echo; -done -echo - diff --git a/bin/etc b/bin/etc @@ -1,31 +1,23 @@ #!/bin/sh -# ▌ ▗ -# ▛▌▛▌▜▘ -# ▙▌▙▌▐▖ - Script to link the dotfiles. -# ============================================================================== + +# ▗ +# █▌▜▘▛▘ +# ▙▖▐▖▙▖ - Script to link the dotfiles. +# ------------------------------------------------------------------------------ DOT="${DOT-$HOME/dot}" -for dots_path in $(find $DOT/etc | sed '1 d') +for dot in $(find "$DOT/etc" | sed '1 d') do - home_path="$HOME/.${dots_path#$DOT/etc/}" - printf '%s\n' $home_path - - if [ -d $dots_path ] - then # Create each directories - mkdir -p $home_path - else - ln -sf $dots_path $home_path - fi + home="$HOME/.${dot#$DOT/etc/}" + [ -d "$dots" ] && mkdir -p "$home" || ln -sf "$dot" "$home" done # Mutt if [ ! -f ~/.mutt/password ] then - printf 'Enter mutt password: ' - read password - printf '\n' + printf 'Mutt password: ' + read pw - printf '%s\n' "set my_pass = $password -set imap_pass = $password" > $HOME/.mutt/password + printf '%s\nset imap_pass = %s\n' "$pw" "$pw" > $HOME/.mutt/password fi diff --git a/bin/gits b/bin/gits @@ -17,34 +17,27 @@ GIT="${GIT-$HOME/git}" mkdir -p "$GIT" cd "$GIT" -printf '%s' "$repos" | -{ - n=0 - - while read repo - do - if [ ! -z "$repo" ] +n=0 +IFS="$'\n'" +for repo in $repos +do + if [ ! -z "$repo" ] + then + n=$((n + 1)) + + if [ "$1" = "$n" ] || [ "$1" = "all" ] then - n=$((n + 1)) - - if [ "$1" = "$n" ] || [ "$1" = "all" ] - then - git clone $repo + git clone $repo - elif [ -z "$1" ] - then - printf '\033[91m%3s \033[0m%s\n' "$n" "$repo" - fi + elif [ -z "$1" ] + then + printf '\033[91m%3s \033[0m%s\n' "$n" "$repo" fi - done -} - - -# LINKS ------------------------------------------------------------------------ + fi +done +# Adjustments rm -rf $HOME/www -mv $GIT/www $HOME/www - +mv $GIT/www $HOME/www ln -sf $GIT/notes $HOME - ln -sf $DOT $GIT diff --git a/bin/todo b/bin/todo @@ -1,46 +0,0 @@ -#!/bin/sh - -# ▗====▌======================================================================== -# ▜▘▛▌▛▌▛▌ -# ▐▖▙▌▙▌▙▌ - simple todo script. I thanks xero for this! -# ============================================================================== - -file="$HOME/.todo" -( [ -e "$file" ] || touch "$file" ) && [ ! -w "$file" ] && printf '%s\n' cannot write to $file && exit 1 - -if [ "$1" = "-d" ] -then - if [ -z $2 ] - then - printf '%s\n' 'missing option' - printf '%s\n' 'pass an item number to delete' - else - sed -e "$2" 'd' -i $file - fi - -elif [ "$1" = "-a" ] -then - if [ -z $2 ] - then - printf '%s\n' 'missing option' - printf '%s\n' 'pass an item to add' - else - printf '%s\n' "$2" >> $file - fi - -else - while true; - do - clear - printf '%s\n' '' - printf '%s\n' ' ▄▖ ▌ http://xero.nu' - printf '%s\n' '-▐ ▛▌▛▌▛▌----------------------------' - printf '%s\n' ' ▐ ▙▌▙▌▙▌ -a add -d delete' - printf '%s\n' '=====================================' - printf '%s\n' '' - - nl -b a $file - sleep 4 - done; -fi -exit diff --git a/etc/bash_profile b/etc/bash_profile diff --git a/etc/bashrc b/etc/bashrc @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash # ▌ ▌ # ▛▌▀▌▛▘▛▌▛▘▛▘ @@ -15,22 +15,11 @@ # Replacements alias less='less -R' - -# Shortcuts alias l='TERM=xterm-256color ls --color' alias la='TERM=xterm-256color ls --color -A' alias ll='TERM=xterm-256color ls --color -lh' alias lla='TERM=xterm-256color ls --color -Alh' - -# Workflow -alias a='abduco' # List -alias aa='abduco -A main dvtm-start' # Create/attach session -alias k='kill' - -# Tools -alias weather='curl -4 wttr.in' # Thanks @biochemistries -alias fg="figlet -f $DOT/etc/figlet/miniwi.flf" -alias b='bookmark' +alias weather='curl -4 wttr.in' alias am='alsamixer -c 1' @@ -53,44 +42,151 @@ extract() *.7z) 7z x $1 ;; *.xz) xz -d $1 ;; *.deb) ar vx $1 ;; - *) echo "'$1' cannot be extracted via 'extract'" ;; + *) printf 'Unknown archive type\n' ;; esac else echo "'$1' is not a valid file!" fi } +colors() +{ + printf '\n 40m 41m 42m 43m 44m 45m 46m 47m\n' + + for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \ + '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \ + ' 36m' '1;36m' ' 37m' '1;37m'; + do + FG=${FGs// /} + printf " $FGs \033[$FG === " + + for BG in 40m 41m 42m 43m 44m 45m 46m 47m; + do + printf "$EINS \033[$FG\033[$BG $T \033[0m" + done + + printf '\n' + done +} + +color_table() +{ + for fgbg in 38 48 ; do + for color in {0..256} + do + printf "\e[${fgbg};5;${color}m ${color}\t\e[0m" + + if [ $((($color + 1) % 10)) == 0 ] + then + printf '\n' + fi + done + printf '\n' + done +} + +todo() +{ + TODO="${TODO-$HOME/.todo}" + touch $TODO + + [ "$1" = "-d" ] && [ ! -z $2 ] && sed -e "$2" 'd' -i $TODO + [ "$1" = "-a" ] && [ ! -z $2 ] && printf '%s\n' "$2" >> $TODO + if [ -z "$1" ] + then + while sleep 4 + do + clear + printf '\n%s\n' ' ▄▖ ▌ http://xero.nu' + printf '%s\n' '-▐ ▛▌▛▌▛▌----------------------------' + printf '%s\n' ' ▐ ▙▌▙▌▙▌ -a add -d delete' + printf '%s\n\n' '=====================================' + nl -b a $TODO + done + fi +} + +# Link dotfiles +etc() { + + DOT="${DOT-$HOME/dot}" + + for dots in $(find $DOT/etc | sed '1 d') + do + home="$HOME/.${dots#$DOT/etc/}" + [ -d $dots ] && mkdir -p $home || ln -sf $dots $home + done + + # Mutt + if [ ! -f ~/.mutt/password ] + then + printf 'Enter mutt password: ' + read password + + printf '%s\nset imap_pass = %s\n' "$password" "$password" > $HOME/.mutt/password + fi +} + +# TTY SETUP -------------------------------------------------------------------- + +# Bg Red Green Yellow Blue Magenta (g) Cyan Fg +theme_badwolf=' +\e]P0000000 \e]P1d0154b \e]P27e9e00 \e]P3fade3e \e]P40a9dff \e]P5553344 \e]P68cffba \e]P7ffffff +\e]P8141413 \e]P9ff2c4b \e]PAaeee00 \e]PBffa724 \e]PC0a9dff \e]PD998f84 \e]PE8cffba \e]PFf4cf86' + +theme_gotham=' +\e]P0000000 \e]P18a221c \e]P2186a57 \e]P3edb54b \e]P4093748 \e]P5010d15 \e]P633859d \e]P799d1ce +\e]P810151b \e]P9c33027 \e]PA26a98b \e]PBd26939 \e]PC6CBDE2 \e]PD245361 \e]PE6CBDE2 \e]PFd1e9e7' + +theme_solarized_light=' +\e]P0ffddbb \e]P1d0154b \e]P27e9e00 \e]P3fade3e \e]P4096daf \e]P5e9c8b6 \e]P68cffba \e]P7000000 +\e]P8f4cf86 \e]P9ff2c4b \e]PAaeee00 \e]PBffa724 \e]PC0a9dff \e]PD897f74 \e]PE8cffba \e]PF141413' + +theme_ghost_in_the_shell=' +\e]P0000000 \e]P191265C \e]P2439a64 \e]P3c9dd79 \e]P45fb3b3 \e]P5516583 \e]P64a8f86 \e]P7bbccee +\e]P8182020 \e]P9E71E5B \e]PA72f4a0 \e]PBf5ff8B \e]PC29a5ff \e]PD676cb0 \e]PE00ffff \e]PFffffff' + +theme_coal=' +\e]P0000000 \e]P191265C \e]P2439a64 \e]P3c9dd79 \e]P45fb3b3 \e]P5516583 \e]P64a8f86 \e]P7bbccee +\e]P8222222 \e]P9E71E5B \e]PA72f4a0 \e]PBf5ff8B \e]PC29a5ff \e]PD676cb0 \e]PE00ffff \e]PFffffff' + +if [ "$TERM" == 'linux' ] +then + # Theme + printf "$theme_ghost_in_the_shell" + + # Font + setfont ~/.local/share/fonts/tewi.psf + + # Keyboard layout + sudo loadkeys dvorak + [ -z "$(dumpkeys | sed -n '/keycode 58 = Control/p')" ] && sudo loadkeys <<EOF +$(dumpkeys | head -1) +keycode 58 = Control +EOF +fi # PROMPT ----------------------------------------------------------------------- _prompt() { - # Exit status local _exit=$? [[ _exit -gt 0 ]] && _exit='\e[1;31m' || _exit='\e[1;32m' - # Background jobs local _jobs="$(jobs)" [ ! -z "$_jobs" ] && _jobs="$(printf '%s' "$_jobs" | sed "s/^/ ┠─&/")\n" - # pwd local _pwd='' [[ $PWD/ = "$HOME"/* ]] && _pwd="~${PWD#$HOME}" || _pwd=$PWD - # Window name - printf "\e]0; bash $_pwd\007" - - # Git status local _git=$(git branch 2>/dev/null) - # Prompt printf " - ┎──────────────────┄ \e[0m\e[1;34m$_pwd\e[96m $_git \e[0m -$_jobs" - PS1=" ┗╸\[$_exit\]━\[\e[0m\]╺━┅┉ " + ┎──────────────────┄ \e[0m\e[1;34m$_pwd\e[1;36m $_git \e[0m + $_jobs" + + PS1="┗╸\[$_exit\]━\[\e[0m\]╺━┅┉ " } -PS2=' ' -PS3=' ' -PS4=' ' +PS1='> ' PS2='| ' PS3='| ' PS4='| ' PROMPT_COMMAND='_prompt' diff --git a/etc/cgorc b/etc/cgorc @@ -1,17 +0,0 @@ -# start URI -start_uri gopher://gopher.floodgap.com:70/ - -# commands -cmd_text vim -RM -cmd_browser surf -cmd_image display -cmd_player mplayer - -# colors -color_prompt 1;34 -color_selector 1;32 - -# bookmarks -bookmark1 gopher://gopher.floodgap.com:70/ -bookmark2 gopher://devio.us:70/~steini -bookmark2 gopher://z3bra.org diff --git a/etc/profile b/etc/profile @@ -1,26 +1,17 @@ #!/bin/sh - -# ======▐▘▘▜==================================================================== +# ▐▘▘▜ # ▛▌▛▘▛▌▜▘▌▐ █▌ -# ▙▌▌ ▙▌▐ ▌▐▖▙▖ - scripting environment setup for all shells +# ▙▌▌ ▙▌▐ ▌▐▖▙▖ - environment variables common to the other scripts # ▌============================================================================= -# Environment variables -------------------------------------------------------- -# Global variables used in scripts (with defaults) - DOT="$HOME/dot" - SRC="$HOME/src" - GIT="$HOME/git" - WWW="$HOME/www" -PREFIX="$HOME/.local" -export DOT SRC GIT WWW PREFIX +# Global variables used in scripts +export DOT="$HOME/dot" SRC="$HOME/src" GIT="$HOME/git" WWW="$HOME/www" +export TODO="$HOME/.todo" BOOKMARKS="$HOME/.bookmarks" +export PREFIX="$HOME/.local" # Editors - EDITOR='vim' - VISUAL='vim' -ALTERNATE_EDITOR='vi' -export EDITOR DVTM_EDITOR VISUAL ALTERNATE_EDITOR +export EDITOR='vim' VISUAL='vim' ALTERNATE_EDITOR='vi' -# Path -PATH="$PATH:$DOT/bin:$HOME/.local/bin" -export PATH +# Executables +export PATH="$PATH:$DOT/bin:$HOME/.local/bin" diff --git a/etc/readline/inputrc b/etc/readline/inputrc @@ -1,26 +0,0 @@ -#!/bin/sh - -set bell-style visible - -# Vi mode - -set editing-mode vi -set keymap vi-insert - -"jk": vi-movement-mode - -# Completion - -TAB: menu-complete -"\e[Z": menu-complete-backward - -# Sort candidates horizontally for easier scrolling -set print-completions-horizontally on -# Show the completions more immediately -set show-all-if-ambiguous on -set show-all-if-unmodified on -# Make|file <TAB> -> Makefile| -set skip-completed-text on -set visible-stats on -# Do not complete immediately -set menu-complete-display-prefix on diff --git a/src/dwm/config.h b/src/dwm/config.h @@ -5,7 +5,7 @@ static const char *fonts[] = { "tewi:pixelsize=11" }; static const char dmenufont[] = "tewi:pixelsize=11"; -static const char normbordercolor[] = "#222222"; +static const char normbordercolor[] = "#444444"; static const char normbgcolor[] = "#222222"; static const char normfgcolor[] = "#cccccc"; static const char selbordercolor[] = "#ffffff";