Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

README.org

dotfiles

A collection of literate programming dotfiles created and maintained in Emacs with Org mode.

Prerequisites

mkdir -p ~/.bashrc.d/secret
# TODO: fix the fact that something below this needs a file to exist in the secrets dir
mkdir -p ~/.ssh/config

Build Configuration Files

Open this Org document in Emacs and tangle it (C-c C-v t). Configuration files, e.g., .bashrc, will be generated.

Shell

Change Default Shell

For MacOS this should be the Homebrew installed bash not the system bash path.

chsh -s /usr/local/bin/bash
export SHELL=/usr/local/bin/bash
echo ${SHELL}

On MacOS:

sudo dscl . -create ${HOME} UserShell /usr/local/bin/bash
dscl . -read ${HOME} UserShell

Make the Bash configuration directory:

mkdir -p "${HOME}/.bashrc.d"

.inputrc

set bell-style none
set colored-completion-prefix on
set colored-stats on
set completion-ignore-case off
set convert-meta off
set expand-tilde on
set input-meta on
set output-meta on
set show-all-if-ambiguous on
set visible-stats on

.bash_profile

source "${HOME}/.bashrc"

.bashrc

Load all configuration:

for f in "${HOME}/.bashrc.d/"*.bash; do
    source "${f}"
done
unset -v config

Custom

Interactive shell options.

Secret Information

Define a directory to keep secret information in. Make sure that it exists in =.gitignore=.

export K20E_SECRET_HOME=${HOME}/.bashrc.d/secret

Create it if necessary.

mkdir -p ${K20E_SECRET_HOME}

Adjust permissions.

chmod 0700 ${K20E_SECRET_HOME}
chmod -Rf 0600 ${K20E_SECRET_HOME}/*.sh

Define files to source in the following sections.

export K20E_SECRET_VARIABLES=${K20E_SECRET_HOME}/variables.sh
export K20E_SECRET_ALIASES=${K20E_SECRET_HOME}/aliases.sh
export K20E_SECRET_PATH=${K20E_SECRET_HOME}/path.sh
export K20E_SECRET_FUNCTIONS=${K20E_SECRET_HOME}/functions.sh

Options

shopt -s \
      autocd \
      cdspell \
      checkjobs \
      checkwinsize \
      dirspell \
      no_empty_cmd_completion

Variables

Bash variables.

LANG=en_US.UTF-8

HISTSIZE=100000
HISTCONTROL=erasedups
HISTTIMEFORMAT='%F %T '

Base variables that I use to organize the file system.

export CODE_HOME=${HOME}/Code
export GOOGLE=${HOME}/Google

File system variables.

   export CARGO_HOME=${HOME}/.cargo

   # https://github.com/rust-lang-nursery/rustfmt#tips
   if [[ -x ${CARGO_HOME}/bin/rustc ]]; then
	  export DYLD_LIBRARY_PATH=$(${CARGO_HOME}/bin/rustc --print sysroot)/lib:${DYLD_LIBRARY_PATH}
   fi

   export GROOVY_HOME=/usr/local/opt/groovy/libexec
   export VLC_HOME=/Applications/VLC.app/Contents/MacOS

   export DESKTOP=${HOME}/Desktop
   export DOWNLOADS=${HOME}/Downloads
   export GOPATH=${HOME}/go
   export GOROOT=/usr/local/opt/go/libexec

   if [[ "$OSTYPE" == darwin* ]]; then
	  export HOMEBREW_CASK_HOME=/usr/local/Caskroom
	  export HOMEBREW_CELLAR=$(/usr/local/bin/brew --cellar)
	  export HOMEBREW_INSTALL_CLEANUP=1
   fi    

   export JENV_HOME=${HOME}/.jenv

   export MANPATH=/usr/local/share/man:${MANPATH}
   export NODE_PATH=/usr/local/lib/node_modules:${NODE_PATH}

Non file system variables.

export EDITOR=emacsclient
export EMACS_VERSION="HEAD"
export LANG=en_US.UTF-8
export TERM=xterm-256color

… use the -u/--unquoted option to specify that any result that is a string will be printed without quotes. … If this is a common enough occurance for you, you can set the JP_UNQUOTED environment variable to make this the default behavior

https://github.com/jmespath/jp

export JP_UNQUOTED=true
if [ -f ${K20E_SECRET_VARIABLES} ]; then
    source ${K20E_SECRET_VARIABLES}
fi

CDPATH

The cdpath variable sets the search path for the cd command. If you do not specify . somewhere in the path, it is assumed to be the first component.

export CDPATH="${CODE_HOME}:${GOOGLE}"

PATH

pathmunge () {
    case ":${PATH}:" in
        *:"$1":*)
            ;;
        *)
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
            else
                PATH=$1:$PATH
            fi
    esac
}
   pathmunge /usr/local/opt/python/libexec/bin
   pathmunge "${JENV_HOME}/bin"
   pathmunge /usr/local/sbin
   pathmunge /usr/local/bin
   pathmunge "${HOME}/bin"
   pathmunge "${CARGO_HOME}/bin"
   pathmunge "${GOPATH}/bin"
   pathmunge "${GOROOT}/bin"
   pathmunge "${VLC_HOME}"

   if [[ "$OSTYPE" == darwin* ]]; then
	  pathmunge "$(/usr/local/bin/brew --prefix git)/share/git-core/contrib/diff-highlight"
   fi

   if [[ -x /usr/share/doc/git/contrib/diff-highlight ]]; then
	  pathmunge /usr/share/doc/git/contrib/diff-highlight
   fi
if [ -f ${K20E_SECRET_PATH} ]; then
    source ${K20E_SECRET_PATH}
fi

jEnv

For managing multiple Java installations.

   if [[ -x jenv ]]; then
	  eval "$(jenv init -)"
   fi

PYTHON_USER_BASE

Add Python site.USER_BASE for user site-packages and pip install --user installations.

export PYTHON_USER_BASE=$(python -m site --user-base)
pathmunge "${PYTHON_USER_BASE}/bin"

PROMPT_COMMAND

[ -e /usr/local/etc/bash_completion.d/git-prompt.sh ] && source /usr/local/etc/bash_completion.d/git-prompt.sh

GIT_PS1_SHOWCOLORHINTS=1
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
function k20e_working_directory() {
    declare -r YELLOW='\[\e[0;33m\]'
    declare -r RESET='\[\e[0m\]'
    echo "${YELLOW}\w${RESET}"
}
function k20e_virtual_env() {
    declare -r BLUE='\[\e[0;34m\]'
    declare -r YELLOW='\[\e[0;33m\]'
    declare -r RESET='\[\e[0m\]'
    declare -r PREFIX="${BLUE}p${YELLOW}y${RESET} "
    declare -r SUFFIX=" ${RESET}"
    local value=''
    if [ -n "${VIRTUAL_ENV}" ] && [ -d "${VIRTUAL_ENV}" ]; then
        value=$(basename "${VIRTUAL_ENV}")
        value="${PREFIX}${value}${SUFFIX}"
    fi
    echo "${value}"
}
function k20e_gcp_project() {
    declare -r BLUE='\[\e[0;34m\]'
    declare -r RED='\[\e[0;31m\]'
    declare -r RED_BG='\[\e[0;41m\]'
    declare -r YELLOW='\[\e[0;33m\]'
    declare -r RESET='\[\e[0m\]'
    declare -r PREFIX="${BLUE}g${RED}c${YELLOW}p${RESET} "
    declare -r SUFFIX="${RESET} "
    local value=''
    if [ -e ${HOME}/.config/gcloud/active_config ]; then
        value=$(cat ${HOME}/.config/gcloud/active_config)
        if [[ "${value}" =~ .*prod.* ]]; then
            value="${RED_BG}${value}"
        fi
        value="${PREFIX}${value}${SUFFIX}"
    fi
    echo "${value}"
}
function k20e_kubectx() {
    declare -r BLUE='\[\e[0;34m\]'
    declare -r RED_BG='\[\e[0;41m\]'
    declare -r RESET='\[\e[0m\]'
    declare -r PREFIX="${BLUE}k8s${RESET} "
    declare -r SUFFIX="${RESET} "
    local value=''
    if [ -e ${HOME}/.kube/config ]; then
        value=$(cat ${HOME}/.kube/config | grep current-context | cut -d ' ' -f 2)
        fullname=${value}
        if [[ "${value}" =~ ^gke_ ]]; then
            value=$(echo "${value}" | cut -d _ -f 4)
        fi
        value="${value}${RESET}·$(kubectl config view -o=jsonpath="{.contexts[?(@.name==\"${fullname}\")].context.namespace}")"
        if [[ "${value}" =~ .*prod.* ]]; then
            value="${RED_BG}${value}"
        fi
        value="${PREFIX}${value}${SUFFIX}"
    fi
    echo "${value}"
}

For Ubuntu, I had to copy git-prompt.sh to /usr/share/bash-completion/completions/.

[ -e /usr/share/bash-completion/completions/git-prompt.sh ] && source /usr/share/bash-completion/completions/git-prompt.sh

PROMPT_COMMAND='__git_ps1 \
"\n$(k20e_gcp_project)$(k20e_kubectx)$(k20e_virtual_env)\n$(k20e_working_directory)" \
"\n\$ " \
" %s"'

Aliases

alias ..="cd ../"
alias ...="cd ../../"
alias ....="cd ../../.."
alias brewdump="brew bundle dump --force --global --verbose && pbcopy < ${HOME}/.Brewfile"
alias dirs="dirs -v"
alias emacs="/usr/local/bin/emacs --no-window-system"
alias emacsclient="/usr/local/bin/emacsclient --no-wait"
alias ec="emacsclient"
alias g="git"
alias j="jobs -l"
alias k="kubectl"
alias l.l='ls -1A | grep "^\." | xargs ls -lhGF'
alias ll="ls --color=always -lhF"
alias lll="ll --color=always"
alias ls="ls --color=always -GF"
alias l="ls --color=always"
alias top="top -ocpu -Orsize"
alias tree="tree -C"
if [ -f ${K20E_SECRET_ALIASES} ]; then
    source ${K20E_SECRET_ALIASES}
fi

ssh TERM

My Emacs multi-term with bash has TERM=xterm-256color. On many remote hosts, primarily Amazon Linux, any xterm sets PROMPT_COMMAND and garbles the prompt by attempting to set the window title. /etc/bashrc usually contains something like this:

if [ -z "$PROMPT_COMMAND" ]; then
  case $TERM in
  xterm*)
      if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
          PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
      else
          PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
      fi
      ;;
  screen)
      if [ -e /etc/sysconfig/bash-prompt-screen ]; then
          PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
      else
          PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
      fi
      ;;
  *)
      [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
      ;;
    esac
fi

Hacking that to some other reasonable value avoids prompt garbling and muscle memory typing unset PROMPT_COMMAND.

alias ssh="TERM=ansi ssh"

Completions

[ -e /usr/local/share/bash-completion/bash_completion ] && source /usr/local/share/bash-completion/bash_completion

ag

[ -e /usr/local/etc/bash_completion.d/ag.bashcomp.sh ] && source /usr/local/etc/bash_completion.d/ag.bashcomp.sh

kubectl, k, kctx, kns

[ -e /usr/local/etc/bash_completion.d/kubectl ] && source /usr/local/etc/bash_completion.d/kubectl

Add completion for my k alias:

complete -o default -F __start_kubectl k

Install kubectx (via =${HOME}/.Brewfile=), completion for helper tools kctx, kns:

[ -e /usr/local/etc/bash_completion.d/kubectx ] && source /usr/local/etc/bash_completion.d/kubectx && alias kctx="kubectx"
[ -e /usr/local/etc/bash_completion.d/kubens ] && source /usr/local/etc/bash_completion.d/kubens && alias kns="kubens"

Change currently selected color:

export KUBECTX_CURRENT_FGCOLOR=$(tput setaf 2)

Git

[ -e /usr/local/etc/bash_completion.d/git-completion.bash ] && source /usr/local/etc/bash_completion.d/git-completion.bash
[ -e /usr/share/bash-completion/completions/git ] && source /usr/share/bash-completion/completions/git

Add completion for my muscle memory alias of g for git:

__git_complete g __git_main

Gradle

[ -e /usr/local/etc/bash_completion.d/gradle-completion.bash ] && source /usr/local/etc/bash_completion.d/gradle-completion.bash

pip

   if [[ -x pip ]]; then
	   eval "$(pip completion --bash)"
   fi

Functions

if [ -f ${K20E_SECRET_FUNCTIONS} ]; then
    source ${K20E_SECRET_FUNCTIONS}
fi

Google Cloud SDK

Completion:

[ -e ${HOMEBREW_CASK_HOME}/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc ] && source ${HOMEBREW_CASK_HOME}/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc
[ -e ${HOMEBREW_CASK_HOME}/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc ] && source ${HOMEBREW_CASK_HOME}/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc

Python

function k20e-pip-upgrade() {
    if [[ $(which deactivate) == "deactivate: function" && -n ${VIRTUAL_ENV} ]]; then
        echo "Deactivating current virtual environment ${VIRTUAL_ENV}"
        deactivate
    fi
    pip install --user --upgrade --requirement ${HOME}/requirements-to-freeze.txt
    pip freeze > ${HOME}/requirements.txt
}

terminal-notifier

if [ -e "/Applications/terminal-notifier.app" ]; then
    alias notify="/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier"
fi

Git

.gitconfig

[user]
      name = Kris
      email = krismolendyke@users.noreply.github.com
      useconfigonly = true
[color]
      ui = auto
[core]
      excludesfile = ~/.gitignore-global
      whitespace = -trailing-space,-space-before-tab
      editor = emacsclient
[credential]
      helper = osxkeychain
[apply]
      whitespace = nowarn
[alias]
      diff = diff --color-moved
      stache = stash
      st = status -sb
      a = add -p
      l = log --color-moved --stat --no-merges
      lp = log --color-moved --patch --stat --no-merges
      wlp = log --color-moved --patch --stat --color-words --no-merges
      lo = log --color-moved --oneline --decorate --no-merges
      lf = log --color-moved --pretty=format: --name-only -z --max-count 1 --no-merges
      co = checkout
      br = branch -vv
      wdiff = diff --color-moved --color-words
      ds = diff --color-moved --staged
[advice]
      statusHints = true
[rebase]
      autosquash = true
[diff]
      algorithm = histogram
      compactionHeuristic = 1
      colorMoved = zebra
[help]
      autocorrect = 1
[pager]
      diff = diff-highlight | less
      log = diff-highlight | less
      show = diff-highlight | less
[interactive]
      diffFilter = diff-highlight

.gitignore-global

# -*- mode: gitignore; -*-

##########################################################################
# Below from:                                                            #
#                                                                        #
# https://github.com/github/gitignore/blob/master/Global/macOS.gitignore #
##########################################################################

.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


##############################################################################
# Below from:                                                                #
#                                                                            #
# https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore #
##############################################################################

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn.  Uncomment if using
# auto-import.
.idea/modules.xml
.idea/*.iml
.idea/modules

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

Python

See also Python functions.

requirements-to-freeze.txt

Use A Better Pip Workflow™ to specify packages that I do actually want installed to the user’s packages.

# User packages
http-prompt
keyring
pipdeptree[graphviz]
twine
virtualenvwrapper

Homebrew

brew doesn’t have a great way to manage dependencies that I’ve found outside of a Brewfile and the bundle subcommand.

Security

From https://www.davd.eu/securing-macos/#homebrew

export HOMEBREW_NO_INSECURE_REDIRECT=1
export HOMEBREW_CASK_OPTS=--require-sha

Bundle

Install:

brew tap Homebrew/bundle

Programs currently installed by brew can be dumped to a global Brewfile, which defaults to ${HOME}/.Brewfile:

brew bundle dump --force --global --verbose

Install all programs specified in the global ${HOME}./Brewfile:

brew bundle --global

${HOME}/.Brewfile

tap "crisidev/chunkwm"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-drivers"
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "homebrew/services"
tap "jmespath/jmespath"
tap "koekeishiya/formulae"
cask "java"
cask "xquartz"
cask "java8"
brew "apr"
brew "openssl"
brew "apr-util"
brew "aspell"
brew "automake"
brew "bash"
brew "bash-completion@2"
brew "bison"
brew "freetype"
brew "fontconfig"
brew "font-input"
brew "gettext", link: true
brew "pixman"
brew "cairo"
brew "emacs", args: ["HEAD", "with-cocoa"]
brew "cask"
brew "chicken"
brew "cmake"
brew "docker-completion"
brew "faac"
brew "lame"
brew "xvid"
brew "ffmpeg"
brew "flex"
brew "gawk"
brew "gcc"
brew "gd"
brew "gdk-pixbuf"
brew "gdub"
brew "gflags"
brew "git"
brew "go"
brew "python"
brew "gprof2dot"
brew "gradle"
brew "grafana"
brew "groovy"
brew "harfbuzz"
brew "hugo"
brew "hunspell"
brew "imagemagick"
brew "influxdb"
brew "ipcalc"
brew "ispell"
brew "jenv"
brew "jid"
brew "kafka"
brew "lz4"
brew "kafkacat"
brew "kotlin"
brew "kubernetes-cli"
brew "kubectx", args: ["with-short-names"]
brew "less"
brew "libav"
brew "libcroco"
brew "libdvdcss"
brew "librsvg"
brew "libssh"
brew "libyaml"
brew "make"
brew "makedepend"
brew "mariadb"
brew "mas"
brew "maven"
brew "ninja"
brew "node"
brew "oniguruma"
brew "parallel"
brew "perl"
brew "protobuf"
brew "prototool"
brew "pstree"
brew "pv"
brew "rocksdb"
brew "ruby", link: true
brew "rustup-init"
brew "scons"
brew "shared-mime-info"
brew "shellcheck"
brew "sshtrix"
brew "subversion"
brew "terminal-notifier"
brew "texi2html"
brew "the_silver_searcher"
brew "tree"
brew "watch"
brew "wget"
brew "yarn"
brew "yasm"
brew "youtube-dl"
brew "jmespath/jmespath/jp"
cask "1password"
brew "koekeishiya/formulae/chunkwm"
brew "koekeishiya/formulae/skhd"
cask "alacritty"
cask "alfred"
cask "android-platform-tools"
cask "charles"
cask "devdocs"
cask "docker"
cask "etcher"
cask "firefox"
cask "flux"
cask "google-backup-and-sync"
cask "google-chrome"
cask "google-cloud-sdk"
cask "google-featured-photos"
cask "handbrake"
cask "inkscape"
cask "intellij-idea"
cask "istat-menus5"
cask "iterm2"
cask "keepingyouawake"
cask "mactex-no-gui"
cask "plex-media-player"
cask "pocket-casts"
cask "racket"
cask "slack"
cask "vanilla"
cask "viscosity"
cask "vlc"
cask "zoomus"
mas "Pages", id: 409201541
mas "Pixelmator", id: 407963104

mas

A simple command line interface for the Mac App Store. Designed for scripting and automation.

The Bundlefile above should install the App Store programs listed with in it using mas.

SSH

Create a configuration directory:

mkdir -p ${HOME}/.ssh/config.d

config

ServerAliveCountMax 5
ServerAliveInterval 60
UseKeychain yes

Host *
    IdentityFile ~/.ssh/id_rsa
    PreferredAuthentications publickey,password

Include ~/.ssh/config.d/*

MacOS Junk

defaults write com.apple.Accessibility ReduceMotionEnabled -bool true

ChunkWM

.chunkwm

#
# NOTE: any 'chunkc' command that is run from this config file
#       that is NOT 'chunkc core::<..>' or 'chunkc set ..'
#       MUST be put in the background using &
#
#       e.g:
#       chunkc tiling::rule --owner Finder --name Copy --state float &
#

#
# NOTE: specify the absolutepath of the file to use for logging.
#       'stdout' or 'stderr' can be used instead of an actual filepath.
#

chunkc core::log_file stdout

#
# NOTE: specify the desired level of logging.
#
#       - none, debug, profile, warn, error
#

chunkc core::log_level warn

#
# NOTE: specify the absolutepath to the directory to use when loading a plugin.
#

chunkc core::plugin_dir /usr/local/opt/chunkwm/share/chunkwm/plugins

#
# NOTE: if enabled, chunkwm will monitor the specified plugin_dir
#       and automatically reload any '.so' file that is changed.
#

chunkc core::hotload 0

#
# NOTE: the following are config variables for the chunkwm-tiling plugin.
#

chunkc set custom_bar_enabled            0
chunkc set custom_bar_all_monitors       0
chunkc set custom_bar_offset_top         22
chunkc set custom_bar_offset_bottom      0
chunkc set custom_bar_offset_left        0
chunkc set custom_bar_offset_right       0

chunkc set global_desktop_mode           bsp
chunkc set global_desktop_offset_top     20
chunkc set global_desktop_offset_bottom  20
chunkc set global_desktop_offset_left    20
chunkc set global_desktop_offset_right   20
chunkc set global_desktop_offset_gap     15

#
# NOTE: syntax for desktop-specific settings
#
# chunkc set 2_desktop_mode                monocle
# chunkc set 5_desktop_mode                float
# chunkc set 3_desktop_offset_top          190
# chunkc set 3_desktop_offset_bottom       190
# chunkc set 3_desktop_offset_left         190
# chunkc set 3_desktop_offset_right        190
# chunkc set 3_desktop_offset_gap          30
#

chunkc set desktop_padding_step_size     10.0
chunkc set desktop_gap_step_size         5.0

chunkc set bsp_spawn_left                1
chunkc set bsp_optimal_ratio             1.0
chunkc set bsp_split_mode                optimal
chunkc set bsp_split_ratio               0.5

chunkc set monitor_focus_cycle           1
chunkc set window_focus_cycle            monitor

chunkc set mouse_follows_focus           intrinsic
chunkc set window_float_next             0
chunkc set window_region_locked          1

chunkc set mouse_move_window             \"fn 1\"
chunkc set mouse_resize_window           \"fn 2\"
chunkc set mouse_motion_interval         35

chunkc set preselect_border_color        0xffd75f5f
chunkc set preselect_border_width        5
chunkc set preselect_border_radius       0
chunkc set preselect_border_outline      0

#
# NOTE: these settings require chwm-sa.
#       (https://github.com/koekeishiya/chwm-sa)
#

chunkc set window_float_topmost          0
chunkc set window_fade_inactive          0
chunkc set window_fade_alpha             0.85
chunkc set window_fade_duration          0.25
chunkc set window_use_cgs_move           0

#
# NOTE: the following are config variables for the chunkwm-border plugin.
#
# NOTE: syntax for `focused_border_outline` setting
#       0 = false, inline border
#       1 = true, outline border
#

chunkc set focused_border_color          0xfff74902
chunkc set focused_border_width          5
chunkc set focused_border_radius         6
chunkc set focused_border_outline        0
chunkc set focused_border_skip_floating  0
chunkc set focused_border_skip_monocle   0

#
# NOTE: the following are config variables for the chunkwm-ffm plugin.
#

chunkc set ffm_bypass_modifier           fn
chunkc set ffm_standby_on_float          1

#
# NOTE: specify plugins to load when chunkwm starts.
#

chunkc core::load border.so
chunkc core::load tiling.so
chunkc core::load ffm.so

#
# NOTE: sample rules for the tiling plugin
#

chunkc tiling::rule --owner Finder --name Copy --state float &
chunkc tiling::rule --owner \"App Store\" --state float &
chunkc tiling::rule --owner Emacs --except "^$" --state tile &

~/.skhdrc

#  NOTE(koekeishiya): A list of all built-in modifier and literal keywords can
#                     be found at https://github.com/koekeishiya/skhd/issues/1
#
#                     A hotkey is written according to the following rules:
#
#                       hotkey       = <mode> '<' <action> | <action>
#
#                       mode         = 'name of mode' | <mode> ',' <mode>
#
#                       action       = <keysym> '[' <proc_map_lst> ']' | <keysym> '->' '[' <proc_map_lst> ']'
#                                      <keysym> ':' <command>          | <keysym> '->' ':' <command>
#                                      <keysym> ';' <mode>             | <keysym> '->' ';' <mode>
#
#                       keysym       = <mod> '-' <key> | <key>
#
#                       mod          = 'modifier keyword' | <mod> '+' <mod>
#
#                       key          = <literal> | <keycode>
#
#                       literal      = 'single letter or built-in keyword'
#
#                       keycode      = 'apple keyboard kVK_<Key> values (0x3C)'
#
#                       proc_map_lst = * <proc_map>
#
#                       proc_map     = <string> ':' <command>
#
#                       string       = '"' 'sequence of characters' '"'
#
#                       command      = command is executed through '$SHELL -c' and
#                                      follows valid shell syntax. if the $SHELL environment
#                                      variable is not set, it will default to '/bin/bash'.
#                                      when bash is used, the ';' delimeter can be specified
#                                      to chain commands.
#
#                                      to allow a command to extend into multiple lines,
#                                      prepend '\' at the end of the previous line.
#
#                                      an EOL character signifies the end of the bind.
#
#                       ->           = keypress is not consumed by skhd
#
#  NOTE(koekeishiya): A mode is declared according to the following rules:
#
#                       mode_decl = '::' <name> '@' ':' <command> | '::' <name> ':' <command> |
#                                   '::' <name> '@'               | '::' <name>
#
#                       name      = desired name for this mode,
#
#                       @         = capture keypresses regardless of being bound to an action
#
#                       command   = command is executed through '$SHELL -c' and
#                                   follows valid shell syntax. if the $SHELL environment
#                                   variable is not set, it will default to '/bin/bash'.
#                                   when bash is used, the ';' delimeter can be specified
#                                   to chain commands.
#
#                                   to allow a command to extend into multiple lines,
#                                   prepend '\' at the end of the previous line.
#
#                                   an EOL character signifies the end of the bind.

# add an on_enter command to the default mode
# :: default : chunkc border::color 0xff775759
#
# defines a new mode 'test' with an on_enter command, that captures keypresses
# :: test @ : chunkc border::color 0xff24ccaa
#
# from 'default' mode, activate mode 'test'
# cmd - x ; test
#
# from 'test' mode, activate mode 'default'
# test < cmd - x ; default
#
# launch a new terminal instance when in either 'default' or 'test' mode
# default, test < cmd - return : open -na /Applications/Terminal.app

# application specific bindings
#
# cmd - n [
#     "kitty"       : echo "hello kitty"
#     "qutebrowser" : echo "hello qutebrowser"
#     "finder"      : false
# ]

.blacklist [
    "emacs"
]

# close focused window
shift + alt - w : chunkc tiling::window --close

# focus window
alt - down : chunkc tiling::window --focus south
alt - left : chunkc tiling::window --focus west
alt - right : chunkc tiling::window --focus east
alt - up : chunkc tiling::window --focus north

alt - space : chunkc tiling::window --focus next
shift + alt - space : chunkc tiling::window --focus prev

# move window
shift + alt - down : chunkc tiling::window --warp south
shift + alt - left : chunkc tiling::window --warp west
shift + alt - right : chunkc tiling::window --warp east
shift + alt - up : chunkc tiling::window --warp north

# equalize size of windows
ctrl + alt - 0 : chunkc tiling::desktop --equalize

# swap window
# shift + alt - h : chunkc tiling::window --swap west
# shift + alt - j : chunkc tiling::window --swap south
# shift + alt - k : chunkc tiling::window --swap north
# shift + alt - l : chunkc tiling::window --swap east

# make floating window fill screen
# shift + alt - up     : chunkc tiling::window --grid-layout 1:1:0:0:1:1

# make floating window fill left-half of screen
# shift + alt - left   : chunkc tiling::window --grid-layout 1:2:0:0:1:1

# make floating window fill right-half of screen
# shift + alt - right  : chunkc tiling::window --grid-layout 1:2:1:0:1:1

# create desktop, move window and follow focus
# shift + cmd - n : chunkc tiling::desktop --create;\
#                   id=$(chunkc tiling::query --desktops-for-monitor $(chunkc tiling::query --monitor-for-desktop $(chunkc tiling::query --desktop id)));\
#                   chunkc tiling::window --send-to-desktop $(echo ${id##* });\
#                   chunkc tiling::desktop --focus $(echo ${id##* })

# create desktop and follow focus
# cmd + alt - n : chunkc tiling::desktop --create;\
#                 id=$(chunkc tiling::query --desktops-for-monitor $(chunkc tiling::query --monitor-for-desktop $(chunkc tiling::query --desktop id)));\
#                 chunkc tiling::desktop --focus $(echo ${id##* })

# destroy desktop
# cmd + alt - w : chunkc tiling::desktop --annihilate

# fast focus desktop
# cmd + alt - x : chunkc tiling::desktop --focus $(chunkc get _last_active_desktop)
# cmd + alt - z : chunkc tiling::desktop --focus prev
# cmd + alt - c : chunkc tiling::desktop --focus next
# cmd + alt - 1 : chunkc tiling::desktop --focus 1
# cmd + alt - 2 : chunkc tiling::desktop --focus 2
# cmd + alt - 3 : chunkc tiling::desktop --focus 3
# cmd + alt - 4 : chunkc tiling::desktop --focus 4
# cmd + alt - 5 : chunkc tiling::desktop --focus 5
# cmd + alt - 6 : chunkc tiling::desktop --focus 6
# cmd + alt - 7 : chunkc tiling::desktop --focus 7

# send window to desktop
# shift + alt - x : chunkc tiling::window --send-to-desktop $(chunkc get _last_active_desktop)
# shift + alt - z : chunkc tiling::window --send-to-desktop prev
# shift + alt - c : chunkc tiling::window --send-to-desktop next
# shift + alt - 1 : chunkc tiling::window --send-to-desktop 1
# shift + alt - 2 : chunkc tiling::window --send-to-desktop 2
# shift + alt - 3 : chunkc tiling::window --send-to-desktop 3
# shift + alt - 4 : chunkc tiling::window --send-to-desktop 4
# shift + alt - 5 : chunkc tiling::window --send-to-desktop 5
# shift + alt - 6 : chunkc tiling::window --send-to-desktop 6
# shift + alt - 7 : chunkc tiling::window --send-to-desktop 7

# send window to desktop and follow focus
# shift + cmd - x : chunkc tiling::window --send-to-desktop $(chunkc get _last_active_desktop); chunkc tiling::desktop --focus $(chunkc get _last_active_desktop)
# shift + cmd - z : chunkc tiling::window --send-to-desktop prev; chunkc tiling::desktop --focus prev
# shift + cmd - c : chunkc tiling::window --send-to-desktop next; chunkc tiling::desktop --focus next
# shift + cmd - 1 : chunkc tiling::window --send-to-desktop 1; chunkc tiling::desktop --focus 1
# shift + cmd - 2 : chunkc tiling::window --send-to-desktop 2; chunkc tiling::desktop --focus 2
# shift + cmd - 3 : chunkc tiling::window --send-to-desktop 3; chunkc tiling::desktop --focus 3
# shift + cmd - 4 : chunkc tiling::window --send-to-desktop 4; chunkc tiling::desktop --focus 4
# shift + cmd - 5 : chunkc tiling::window --send-to-desktop 5; chunkc tiling::desktop --focus 5
# shift + cmd - 6 : chunkc tiling::window --send-to-desktop 6; chunkc tiling::desktop --focus 6
# shift + cmd - 7 : chunkc tiling::window --send-to-desktop 7; chunkc tiling::desktop --focus 7

# focus monitor
# ctrl + alt - z  : chunkc tiling::monitor -f prev
# ctrl + alt - c  : chunkc tiling::monitor -f next
# ctrl + alt - 1  : chunkc tiling::monitor -f 1
# ctrl + alt - 2  : chunkc tiling::monitor -f 2
# ctrl + alt - 3  : chunkc tiling::monitor -f 3

# send window to monitor and follow focus
# ctrl + cmd - z  : chunkc tiling::window --send-to-monitor prev; chunkc tiling::monitor -f prev
# ctrl + cmd - c  : chunkc tiling::window --send-to-monitor next; chunkc tiling::monitor -f next
# ctrl + cmd - 1  : chunkc tiling::window --send-to-monitor 1; chunkc tiling::monitor -f 1
# ctrl + cmd - 2  : chunkc tiling::window --send-to-monitor 2; chunkc tiling::monitor -f 2
# ctrl + cmd - 3  : chunkc tiling::window --send-to-monitor 3; chunkc tiling::monitor -f 3

# increase region size
# shift + alt - a : chunkc tiling::window --use-temporary-ratio 0.1 --adjust-window-edge west
# shift + alt - s : chunkc tiling::window --use-temporary-ratio 0.1 --adjust-window-edge south
# shift + alt - w : chunkc tiling::window --use-temporary-ratio 0.1 --adjust-window-edge north
# shift + alt - d : chunkc tiling::window --use-temporary-ratio 0.1 --adjust-window-edge east

# decrease region size
# shift + cmd - a : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge west
# shift + cmd - s : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge south
# shift + cmd - w : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge north
# shift + cmd - d : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge east

# set insertion point for focused container
# ctrl + alt - f : chunkc tiling::window --use-insertion-point cancel
# ctrl + alt - h : chunkc tiling::window --use-insertion-point west
# ctrl + alt - j : chunkc tiling::window --use-insertion-point south
# ctrl + alt - k : chunkc tiling::window --use-insertion-point north
# ctrl + alt - l : chunkc tiling::window --use-insertion-point east

# rotate tree
# alt - r : chunkc tiling::desktop --rotate 90

# mirror tree y-axis
# alt - y : chunkc tiling::desktop --mirror vertical

# mirror tree x-axis
# alt - x : chunkc tiling::desktop --mirror horizontal

# toggle desktop offset
# alt - a : chunkc tiling::desktop --toggle offset

# toggle window fullscreen
# alt - f : chunkc tiling::window --toggle fullscreen

# toggle window native fullscreen
# shift + alt - f : chunkc tiling::window --toggle native-fullscreen

# toggle window parent zoom
# alt - d : chunkc tiling::window --toggle parent

# toggle window split type
# alt - e : chunkc tiling::window --toggle split

# toggle window fade
# alt - q : chunkc tiling::window --toggle fade

# float / unfloat window and center on screen
# alt - t : chunkc tiling::window --toggle float;\
#           chunkc tiling::window --grid-layout 4:4:1:1:2:2

# toggle sticky
# alt - s : chunkc tiling::window --toggle sticky

# toggle sticky, float and resize to picture-in-picture size
# alt - p : chunkc tiling::window --toggle sticky;\
#           chunkc tiling::window --grid-layout 5:5:4:0:1:1

# float next window to be tiled
# shift + alt - t : chunkc set window_float_next 1

# change layout of desktop
shift + alt - 1 : chunkc tiling::desktop --layout bsp
shift + alt - 2 : chunkc tiling::desktop --layout monocle
shift + alt - 3 : chunkc tiling::desktop --layout float

# ctrl + alt - w : chunkc tiling::desktop --deserialize ~/.chunkwm_layouts/dev_1

About

Literate programming dotfiles

Resources

License

Releases

No releases published
You can’t perform that action at this time.