diff --git a/browser/.gitkeep b/browser/.gitkeep new file mode 100644 index 0000000..8349c4a --- /dev/null +++ b/browser/.gitkeep @@ -0,0 +1 @@ +# Coming Soon! diff --git a/common/colors/generator/gen.bash b/common/colors/generator/gen.bash new file mode 100755 index 0000000..5aeda3b --- /dev/null +++ b/common/colors/generator/gen.bash @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +v=$(ruby --version) + +if [[ $? -eq 0 ]]; then + SCHEME="donokai" + if [[ -n $1 ]]; then + SCHEME=$1 + fi + + DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )/../.." && pwd) + source "$DIR/variables.bash" + + mkdir -p "$DOTFILES_PATH/colors/gen/vendor" + + B16_DIR="$DOTFILES_PATH/colors/gen/vendor/base16-builder" + COLORS_PATH="$B16_DIR/output" + + if [ -d "$B16_DIR" ]; then + echo "Skipping repo pull down..." + rm -rf "$COLORS_PATH" + mkdir -p "$COLORS_PATH" + else + git clone https://github.com/lytedev/base16-builder.git "$DOTFILES_PATH/colors/gen/vendor/base16-builder" + fi + + "$DOTFILES_PATH/colors/gen/vendor/base16-builder/base16" -t vim -s "$DOTFILES_PATH/colors/gen/schemes/$SCHEME.yml" + "$DOTFILES_PATH/colors/gen/vendor/base16-builder/base16" -t xresources -s "$DOTFILES_PATH/colors/gen/schemes/$SCHEME.yml" + "$DOTFILES_PATH/colors/gen/vendor/base16-builder/base16" -t shell -s "$DOTFILES_PATH/colors/gen/schemes/$SCHEME.yml" + + COLORS_PATH=$DOTFILES_PATH/colors/gen/vendor/base16-builder/output + + rm -f "$DOTFILES_PATH/colors/xresources" + rm -f "$DOTFILES_PATH/colors/vim" + rm -f "$DOTFILES_PATH/colors/shell" + cp "$COLORS_PATH/xresources/base16-$SCHEME.dark.xresources" "$DOTFILES_PATH/colors/xresources" + cp "$COLORS_PATH/vim/base16-$SCHEME.vim" "$DOTFILES_PATH/colors/vim" + cp "$COLORS_PATH/shell/base16-$SCHEME.dark.sh" "$DOTFILES_PATH/colors/shell" + chmod +x "$DOTFILES_PATH/colors/shell" + + xrdb -merge "$DOTFILES_PATH/colors/xresources" + source "$DOTFILES_PATH/scripts/reload_xresources.sh" + source "$DOTFILES_PATH/env/wm/bspwm_config" > /dev/null + # kill -SIGUSR1 $(cat "$BAR_PID_FILE") +else + echo "Ruby isn't installed." +fi diff --git a/common/colors/generator/schemes/bright.yml b/common/colors/generator/schemes/bright.yml new file mode 100644 index 0000000..bfe73eb --- /dev/null +++ b/common/colors/generator/schemes/bright.yml @@ -0,0 +1,18 @@ +scheme: "Bright" +author: "Chris Kempson (http://chriskempson.com)" +base00: "111111" +base01: "303030" +base02: "505050" +base03: "b0b0b0" +base04: "d0d0d0" +base05: "e0e0e0" +base06: "f5f5f5" +base07: "ffffff" +base08: "fb0120" +base09: "fc6d24" +base0A: "fda331" +base0B: "a1c659" +base0C: "76c7b7" +base0D: "6fb3d2" +base0E: "d381c3" +base0F: "be643c" diff --git a/common/colors/generator/schemes/donokai.yml b/common/colors/generator/schemes/donokai.yml new file mode 100644 index 0000000..7c0c4a8 --- /dev/null +++ b/common/colors/generator/schemes/donokai.yml @@ -0,0 +1,18 @@ +scheme: "Donokai" +author: "Wimer Hazenberg (http://www.monokai.nl)" +base00: "111111" # background, dark grey +base01: "383830" # lighter grey +base02: "49483e" # lighter grey +base03: "75715e" # greyish yellow (peuce) +base04: "a59f85" # lighter peuce +base05: "f8f8f2" # foreground white +base06: "f5f4f1" # foreground 2 white +base07: "f9f8f5" # foreground 3 white +base08: "f92672" # magenta +base09: "fd971f" # orange +base0A: "f4bf75" # yellow +base0B: "a6e22e" # green +base0C: "a1efe4" # cyan +base0D: "66d9ef" # blue +base0E: "ae81ff" # purple +base0F: "cc6633" # pale orange diff --git a/common/colors/generator/vendor/base16-builder b/common/colors/generator/vendor/base16-builder new file mode 160000 index 0000000..944e88a --- /dev/null +++ b/common/colors/generator/vendor/base16-builder @@ -0,0 +1 @@ +Subproject commit 944e88a10bc145f56ead1d6d82a06f252c92adc1 diff --git a/common/colors/link.bash b/common/colors/link.bash new file mode 100755 index 0000000..a364840 --- /dev/null +++ b/common/colors/link.bash @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )/.." && pwd) +source "$DIR/variables.bash" + +mkdir -p "$DOTFILES_PATH/editor/nvim/config/colors" + +rm -f ~/.Xresources.colors +rm -f "$DOTFILES_PATH/editor/nvim/config/colors/current.vim" +ln -s "$DOTFILES_PATH/colors/xresources" "$HOME/.Xresources.colors" +ln -s "$DOTFILES_PATH/colors/vim" "$DOTFILES_PATH/editor/nvim/config/colors/current.vim" + +source "$DOTFILES_PATH/env/x/xloadresources" + diff --git a/common/colors/shell b/common/colors/shell new file mode 100755 index 0000000..42b57c5 --- /dev/null +++ b/common/colors/shell @@ -0,0 +1,125 @@ +#!/bin/sh +# Base16 Donokai - Shell color setup script +# Wimer Hazenberg (http://www.monokai.nl) + +if [ "${TERM%%-*}" = 'linux' ]; then + # This script doesn't support linux console (use 'vconsole' template instead) + return 2>/dev/null || exit 0 +fi + +color00="11/11/11" # Base 00 - Black +color01="f9/26/72" # Base 08 - Red +color02="a6/e2/2e" # Base 0B - Green +color03="f4/bf/75" # Base 0A - Yellow +color04="66/d9/ef" # Base 0D - Blue +color05="ae/81/ff" # Base 0E - Magenta +color06="a1/ef/e4" # Base 0C - Cyan +color07="f8/f8/f2" # Base 05 - White +color08="75/71/5e" # Base 03 - Bright Black +color09=$color01 # Base 08 - Bright Red +color10=$color02 # Base 0B - Bright Green +color11=$color03 # Base 0A - Bright Yellow +color12=$color04 # Base 0D - Bright Blue +color13=$color05 # Base 0E - Bright Magenta +color14=$color06 # Base 0C - Bright Cyan +color15="f9/f8/f5" # Base 07 - Bright White +color16="fd/97/1f" # Base 09 +color17="cc/66/33" # Base 0F +color18="38/38/30" # Base 01 +color19="49/48/3e" # Base 02 +color20="a5/9f/85" # Base 04 +color21="f5/f4/f1" # Base 06 +color_foreground="f8/f8/f2" # Base 05 +color_background="11/11/11" # Base 00 +color_cursor="f8/f8/f2" # Base 05 + +if [ -n "$TMUX" ]; then + # tell tmux to pass the escape sequences through + # (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324) + printf_template="\033Ptmux;\033\033]4;%d;rgb:%s\007\033\\" + printf_template_var="\033Ptmux;\033\033]%d;rgb:%s\007\033\\" + printf_template_custom="\033Ptmux;\033\033]%s%s\007\033\\" +elif [ "${TERM%%-*}" = "screen" ]; then + # GNU screen (screen, screen-256color, screen-256color-bce) + printf_template="\033P\033]4;%d;rgb:%s\007\033\\" + printf_template_var="\033P\033]%d;rgb:%s\007\033\\" + printf_template_custom="\033P\033]%s%s\007\033\\" +elif [[ $- != *i* ]]; then + # non-interactive + alias printf=/bin/false +else + printf_template="\033]4;%d;rgb:%s\033\\" + printf_template_var="\033]%d;rgb:%s\033\\" + printf_template_custom="\033]%s%s\033\\" +fi + +# 16 color space +printf $printf_template 0 $color00 +printf $printf_template 1 $color01 +printf $printf_template 2 $color02 +printf $printf_template 3 $color03 +printf $printf_template 4 $color04 +printf $printf_template 5 $color05 +printf $printf_template 6 $color06 +printf $printf_template 7 $color07 +printf $printf_template 8 $color08 +printf $printf_template 9 $color09 +printf $printf_template 10 $color10 +printf $printf_template 11 $color11 +printf $printf_template 12 $color12 +printf $printf_template 13 $color13 +printf $printf_template 14 $color14 +printf $printf_template 15 $color15 + +# 256 color space +printf $printf_template 16 $color16 +printf $printf_template 17 $color17 +printf $printf_template 18 $color18 +printf $printf_template 19 $color19 +printf $printf_template 20 $color20 +printf $printf_template 21 $color21 + +# foreground / background / cursor color +if [ -n "$ITERM_SESSION_ID" ]; then + # iTerm2 proprietary escape codes + printf $printf_template_custom Pg f8f8f2 # forground + printf $printf_template_custom Ph 111111 # background + printf $printf_template_custom Pi f8f8f2 # bold color + printf $printf_template_custom Pj 49483e # selection color + printf $printf_template_custom Pk f8f8f2 # selected text color + printf $printf_template_custom Pl f8f8f2 # cursor + printf $printf_template_custom Pm 111111 # cursor text +else + printf $printf_template_var 10 $color_foreground + printf $printf_template_var 11 $color_background + printf $printf_template_custom 12 ";7" # cursor (reverse video) +fi + +# clean up +unset printf_template +unset printf_template_var +unset color00 +unset color01 +unset color02 +unset color03 +unset color04 +unset color05 +unset color06 +unset color07 +unset color08 +unset color09 +unset color10 +unset color11 +unset color12 +unset color13 +unset color14 +unset color15 +unset color16 +unset color17 +unset color18 +unset color19 +unset color20 +unset color21 +unset color_foreground +unset color_background +unset color_cursor diff --git a/common/colors/vim b/common/colors/vim new file mode 100644 index 0000000..a1b330b --- /dev/null +++ b/common/colors/vim @@ -0,0 +1,316 @@ +" Base16 Donokai (https://github.com/chriskempson/base16) +" Scheme: Wimer Hazenberg (http://www.monokai.nl) + +" This enables the coresponding base16-shell script to run so that +" :colorscheme works in terminals supported by base16-shell scripts +" User must set this variable in .vimrc +" let g:base16_shell_path=base16-builder/output/shell/ +if !has('gui_running') + if exists("g:base16_shell_path") + execute "silent !/bin/sh ".g:base16_shell_path."/base16-donokai.".&background.".sh" + endif +endif + +" GUI color definitions +let s:gui00 = "111111" +let s:gui01 = "383830" +let s:gui02 = "49483e" +let s:gui03 = "75715e" +let s:gui04 = "a59f85" +let s:gui05 = "f8f8f2" +let s:gui06 = "f5f4f1" +let s:gui07 = "f9f8f5" +let s:gui08 = "f92672" +let s:gui09 = "fd971f" +let s:gui0A = "f4bf75" +let s:gui0B = "a6e22e" +let s:gui0C = "a1efe4" +let s:gui0D = "66d9ef" +let s:gui0E = "ae81ff" +let s:gui0F = "cc6633" + +" Terminal color definitions +let s:cterm00 = "00" +let s:cterm03 = "08" +let s:cterm05 = "07" +let s:cterm07 = "15" +let s:cterm08 = "01" +let s:cterm0A = "03" +let s:cterm0B = "02" +let s:cterm0C = "06" +let s:cterm0D = "04" +let s:cterm0E = "05" +if exists('base16colorspace') && base16colorspace == "256" + let s:cterm01 = "18" + let s:cterm02 = "19" + let s:cterm04 = "20" + let s:cterm06 = "21" + let s:cterm09 = "16" + let s:cterm0F = "17" +else + let s:cterm01 = "10" + let s:cterm02 = "11" + let s:cterm04 = "12" + let s:cterm06 = "13" + let s:cterm09 = "09" + let s:cterm0F = "14" +endif + +" Theme setup +hi clear +syntax reset +let g:colors_name = "base16-donokai" + +" Highlighting function +fun hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp) + if a:guifg != "" + exec "hi " . a:group . " guifg=#" . s:gui(a:guifg) + endif + if a:guibg != "" + exec "hi " . a:group . " guibg=#" . s:gui(a:guibg) + endif + if a:ctermfg != "" + exec "hi " . a:group . " ctermfg=" . s:cterm(a:ctermfg) + endif + if a:ctermbg != "" + exec "hi " . a:group . " ctermbg=" . s:cterm(a:ctermbg) + endif + if a:attr != "" + exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr + endif + if a:guisp != "" + exec "hi " . a:group . " guisp=#" . a:guisp + endif +endfun + +" Return GUI color for light/dark variants +fun s:gui(color) + if &background == "dark" + return a:color + endif + + if a:color == s:gui00 + return s:gui07 + elseif a:color == s:gui01 + return s:gui06 + elseif a:color == s:gui02 + return s:gui05 + elseif a:color == s:gui03 + return s:gui04 + elseif a:color == s:gui04 + return s:gui03 + elseif a:color == s:gui05 + return s:gui02 + elseif a:color == s:gui06 + return s:gui01 + elseif a:color == s:gui07 + return s:gui00 + endif + + return a:color +endfun + +" Return terminal color for light/dark variants +fun s:cterm(color) + if &background == "dark" + return a:color + endif + + if a:color == s:cterm00 + return s:cterm07 + elseif a:color == s:cterm01 + return s:cterm06 + elseif a:color == s:cterm02 + return s:cterm05 + elseif a:color == s:cterm03 + return s:cterm04 + elseif a:color == s:cterm04 + return s:cterm03 + elseif a:color == s:cterm05 + return s:cterm02 + elseif a:color == s:cterm06 + return s:cterm01 + elseif a:color == s:cterm07 + return s:cterm00 + endif + + return a:color +endfun + +" Vim editor colors +call hi("Bold", "", "", "", "", "bold", "") +call hi("Debug", s:gui08, "", s:cterm08, "", "", "") +call hi("Directory", s:gui0D, "", s:cterm0D, "", "", "") +call hi("Error", s:gui00, s:gui08, s:cterm00, s:cterm08, "", "") +call hi("ErrorMsg", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "") +call hi("Exception", s:gui08, "", s:cterm08, "", "", "") +call hi("FoldColumn", s:gui0C, s:gui01, s:cterm0C, s:cterm01, "", "") +call hi("Folded", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") +call hi("IncSearch", s:gui01, s:gui09, s:cterm01, s:cterm09, "none", "") +call hi("Italic", "", "", "", "", "none", "") +call hi("Macro", s:gui08, "", s:cterm08, "", "", "") +call hi("MatchParen", s:gui00, s:gui03, s:cterm00, s:cterm03, "", "") +call hi("ModeMsg", s:gui0B, "", s:cterm0B, "", "", "") +call hi("MoreMsg", s:gui0B, "", s:cterm0B, "", "", "") +call hi("Question", s:gui0D, "", s:cterm0D, "", "", "") +call hi("Search", s:gui03, s:gui0A, s:cterm03, s:cterm0A, "", "") +call hi("SpecialKey", s:gui03, "", s:cterm03, "", "", "") +call hi("TooLong", s:gui08, "", s:cterm08, "", "", "") +call hi("Underlined", s:gui08, "", s:cterm08, "", "", "") +call hi("Visual", "", s:gui02, "", s:cterm02, "", "") +call hi("VisualNOS", s:gui08, "", s:cterm08, "", "", "") +call hi("WarningMsg", s:gui08, "", s:cterm08, "", "", "") +call hi("WildMenu", s:gui08, s:gui0A, s:cterm08, "", "", "") +call hi("Title", s:gui0D, "", s:cterm0D, "", "none", "") +call hi("Conceal", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "", "") +call hi("Cursor", s:gui00, s:gui05, s:cterm00, s:cterm05, "", "") +call hi("NonText", s:gui03, "", s:cterm03, "", "", "") +call hi("Normal", s:gui05, s:gui00, s:cterm05, s:cterm00, "", "") +call hi("LineNr", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") +call hi("SignColumn", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") +call hi("StatusLine", s:gui04, s:gui02, s:cterm04, s:cterm02, "none", "") +call hi("StatusLineNC", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "") +call hi("VertSplit", s:gui02, s:gui02, s:cterm02, s:cterm02, "none", "") +call hi("ColorColumn", "", s:gui01, "", s:cterm01, "none", "") +call hi("CursorColumn", "", s:gui01, "", s:cterm01, "none", "") +call hi("CursorLine", "", s:gui01, "", s:cterm01, "none", "") +call hi("CursorLineNr", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") +call hi("PMenu", s:gui04, s:gui01, s:cterm04, s:cterm01, "none", "") +call hi("PMenuSel", s:gui01, s:gui04, s:cterm01, s:cterm04, "", "") +call hi("TabLine", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "") +call hi("TabLineFill", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "") +call hi("TabLineSel", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "none", "") + +" Standard syntax highlighting +call hi("Boolean", s:gui09, "", s:cterm09, "", "", "") +call hi("Character", s:gui08, "", s:cterm08, "", "", "") +call hi("Comment", s:gui03, "", s:cterm03, "", "", "") +call hi("Conditional", s:gui0E, "", s:cterm0E, "", "", "") +call hi("Constant", s:gui09, "", s:cterm09, "", "", "") +call hi("Define", s:gui0E, "", s:cterm0E, "", "none", "") +call hi("Delimiter", s:gui0F, "", s:cterm0F, "", "", "") +call hi("Float", s:gui09, "", s:cterm09, "", "", "") +call hi("Function", s:gui0D, "", s:cterm0D, "", "", "") +call hi("Identifier", s:gui08, "", s:cterm08, "", "none", "") +call hi("Include", s:gui0D, "", s:cterm0D, "", "", "") +call hi("Keyword", s:gui0E, "", s:cterm0E, "", "", "") +call hi("Label", s:gui0A, "", s:cterm0A, "", "", "") +call hi("Number", s:gui09, "", s:cterm09, "", "", "") +call hi("Operator", s:gui05, "", s:cterm05, "", "none", "") +call hi("PreProc", s:gui0A, "", s:cterm0A, "", "", "") +call hi("Repeat", s:gui0A, "", s:cterm0A, "", "", "") +call hi("Special", s:gui0C, "", s:cterm0C, "", "", "") +call hi("SpecialChar", s:gui0F, "", s:cterm0F, "", "", "") +call hi("Statement", s:gui08, "", s:cterm08, "", "", "") +call hi("StorageClass", s:gui0A, "", s:cterm0A, "", "", "") +call hi("String", s:gui0B, "", s:cterm0B, "", "", "") +call hi("Structure", s:gui0E, "", s:cterm0E, "", "", "") +call hi("Tag", s:gui0A, "", s:cterm0A, "", "", "") +call hi("Todo", s:gui0A, s:gui01, s:cterm0A, s:cterm01, "", "") +call hi("Type", s:gui0A, "", s:cterm0A, "", "none", "") +call hi("Typedef", s:gui0A, "", s:cterm0A, "", "", "") + +" C highlighting +call hi("cOperator", s:gui0C, "", s:cterm0C, "", "", "") +call hi("cPreCondit", s:gui0E, "", s:cterm0E, "", "", "") + +" C# highlighting +call hi("csClass", s:gui0A, "", s:cterm0A, "", "", "") +call hi("csAttribute", s:gui0A, "", s:cterm0A, "", "", "") +call hi("csModifier", s:gui0E, "", s:cterm0E, "", "", "") +call hi("csType", s:gui08, "", s:cterm08, "", "", "") +call hi("csUnspecifiedStatement", s:gui0D, "", s:cterm0D, "", "", "") +call hi("csContextualStatement", s:gui0E, "", s:cterm0E, "", "", "") +call hi("csNewDecleration", s:gui08, "", s:cterm08, "", "", "") + +" CSS highlighting +call hi("cssBraces", s:gui05, "", s:cterm05, "", "", "") +call hi("cssClassName", s:gui0E, "", s:cterm0E, "", "", "") +call hi("cssColor", s:gui0C, "", s:cterm0C, "", "", "") + +" Diff highlighting +call hi("DiffAdd", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "", "") +call hi("DiffChange", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") +call hi("DiffDelete", s:gui08, s:gui01, s:cterm08, s:cterm01, "", "") +call hi("DiffText", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "", "") +call hi("DiffAdded", s:gui0B, s:gui00, s:cterm0B, s:cterm00, "", "") +call hi("DiffFile", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "") +call hi("DiffNewFile", s:gui0B, s:gui00, s:cterm0B, s:cterm00, "", "") +call hi("DiffLine", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "", "") +call hi("DiffRemoved", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "") + +" Git highlighting +call hi("gitCommitOverflow", s:gui08, "", s:cterm08, "", "", "") +call hi("gitCommitSummary", s:gui0B, "", s:cterm0B, "", "", "") + +" GitGutter highlighting +call hi("GitGutterAdd", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "", "") +call hi("GitGutterChange", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "", "") +call hi("GitGutterDelete", s:gui08, s:gui01, s:cterm08, s:cterm01, "", "") +call hi("GitGutterChangeDelete", s:gui0E, s:gui01, s:cterm0E, s:cterm01, "", "") + +" HTML highlighting +call hi("htmlBold", s:gui0A, "", s:cterm0A, "", "", "") +call hi("htmlItalic", s:gui0E, "", s:cterm0E, "", "", "") +call hi("htmlEndTag", s:gui05, "", s:cterm05, "", "", "") +call hi("htmlTag", s:gui05, "", s:cterm05, "", "", "") + +" JavaScript highlighting +call hi("javaScript", s:gui05, "", s:cterm05, "", "", "") +call hi("javaScriptBraces", s:gui05, "", s:cterm05, "", "", "") +call hi("javaScriptNumber", s:gui09, "", s:cterm09, "", "", "") + +" Markdown highlighting +call hi("markdownCode", s:gui0B, "", s:cterm0B, "", "", "") +call hi("markdownError", s:gui05, s:gui00, s:cterm05, s:cterm00, "", "") +call hi("markdownCodeBlock", s:gui0B, "", s:cterm0B, "", "", "") +call hi("markdownHeadingDelimiter", s:gui0D, "", s:cterm0D, "", "", "") + +" NERDTree highlighting +call hi("NERDTreeDirSlash", s:gui0D, "", s:cterm0D, "", "", "") +call hi("NERDTreeExecFile", s:gui05, "", s:cterm05, "", "", "") + +" PHP highlighting +call hi("phpMemberSelector", s:gui05, "", s:cterm05, "", "", "") +call hi("phpComparison", s:gui05, "", s:cterm05, "", "", "") +call hi("phpParent", s:gui05, "", s:cterm05, "", "", "") + +" Python highlighting +call hi("pythonOperator", s:gui0E, "", s:cterm0E, "", "", "") +call hi("pythonRepeat", s:gui0E, "", s:cterm0E, "", "", "") + +" Ruby highlighting +call hi("rubyAttribute", s:gui0D, "", s:cterm0D, "", "", "") +call hi("rubyConstant", s:gui0A, "", s:cterm0A, "", "", "") +call hi("rubyInterpolation", s:gui0B, "", s:cterm0B, "", "", "") +call hi("rubyInterpolationDelimiter", s:gui0F, "", s:cterm0F, "", "", "") +call hi("rubyRegexp", s:gui0C, "", s:cterm0C, "", "", "") +call hi("rubySymbol", s:gui0B, "", s:cterm0B, "", "", "") +call hi("rubyStringDelimiter", s:gui0B, "", s:cterm0B, "", "", "") + +" SASS highlighting +call hi("sassidChar", s:gui08, "", s:cterm08, "", "", "") +call hi("sassClassChar", s:gui09, "", s:cterm09, "", "", "") +call hi("sassInclude", s:gui0E, "", s:cterm0E, "", "", "") +call hi("sassMixing", s:gui0E, "", s:cterm0E, "", "", "") +call hi("sassMixinName", s:gui0D, "", s:cterm0D, "", "", "") + +" Signify highlighting +call hi("SignifySignAdd", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "", "") +call hi("SignifySignChange", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "", "") +call hi("SignifySignDelete", s:gui08, s:gui01, s:cterm08, s:cterm01, "", "") + +" Spelling highlighting +call hi("SpellBad", "", s:gui00, "", s:cterm00, "undercurl", s:gui08) +call hi("SpellLocal", "", s:gui00, "", s:cterm00, "undercurl", s:gui0C) +call hi("SpellCap", "", s:gui00, "", s:cterm00, "undercurl", s:gui0D) +call hi("SpellRare", "", s:gui00, "", s:cterm00, "undercurl", s:gui0E) + +" Remove functions +delf hi +delf gui +delf cterm + +" Remove color variables +unlet s:gui00 s:gui01 s:gui02 s:gui03 s:gui04 s:gui05 s:gui06 s:gui07 s:gui08 s:gui09 s:gui0A s:gui0B s:gui0C s:gui0D s:gui0E s:gui0F +unlet s:cterm00 s:cterm01 s:cterm02 s:cterm03 s:cterm04 s:cterm05 s:cterm06 s:cterm07 s:cterm08 s:cterm09 s:cterm0A s:cterm0B s:cterm0C s:cterm0D s:cterm0E s:cterm0F diff --git a/common/colors/xresources b/common/colors/xresources new file mode 100644 index 0000000..2e09987 --- /dev/null +++ b/common/colors/xresources @@ -0,0 +1,41 @@ +! Base16 Donokai +! Scheme: Wimer Hazenberg (http://www.monokai.nl) + +#define base00 #111111 +#define base01 #383830 +#define base02 #49483e +#define base03 #75715e +#define base04 #a59f85 +#define base05 #f8f8f2 +#define base06 #f5f4f1 +#define base07 #f9f8f5 +#define base08 #f92672 +#define base09 #fd971f +#define base0A #f4bf75 +#define base0B #a6e22e +#define base0C #a1efe4 +#define base0D #66d9ef +#define base0E #ae81ff +#define base0F #cc6633 + +*foreground: base05 +*background: base00 +*cursorColor: base05 + +*color0: base00 +*color1: base08 +*color2: base0B +*color3: base0A +*color4: base0D +*color5: base0E +*color6: base0C +*color7: base05 + +*color8: base03 +*color9: base09 +*color10: base01 +*color11: base02 +*color12: base04 +*color13: base06 +*color14: base0F +*color15: base07 diff --git a/de/bspwm_config b/de/bspwm_config new file mode 100755 index 0000000..d607d83 --- /dev/null +++ b/de/bspwm_config @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +BORDER_WIDTH=0 +WINDOW_GAP=25 +DESKTOPS=(dev web misc env play out main srv daem util) + +BSPWM_MONITORS=$(bspc query -M | tac) +MONITOR_COUNT=$(echo "${BSPWM_MONITORS}" | wc -w | awk '{ printf $1 }') +NUM_DESKTOPS=${#DESKTOPS[@]} +PER_MONITOR=$((NUM_DESKTOPS / MONITOR_COUNT)) + +source "$DOTFILES_PATH/scripts/get_color.sh" +source "$DOTFILES_PATH/scripts/get_x_fonts.sh" + +# allow a per-device config to override options +if [ -f "$HOME/.env_bspwm" ]; then + source "$HOME/.env_bspwm" +fi + +# old colors +# bspc config normal_border_color "#$(get_color 05)" +# bspc config focused_border_color "#$(get_color 0D)" +# bspc config active_border_color "#$(get_color 0D)" +# bspc config presel_feedback_color "#$(get_color 0D)" + +bspc config normal_border_color "#$(get_color 01)" +bspc config focused_border_color "#$(get_color 0D)" +bspc config active_border_color "#$(get_color 09)" +bspc config presel_feedback_color "#$(get_color 04)" +bspc config border_width "$BORDER_WIDTH" +bspc config split_ratio 0.50 +bspc config borderless_monocle true +bspc config gapless_monocle true + +bspc config window_gap "$WINDOW_GAP" + +i=1 +for mon in ${BSPWM_MONITORS}; do + max=$((i + PER_MONITOR - 1)) + screens= + for j in $(seq $i $max); do + ind=${DESKTOPS[$((j - 1))]} + screens="$screens$ind " + done + bspc monitor "$mon" -d $screens + i=$((max + 1)) +done + +# allow a per-device config to override options +if [ -f "$HOME/.env_bspwm_after" ]; then + source "$HOME/.env_bspwm_after" +fi diff --git a/de/bspwmrc b/de/bspwmrc new file mode 100755 index 0000000..414fb46 --- /dev/null +++ b/de/bspwmrc @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +if [[ -z "$XDG_CONFIG_HOME" ]]; then + export XDG_CONFIG_HOME="$HOME/.config" +fi +if [[ -z "$DOTFILES_PATH" ]]; then + export DOTFILES_PATH="$XDG_CONFIG_HOME/dotfiles" +fi + +BSPWM_STATE_FILE="$HOME/.bspwm_state" + +if [ -e "$BSPWM_STATE" ] ; then + bspc wm -l "$BSPWM_STATE" + rm "$BSPWM_STATE" +fi + +source "$DOTFILES_PATH/de/bspwm_config" + +if command -v urxvtd >/dev/null 2>&1; then + urxvtd & +fi + +if command -v sxhkd >/dev/null 2>&1; then + sxhkd & +fi + +bspc wm -o diff --git a/de/compton.conf b/de/compton.conf new file mode 100644 index 0000000..b0513f4 --- /dev/null +++ b/de/compton.conf @@ -0,0 +1,53 @@ +shadow = true; +no-dnd-shadow = true; +no-dock-shadow = false; +clearshadow = true; +shadow-radius = 7; +shadow-offset-x = -12; +shadow-offset-y = -7; +shadow-opacity = 1.0; +shadow-red = 0.0; +shadow-green = 0.0; +shadow-blue = 0.0; +shadow-exclude = [ "class_g = ''" ]; +shadow-ignore-shaped = true; +menu-opacity = 1.0; +inactive-opacity = 1.0; +active-opacity = 1.0; +frame-opacity = 1.0; +inactive-opacity-override = false; +alpha-step = 0.1; +inactive-dim = 0.1; +blur-kern = "3x3box"; +blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'" ]; +fading = true; +fade-in-step = 0.06; +fade-out-step = 0.06; +fade-exclude = [ ]; +backend = "xrender"; +mark-wmwin-focused = true; +mark-ovredir-focused = true; +detect-rounded-corners = true; +detect-client-opacity = true; +refresh-rate = 0; +vsync = "none"; +dbe = false; +paint-on-overlay = true; +focus-exclude = [ "class_g = 'Cairo-clock'" ]; +detect-transient = true; +detect-client-leader = true; +invert-color-include = [ ]; +glx-copy-from-front = false; +glx-swap-method = "undefined"; +wintypes : +{ + tooltip : + { + fade = true; + shadow = false; + opacity = 0.75; + focus = true; + }; +}; +blur-background = true; +blur-background-frame = true; diff --git a/de/gtk2rc b/de/gtk2rc new file mode 100644 index 0000000..54dd40d --- /dev/null +++ b/de/gtk2rc @@ -0,0 +1,3 @@ +gtk-icon-theme-name = "elementary" +gtk-theme-name = "Arc-Dark" +gtk-font-name = "Monaco 9" diff --git a/de/gtk3settings.ini b/de/gtk3settings.ini new file mode 100644 index 0000000..79142c0 --- /dev/null +++ b/de/gtk3settings.ini @@ -0,0 +1,4 @@ +[Settings] +gtk-icon-theme-name = elementary +gtk-theme-name = Arc-Dark +gtk-font-name = Monaco 9 diff --git a/de/link.bash b/de/link.bash new file mode 100755 index 0000000..24bb55e --- /dev/null +++ b/de/link.bash @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )/../.." && pwd) +source "$DIR/variables.bash" + +MODULE_PATH="$DOTFILES_PATH/env/x" + +mkdir -p "$HOME/.config/gtk-3.0" +rm -f "$HOME/.xinitrc" +rm -f "$HOME/.Xresources" +rm -f "$HOME/.gtkrc-2.0" +rm -f "$HOME/.config/gtk-3.0/settings.ini" +rm -f "$HOME/.config/compton.conf" +rm -f "$HOME/.xprofile" +ln -s "$MODULE_PATH/xinitrc" "$HOME/.xinitrc" +ln -s "$MODULE_PATH/xresources" "$HOME/.Xresources" +ln -s "$MODULE_PATH/gtk3settings.ini" "$HOME/.config/gtk-3.0/settings.ini" +ln -s "$MODULE_PATH/gtk2rc" "$HOME/.gtkrc-2.0" +ln -s "$MODULE_PATH/compton.conf" "$HOME/.config/compton.conf" +ln -s "$MODULE_PATH/xprofile" "$HOME/.xprofile" + +sudo mkdir -p /root/.gtk-3.0/ +sudo mkdir -p /root/.config/gtk-3.0/ +sudo rm -f "/root/.gtkrc-2.0" +sudo rm -f "/root/.gtk-3.0/settings.ini" +sudo rm -f "/root/.config/gtk-3.0/settings.ini" +sudo ln -s "$MODULE_PATH/gtk2rc" "/root/.gtkrc-2.0" +sudo ln -s "$MODULE_PATH/gtk3settings.ini" "/root/.gtk-3.0/settings.ini" +sudo ln -s "$MODULE_PATH/gtk3settings.ini" "/root/.config/gtk-3.0/settings.ini" + +sudo rm -f "/etc/udev/rules.d/90-usb-device-plugin.rules" +sudo ln -s "$MODULE_PATH/udev_rules/90-usb-device-plugin.rules" "/etc/udev/rules.d/90-usb-device-plugin.rules" + +source "$MODULE_PATH/xloadresources" + diff --git a/de/sxhkdrc b/de/sxhkdrc new file mode 100755 index 0000000..d2a13b3 --- /dev/null +++ b/de/sxhkdrc @@ -0,0 +1,231 @@ +# node manager shortcuts + +# focus the node for the given path jump +super + {p,b,comma,period} + bspc node -f @{parent,brother,first,second} + +# set modes to tiled/floating for current node +super + {s,f} + bspc node -t {tiled,floating} + +# set modes to pseudo_tiled/fullscreen for current node +super + shift + {s,f} + bspc node -t {pseudo_tiled,fullscreen -l above} + +# focus the last node/desktop +super + {grave,Tab} + bspc {node,desktop} -f last + +# focus the next floating node +super + ctrl + f + bspc node -f next.floating + +# swap positions with the previous node +super + apostrophe + bspc node -s last + +# swap the current node with the biggest node on the current desktop +super + m + bspc node -s biggest + +# move/swap between nodes using vim-style arrows +super + {_,shift + }{h,j,k,l} + bspc node -{f,s} {west,south,north,east} + +# swap previous/next desktops +super + bracket{left,right} + bspc desktop -f {prev,next} + +# preselect the splitting area for the current node +super + ctrl + {h,j,k,l} + bspc node -p {west,south,north,east} + +# clear the splitting area +super + ctrl + {_,shift + }space + bspc {node -p cancel,desktop -c} + +# expand the current node +super + alt + {h,j,k,l} + bspc node {@west -r -10,@south -r +10,@north -r -10,@east -r +10} + +# shrink the current node +super + alt + shift + {h,j,k,l} + bspc node {@east -r -10,@north -r +10,@south -r -10,@west -r +10} + +# set node split ratio +super + ctrl + {1-9,0} + bspc node -r 0.{1-9,10} + +# move a floating window very slowly +super + shift + {Left,Down,Up,Right} + xdo move {-x -1,-y +1,-y -1,-x +1} + +# move a floating window +super + {Left,Down,Up,Right} + xdo move {-x -20,-y +20,-y -20,-x +20} + +# focus/move node to the selected desktop +super + {_,shift + }{1-9,0} + bspc {desktop -f,node -d} ^{1-9,10} + +# focus clicked node +~button1 + bspc node -f pointed + +# mouse controls for node movement and resizing +super + button{1-3} + bspc pointer -g {move,resize_side,resize_corner} + +# simulate mouse2 +shift + super + button1 + bspc pointer -g resize_corner + +# ??? +super + !button{1-3} + bspc pointer -t %i %i + +# ??? +super + @button{1-3} + bspc pointer -u + +# change node gap and desktop padding +super + plus + bspc config -d focused window_gap $((`bspc config -d focused window_gap` + 5 )) + +super + equal + bspc config -m $(bspc query -M | head -n 1) top_padding $TOP_BAR_PADDING; bspc config -m $(bspc query -M | head -n 1) bottom_padding $BOTTOM_BAR_PADDING; bspc config -d focused window_gap $WINDOW_GAP + +super + minus + bspc config -d focused window_gap $((`bspc config -d focused window_gap` - 5 )) + +super + alt + r + bspc config -m $(bspc query -M | head -n 1) bottom_padding $BOTTOM_BAR_PADDING; bspc config -m $(bspc query -M | head -n 1) top_padding $TOP_BAR_PADDING; bspc config -d focused window_gap $WINDOW_GAP + +super + alt + equal + bspc config -d focused bottom_padding 0; bspc config -d focused top_padding 0; bspc config -d focused left_padding 0; bspc config -d focused right_padding 0 + +super + alt + plus + bspc config -d focused bottom_padding $(expr $(bspc config -d focused bottom_padding) + 5); bspc config -d focused top_padding $(expr $(bspc config -d focused top_padding) + 5); bspc config -d focused left_padding $(expr $(bspc config -d focused left_padding) + 5); bspc config -d focused right_padding $(expr $(bspc config -d focused right_padding) + 5) + +super + ctrl + alt + k + bspc config -d focused bottom_padding $(expr $(bspc config -d focused bottom_padding) - 5); bspc config -d focused top_padding $(expr $(bspc config -d focused top_padding) - 5) + +super + ctrl + alt + j + bspc config -d focused bottom_padding $(expr $(bspc config -d focused bottom_padding) + 5); bspc config -d focused top_padding $(expr $(bspc config -d focused top_padding) + 5) + +super + ctrl + alt + h + bspc config -d focused left_padding $(expr $(bspc config -d focused left_padding) - 5); bspc config -d focused right_padding $(expr $(bspc config -d focused right_padding) - 5) + +super + ctrl + alt + l + bspc config -d focused left_padding $(expr $(bspc config -d focused left_padding) + 5); bspc config -d focused right_padding $(expr $(bspc config -d focused right_padding) + 5) + +super + alt + plus + bspc config -d focused bottom_padding $(expr $(bspc config -d focused bottom_padding) + 5); bspc config -d focused top_padding $(expr $(bspc config -d focused top_padding) + 5); bspc config -d focused left_padding $(expr $(bspc config -d focused left_padding) + 5); bspc config -d focused right_padding $(expr $(bspc config -d focused right_padding) + 5) + +super + ctrl + alt + space + bspc config -d focused bottom_padding 200; bspc config -d focused top_padding 200; bspc config -d focused left_padding 400; bspc config -d focused right_padding 400 + + + +super + alt + minus + bspc config -d focused bottom_padding $(expr $(bspc config -d focused bottom_padding) - 5) + +# wm-independant shortcuts + +# spawn a transparent node +super + alt + t + urxvtc && compton-trans -c -o 0 + +# rotate the current node +super + r + bspc node -R 90 + +# balance the current node +super + shift + b + bspc node -B + +# make current node transparent +super + t + compton-trans -c -o 0 + +# make current node fully opaque +super + shift + t + compton-trans -c -o 100 + +# swap sxhkx config with an alternate file and reload the new one +# super + shift + alt + ctrl + r +# if [ -e ~/.config/sxhkd/altsxhkdrc ]; then mv ~/.config/sxhkd/sxhkdrc ~/.config/sxhkd/origsxhkdrc && mv ~/.config/sxhkd/altsxhkdrc ~/.config/sxhkd/sxhkdrc && pkill -USR1 -x sxhkd; fi + +# spawn a terminal +super + Return + urxvtc + +super + shift + Return + urxvtc -geometry 80x24; \ + bspc node -t floating + +# spawn the app launcher +super + space + rofi -show run -font "$PRIMARY_FONT_FAMILY $PRIMARY_FONT_SIZE" -lines 16 -width 10 -padding 8 -fuzzy -bw "$BORDER_WIDTH" -color-enabled -color-window "#$(get_color 00)","#$(get_color 0D)","#$(get_color 0D)","#$(get_color 00)" -color-normal "#$(get_color 00)","#$(get_color 06)","#$(get_color 00)","#$(get_color 0D)","#$(get_color 00)" -separator-style none -hide-scrollbar + +# lock the desktop +super + ctrl + shift + l + dm-tool lock + # $SHELL -c '$DOTFILES_PATH/env/x/screensaver/lock.sh' + +# spawn gui file explorer +super + e + thunar + +# volumes controls and media navigation for media keys +{_,shift + }XF86AudioLowerVolume + amixer -D pulse sset Master 5%- + + # pulseaudio-ctl lower + # ADJ={10,1} && amixer -c 1 sset Speaker $ADJ%- && amixer -c 1 sset Headphone $ADJ%- && amixer -c 1 sset Master $ADJ%- && update_bar_MasterVolume + +{_,shift + }XF86AudioRaiseVolume + amixer -D pulse sset Master 5%+ + + # pulseaudio-ctl raise + # ADJ={10,1} && amixer -c 1 sset Speaker $ADJ%+ && amixer -c 1 sset Headphone $ADJ%+ && amixer -c 1 sset Master $ADJ%+ && update_bar_MasterVolume + +XF86AudioMute + amixer -D pulse sset Master toggle + + # pulseaudio-ctl mute + # amixer -c 1 sset Master toggle && update_bar_MasterVolume + +XF86AudioPlay + mpc toggle + +XF86AudioNext + mpc next + +XF86AudioPrev + mpc prev + +# monitor brightness controls for monitor birghtness keys +{_,shift + }XF86MonBrightnessUp + add_percent_brightness {0.1,0.01} && update_bar_DisplayBrightness + +{_,shift + }XF86MonBrightnessDown + sub_percent_brightness {0.1,0.01} && update_bar_DisplayBrightness + +# close the current application +super + c + bspc node -c + +# kill the current application +super + shift + c + bspc node -k + +# kill the wm, if alt is held, it will reload instead of truly quitting... +# I think? +super + ctrl + {alt +,_} Escape + {bspc wm -d > "$BSPWM_STATE_FILE" && bspc quit, \ + bspc quit 1} + +# make sxhkd reload its configuration files: +super + Escape + pkill -USR1 -x sxhkd diff --git a/de/udev-rules/90-usb-device-plugin.rules b/de/udev-rules/90-usb-device-plugin.rules new file mode 100644 index 0000000..c2873e0 --- /dev/null +++ b/de/udev-rules/90-usb-device-plugin.rules @@ -0,0 +1 @@ +ACTION=="add", SUBSYSTEM=="usb_device", RUN+="xset r rate 300 80" diff --git a/de/wmstart b/de/wmstart new file mode 100755 index 0000000..5d244e9 --- /dev/null +++ b/de/wmstart @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# allows bspwm to reload when killed +while true; do + bspwm || break +done diff --git a/de/xinitrc b/de/xinitrc new file mode 100644 index 0000000..22d3334 --- /dev/null +++ b/de/xinitrc @@ -0,0 +1,30 @@ +#!/bin/sh + +# as far as I can tell, this file is only executed when you run startx from the +# TTY + +# load our xprofile +if [ -f "$HOME/.xprofile" ]; then + source "$HOME/.xprofile" +fi + +if [ -f "$HOME/.fehbg" ]; then + "$HOME/.fehbg" & +fi + +# allow a per-device config to override options +if [ -f "$HOME/.env_xinitrc" ]; then + source "$HOME/.env_xinitrc" +fi + +# launch optional and helpful apps +if command -v unclutter >/dev/null 2>&1; then + unclutter & +fi + +if command -v compton >/dev/null 2>&1; then + compton & +fi + +# fire up wm +exec "$DOTFILES_PATH/env/wm/wmstart" diff --git a/de/xloadresources b/de/xloadresources new file mode 100644 index 0000000..08d28ac --- /dev/null +++ b/de/xloadresources @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +userresources="$HOME/.Xresources" +usercolors="$HOME/.Xresources.colors" +userenv="$HOME/.Xresources.env" +usermodmap="$HOME/.Xmodmap" +sysresources="/etc/X11/xinit/.Xresources" +sysmodmap="/etc/X11/xinit/.Xmodmap" + +echo "xstartup: resources $userresources $userenv" >> "$HOME/.xstartup_log" + +if [ -f "$sysresources" ]; then + xrdb -merge "$sysresources" >/dev/null 2>&1 +fi + +if [ -f "$sysmodmap" ]; then + xmodmap "$sysmodmap" >/dev/null 2>&1 +fi + +if [ -f "$userresources" ]; then + xrdb -merge "$userresources" >/dev/null 2>&1 +fi + +if [ -f "$usercolors" ]; then + xrdb -merge "$usercolors" >/dev/null 2>&1 +fi + +if [ -f "$userenv" ]; then + xrdb -merge "$userenv" >/dev/null 2>&1 +fi + +if [ -f "$usermodmap" ]; then + xmodmap "$usermodmap" >/dev/null 2>&1 +fi + +if [ -d "/etc/X11/xinit/xinitrc.d" ] ; then + for f in "/etc/X11/xinit/xinitrc.d/?*.sh" ; do + [ -x "$f" ] && . "$f" + done + unset f +fi + diff --git a/de/xprofile b/de/xprofile new file mode 100644 index 0000000..ae3c350 --- /dev/null +++ b/de/xprofile @@ -0,0 +1,32 @@ +#!/bin/sh + +if [[ -z "$XDG_CONFIG_HOME" ]]; then + export XDG_CONFIG_HOME="$HOME/.config" +fi +if [[ -z "$DOTFILES_PATH" ]]; then + export DOTFILES_PATH="$XDG_CONFIG_HOME/dotfiles" +fi + +if [ -f "$DOTFILES_PATH/env/x/xloadresources" ]; then + source "$DOTFILES_PATH/env/x/xloadresources" +fi + +if [ -f "$DOTFILES_PATH/variables.bash" ]; then + source "$DOTFILES_PATH/variables.bash" +fi + +# keyrepeat settings +xset r rate 250 80 & + +# no screen blanking +# xset -dpms & +# xset s noblank & +# xset s off & + +if [ -d "/usr/lib/nvidia" ]; then + export LD_LIBRARY_PATH=/usr/lib/nvidia +fi + +if [ -f "$HOME/.env_xprofile" ]; then + source "$HOME/.env_xprofile" +fi diff --git a/de/xresources b/de/xresources new file mode 100755 index 0000000..9618f0f --- /dev/null +++ b/de/xresources @@ -0,0 +1,23 @@ +*font: xft:xos4 Terminus-10 +*faceName: xft:xos4 Terminus-10 +*boldFont: xft:xos4 Terminus-10 +*letterSpace: 0 +*scrollBar: false +*cursorUnderline: true +*cursorBlink: true +*termName: rxvt-unicode +*intensityStyles: true +*utf8: 2 +*scaleHeight: 1 + +*depth: 32 + +URxvt.internalBorder: 24 + +Xcursor.theme: human + +URxvt.perl-ext-common: default,matcher,keyboard-select +URxvt.keysym.M-Escape: perl:keyboard-select:activate +URxvt.url-launcher: /usr/bin/xdg-open +URxvt.matcher.button: 1 +URxvt*iso14755: False diff --git a/readme.md b/readme.md index 49f307a..14d7169 100644 --- a/readme.md +++ b/readme.md @@ -25,6 +25,7 @@ out in order of priority here: multiple machines with specific use-cases. For example, a shared laptop should allow for other non-technical users ease-of-access, while my workstation should focus on being quick, powerful, and highly usable for me alone. +* The only dependencies should be `git` and `bash` for the very basics. ## Applications diff --git a/setup b/setup new file mode 100755 index 0000000..49cca28 --- /dev/null +++ b/setup @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +if [[ -z "$XDG_CONFIG_HOME" ]]; then + export XDG_CONFIG_HOME="$HOME/.config" +fi + +dfp=$(cd "$(dirname "${BASH_SOURCE[0]}" )/" && pwd) + +ALERT_AGREEMENT_FILE="$dfp/.agreed-to-erasing-files.lock" + +# Let user know that this script will delete their current configuration and +# that they should read this script before running. We'll use a lock file so +# the user only needs to agree once. +if [ -f "$ALERT_AGREEMENT_FILE" ]; then + # User agreed already - do nothing + echo "Linking..." +else + echo "Running this script may delete existing personal configuration files." + echo "Please view this script's source, fully understand it, and backup any" + echo "files before continuing." + echo "Seriously. Like... entire directories. Just gone." + read -r -p "Are you sure you want to continue? [y/N] " response + response=${response,,} # to lower case + if [[ $response =~ ^(yes|y)$ ]]; then + echo "agreed" > "$ALERT_AGREEMENT_FILE" + else + exit 1 + fi +fi + +links=( + # desktop environment files + "$dfp/de/bspwmrc" "$XDG_CONFIG_HOME/bspwm/bspwmrc" + "$dfp/de/sxhkdrc" "$XDG_CONFIG_HOME/sxhkd/sxhkdrc" + + # shell files + "$dfp/shell/bashrc" "$HOME/.bashrc" + "$dfp/shell/bash_profile" "$HOME/.bash_profile" + "$dfp/shell/tmux.conf" "$HOME/.tmux.conf" + "$dfp/shell/tmux-layouts" "$HOME/.tmux/layouts" +) + +source="" +for i in "${links[@]}"; do + # ls -la --color=auto "$i" + if [ -n "$source" ]; then + if [ -L "$i" ]; then # if symlink exists, delete it + rm -rf "$i" + fi + if [ -f "$i" ]; then # if file exists, delete it + rm -rf "$i" + fi + # NOTE: maybe warn user again? + if [ -d "$i" ]; then # if directory exists, delete it + rm -rf "$i" + fi + ln -s "$source" "$i" + echo "Linked $source to $i." + source="" + else + source="$i" + fi +done + +echo "Done." diff --git a/shell/aliases b/shell/aliases new file mode 100644 index 0000000..089e40d --- /dev/null +++ b/shell/aliases @@ -0,0 +1,109 @@ +#!/usr/bin/env bash + +# set our needed variables if we don't already have them +if [[ -z "$XDG_CONFIG_HOME" ]]; then + export XDG_CONFIG_HOME="$HOME/.config" +fi +if [[ -z "$DOTFILES_PATH" ]]; then + export DOTFILES_PATH="$XDG_CONFIG_HOME/dotfiles" +fi + +# filesystem aliases +alias lx='ls -lXB' # order by filetype +alias lk='ls -lSr' # order by filesize reversed +alias lt='ls -ltr' # order by file modified time +alias lc='ls -ltcr' # order by filectime +alias lu='ls -ltur' # order by file access time +alias ls='ls -h --color --group-directories-first' # flat view w/ directories first +alias l='ls -h --color --group-directories-first' # same as above +alias ll='ls -lv --group-directories-first' # non-flat view +alias lm='ll | more' +alias lr='ll -R' # please don't - why is this even here...? +alias la='ll -A' # show all +alias tree='tree -Csuh' + +# navigation aliases +alias c="cd $HOME/.." +alias cd..="cd .." +alias cdd="cd \"$DOTFILES_PATH\"" # go to dotfiles +alias cdc="cd \"$XDG_CONFIG_HOME\"" # go to + +# quick parent-directory aliases +alias ..="cd .." +alias ...="cd ../.." +alias ....="cd ../../.." +alias .....="cd ../../../.." +alias ......="cd ../../../../.." +alias .......="cd ../../../../../.." +alias ........="cd ../../../../../../.." +alias .........="cd ../../../../../../../.." + +# tmux aliases +# TODO: see if this can be worked around? +alias tmux='TERM=screen-256color-bce tmux' # syntax higlighting for vim in tmux +alias tmnew="tmux new -s" +alias tmls="tmux list-sessions" +alias tmatt="tmux attach -t" +alias tu="tmux attach -t utils || tmux new -s utils" +alias tdf="tmux attach -t df || tmux new -s df -c \"$DOTFILES_PATH\"" + +# git aliases +alias gs="git status" +alias gl="git log" +alias gpl="git pull" +alias gp="git push" +alias gac="git add -A && git commit -m" + +# browser aliases +alias qute="qutebrowser --backend webengine" + +# networking aliases +alias p="ping 8.8.8.8" + +# start netctl using any available profile on the first wireless network +# interface +# TODO: flesh this out into a function that lets the user know what's going on. +alias wifi="sudo systemctl start netctl-auto@$(for wli in /sys/class/net/wl*; do echo $(basename $wli); break; done)" + +# misc aliases +alias setbg="feh --bg-fill" +alias C="clear" +alias keyrepeat="xset r rate 250 80" + +# games aliases +# this sometimes fixes steam dynamic library issues? +# alias steam="LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /usr/$LIB/libxcb.so.1 /usr/$LIB/libgpg-error.so' steam" + +# text editor aliases + +# man pages with vim +vman() { + # our vim config is setup to not auto-load sessions if we set the + # `asmanviewer` variable, so launch vim that way when using vim as our man + # page viewer + if command -v nvim >/dev/null 2>&1; then + nvim --cmd "let asmanviewer=1" -c "SuperMan $*" + else + vim --cmd "let asmanviewer=1" -c "SuperMan $*" + fi + + # proper error handling + if [ "$?" != "0" ]; then + echo "No manual entry for $*" + fi +} +# override the man commands +alias _man="\\man" +alias man="vman" + +# set our EDITOR to neovim if we've got it +export EDITOR="vim" +if command -v nvim >/dev/null 2>&1; then + alias vim="nvim" + alias ovim="\\vim" + export EDITOR="nvim" +fi + +# arch aliases +# TODO: load os-specific aliases based on running OS +alias archupdate="pacaur -Syyu --noconfirm --noedit" diff --git a/shell/autocompletions b/shell/autocompletions new file mode 100644 index 0000000..593f0f5 --- /dev/null +++ b/shell/autocompletions @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# autocompletions +complete -cf sudo +complete -cf man diff --git a/shell/bash_profile b/shell/bash_profile new file mode 100644 index 0000000..faf3831 --- /dev/null +++ b/shell/bash_profile @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# bash_profile is executed immediately after logging in + +if [ -f ~/.bashrc ]; then + source ~/.bashrc +fi diff --git a/shell/bashrc b/shell/bashrc new file mode 100644 index 0000000..9af4e30 --- /dev/null +++ b/shell/bashrc @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# bashrc is executed when a bash process starts + +export XDG_CONFIG_HOME="$HOME/.config" +export DOTFILES_PATH="$XDG_CONFIG_HOME/dotfiles" +export NICE_HOME="$HOME/.." + +# load our terminal colors +# TODO: update with new system +BASE16_SHELL="$DOTFILES_PATH/common/colors/shell" +[[ -s "$BASE16_SHELL" ]] && source "$BASE16_SHELL" + +# stop parsing on a non-interactive shell +[ -z "$PS1" ] && return + +# disable ctrl-s terminal freeze +[[ $- == *i* ]] && stty -ixon + +# import our aliases +source "$DOTFILES_PATH/shell/aliases" + +# import our global shell functions +source "$DOTFILES_PATH/shell/shell_funcs" + +# import our prompt +source "$DOTFILES_PATH/shell/prompt" + +# import our autocompletions +source "$DOTFILES_PATH/shell/autocompletions" + +# load our key binds +bind -f "$DOTFILES_PATH/shell/inputrc" + +# prevents binds or commands pulling from history from insta-sending, and +# instead places them in the readline for editing +shopt -s histverify + +# prevents some Java GUI apps from not working or rendering properly due to +# using bspwm +export _JAVA_AWT_WM_NONREPARENTING=1 + +# load a per-device config last so anything can be overridden +if [ -a "$HOME/.env_bashrc" ]; then + source "$HOME/.env_bashrc" +fi + +# we assume the user uses "$HOME" to just store their mess of dotfiles and other +# nonsense that clutters it up and that they have a preferred starting +# directory where they keep the stuff they actually care about +# we only do this if the user is opening a shell at $HOME +if [ "$PWD" = "$HOME" ]; then + cd "$NICE_HOME" +fi diff --git a/shell/inputrc b/shell/inputrc new file mode 100644 index 0000000..d10bc82 --- /dev/null +++ b/shell/inputrc @@ -0,0 +1,7 @@ +"\eOd": backward-word +"\eOc": forward-word +"\C-p": history-search-backward +"\C-n": history-search-forward +"\C-a": beginning-of-line +"\C-e": end-of-line +"\C-d": delete-char diff --git a/shell/link.bash b/shell/link.bash new file mode 100755 index 0000000..3267920 --- /dev/null +++ b/shell/link.bash @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# TODO: all symlinks in one place? + +DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )/../.." && pwd) +source $DIR/variables.bash + +mkdir -p "$HOME/.tmux/layouts" + +MODULE_PATH="$DOTFILES_PATH/env/sh" + +rm -f "$HOME/.bashrc" +rm -f "$HOME/.bash_profile" +rm -f "$HOME/.tmux.conf" +rm -f "$HOME/.tmux/layouts/dev.tmux" +# rm -f "$HOME/.inputrc" # now loaded separately +ln -s "$MODULE_PATH/bashrc" "$HOME/.bashrc" +ln -s "$MODULE_PATH/bash_profile" "$HOME/.bash_profile" +ln -s "$MODULE_PATH/tmux.conf" "$HOME/.tmux.conf" +ln -s "$MODULE_PATH/tmux-layouts/" "$HOME/.tmux/layouts/" +# ln -s "$MODULE_PATH/inputrc" "$HOME/.inputrc" # now loaded by bashrc +# separately + +sed -i "/export DOTFILES_PATH/c export DOTFILES_PATH=\"$DIR\"" "$HOME/.bashrc" + +echo "You should re-source ~/.bashrc ;)" diff --git a/shell/prompt b/shell/prompt new file mode 100644 index 0000000..1f282b8 --- /dev/null +++ b/shell/prompt @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +COLOR_RESET='\[\e[0m\]' +PROMPT_SUCCESS_COLOR='\[\e[0;34m\]' +PROMPT_FAILURE_COLOR='\[\e[0;31m\]' +DIR_COLOR='\[\e[0;33m\]' + +# prompt rendering functions +preprocess_pwd() { + name="$PWD" + # if we're in the home directory, replace it with tilde + [[ "$name" =~ ^"$NICE_HOME"(/|$) ]] && name="~${name#$NICE_HOME}" + + # replace all non-basename parts of the PWD with only the first two letters + curdir=$(echo "$PWD" | sed -r 's|.*/(.+)$|\1|g') + name=$(echo "$name" | sed -r 's|/(..)[^/]*|/\1|g' | sed -r 's|(.*/)(.+)$|\1|g') + + # if we're just in the home directory, don't show any path stuff + [[ "$name" == "~" ]] && curdir="" + + # return our transformed PWD + echo "$name$curdir" +} +export -f "preprocess_pwd" + +prompt_command_func() +{ + RET=$? + # set the color of the user and host based on the result of the previous + # command + if [ $RET -eq 0 ]; then + STATUS_COLOR=$PROMPT_SUCCESS_COLOR + else + STATUS_COLOR=$PROMPT_FAILURE_COLOR + fi; + PS1="$STATUS_COLOR\u@\h$COLOR_RESET $DIR_COLOR$(eval "preprocess_pwd")$COLOR_RESET " +} +export -f "prompt_command_func" +export PROMPT_COMMAND="prompt_command_func" + + diff --git a/shell/shell_funcs b/shell/shell_funcs new file mode 100644 index 0000000..f87b649 --- /dev/null +++ b/shell/shell_funcs @@ -0,0 +1,74 @@ +#!/usr/bin/env bash + +calc() { + tp="$@" + python -c "print($tp)" +} +export -f calc + +stopbar() { + if [[ -f "$BAR_PID_FILE" ]]; then + kill -SIGTERM $(cat "$BAR_PID_FILE") + kill -SIGTERM $(cat "$BAR_PID_FILE"*.pid) + kill -SIGTERM $(cat "$BAR_PATH"/modules/*.pid) + rm -f "$BAR_PID_FILE" + rm "$BAR_PID_FILE"*.pid + rm "$BAR_PATH"/modules/*.pid + else + echo "Bar is not running." + fi +} +export -f stopbar + +# wm aliases +startbar() { + if [[ -f "$BAR_PID_FILE" ]]; then + stopbar + fi + "$BAR_PATH/start.bash" & + BAR_PID=$! + echo "$BAR_PID" > "$BAR_PID_FILE" + kill -CONT "$BAR_PID" + # bg + # disown + + # lower the bar's layer so fullscreen windows cover it + wid=$(xdo id -a "$BAR_WID") + tries=20 + while [ -z "$wid" -a "$tries" -gt 0 ]; do + sleep 0.1 + wid=$(xdo id -a "$BAR_WID") + tries=$((tries - 1)) + echo "WID $wid" + done + [ -n "$wid" ] && xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid" + + fg +} +export -f startbar + +# save the current directory for later retrieval +scwd() { + addon="" + if [[ -n $1 ]]; then + addon="-$1" + fi + echo "$PWD" > "$DOTFILES_PATH/env/sh/cwd$addon.tmp" +} +export -f scwd +bind '"\C-s"':"\"scwd\C-m\"" + +# go to the saved current directory +gcwd() { + addon="" + if [[ -n $1 ]]; then + addon="-$1" + fi + cd "$(cat "$DOTFILES_PATH/env/sh/cwd$addon.tmp")" +} +export -f gcwd +bind '"\C-g"':"\"gcwd\C-m\"" + +# close a terminal with Ctrl-Shift-D (in theory) +bind '"\C-D"':"\"\C-c\C-d\"" + diff --git a/shell/tmux-layouts/dev.tmux b/shell/tmux-layouts/dev.tmux new file mode 100644 index 0000000..bc44a9e --- /dev/null +++ b/shell/tmux-layouts/dev.tmux @@ -0,0 +1,5 @@ +splitw -h -p 50 +splitw -v -p 67 +splitw -v -p 50 +resize-pane -x 100 +selectp -L diff --git a/shell/tmux.conf b/shell/tmux.conf new file mode 100644 index 0000000..6ae8c27 --- /dev/null +++ b/shell/tmux.conf @@ -0,0 +1,76 @@ +# ^s as prefix +unbind C-b +set -g prefix C-s +bind-key s send-prefix + +# statusbar on bottom +set-option -g status-position bottom + +# honestly not sure +set -g escape-time 10 +setw -g monitor-activity on + +# hide tmux status bar by default (prefix H toggles) +set -g status off + +bind-key W resize-pane -x 100 + +# splitting +bind-key v split-window -h +bind-key b split-window + +# be xterm +set -g default-terminal "xterm" + +# iterating +bind r source-file ~/.tmux.conf + +# toggle status bar +bind-key H set status + +# vim copying +setw -g mode-keys vi +bind-key -t vi-copy 'v' begin-selection +bind-key -t vi-copy 'y' copy-selection + +# 1-based indexing for keystroke simplicity +set -g base-index 1 +set -g pane-base-index 1 + +# custom predefined layouts +bind M-l source-file ~/.tmux/layouts/dev.tmux + +# mimic pane switching in and out of vim +is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"' +bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" +bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" +bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" +bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" +bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" + +# present a menu of urls to open from the visible pane +bind-key u capture-pane \;\ + save-buffer /tmp/tmux-buffer \;\ + split-window -l 10 "urlview /tmp/tmux-buffer" + +# list of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @plugin 'tmux-plugins/tmux-continuum' +set -g @plugin 'tmux-plugins/tmux-yank' +set -g @plugin 'tmux-plugins/tmux-copycat' +set -g @plugin 'tmux-plugins/tmux-sessionist' + +# plugin options + +# enable continuum +set -g @continuum-restore 'off' + +# let continuum startup on boot +set -g @continuum-boot 'on' + +# initialize tmux plugin manager +run '~/.tmux/plugins/tpm/tpm' + +unbind-key C-p