From 34a6c23f99988a75729b04880824b8d79d1391a2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 10 Oct 2012 01:20:24 -0400 Subject: Use XDG for bash, remove alsa, clean up bash & profile, add CACHEDIR.TAG .profile: fix up --- .bash.d/emacs.sh | 8 --- .bash_aliases | 66 ------------------------- .bash_login | 1 + .bash_logout | 10 +--- .bashrc | 121 +-------------------------------------------- .config/bash/aliases.sh | 59 ++++++++++++++++++++++ .config/bash/login.sh | 9 ++++ .config/bash/logout.sh | 9 ++++ .config/bash/rc.d/emacs.sh | 8 +++ .config/bash/rc.sh | 80 ++++++++++++++++++++++++++++++ .git.info.exclude | 107 --------------------------------------- .git.info.exclude.in | 108 ++++++++++++++++++++++++++++++++++++++++ .login-daemons | 10 ---- .profile | 74 ++++++++++++++------------- Makefile | 9 ++-- 15 files changed, 319 insertions(+), 360 deletions(-) delete mode 100644 .bash.d/emacs.sh delete mode 100644 .bash_aliases create mode 120000 .bash_login mode change 100644 => 120000 .bash_logout mode change 100644 => 120000 .bashrc create mode 100644 .config/bash/aliases.sh create mode 100644 .config/bash/login.sh create mode 100644 .config/bash/logout.sh create mode 100644 .config/bash/rc.d/emacs.sh create mode 100644 .config/bash/rc.sh delete mode 100644 .git.info.exclude create mode 100644 .git.info.exclude.in delete mode 100644 .login-daemons diff --git a/.bash.d/emacs.sh b/.bash.d/emacs.sh deleted file mode 100644 index f484bbb..0000000 --- a/.bash.d/emacs.sh +++ /dev/null @@ -1,8 +0,0 @@ -case "$TERM" in - eterm*) - SELECTED_EDITOR='emacsclient' - EDITOR=$SELECTED_EDITOR - VISUAL=$SELECTED_EDITOR - export SELECTED_EDITOR EDITOR VISUAL - :;; -esac diff --git a/.bash_aliases b/.bash_aliases deleted file mode 100644 index de1a321..0000000 --- a/.bash_aliases +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# The above line probably should never be *used* in this file, but it -# lets text editors know that this is BASH syntax. - -###################################################################### -# Set up colors and settings for ls/dir/vdir # -###################################################################### -if [ -x "`which dircolors`" ]; then - eval "`dircolors -b`" - alias ls='ls -1v --color=auto' - alias dir='dir -v --color=auto' - alias vdir='vdir -v--color=auto' - - for xgrep in ${PATH//:/\/*grep }/*grep; do - if [ -f "$xgrep" ]; then - xgrep=`basename "$xgrep"` - if [ "$xgrep" != pgrep ]; then - alias $xgrep="$xgrep --color=auto" - fi - fi - done -else - alias ls='ls -1v' - alias dir='dir -v' - alias vdir='vdir -v' -fi - -###################################################################### -# Set up the standard aliases for ls # -###################################################################### -alias ll='ls -l' -alias la='ls -a' -alias l='ls -CF' - -###################################################################### -# Some preferences for miscellaneous stuff # -###################################################################### -#alias rm='gvfs-trash' -alias ssh='ssh -XC' -alias sed='sed --follow-symlinks' -alias tree='tree --charset utf8' -alias cd=pushd -alias gitk='gitk --all --date-order' - -###################################################################### -# Remember lat/long for redshift # -###################################################################### -redshift='redshift -l39.9030:85.9979' -alias gtk-redshift="gtk-$redshift" -alias redshift="$redshift" - -###################################################################### -# Some almost-function aliases # -###################################################################### -#alias serva='ssh luke@servb.ath.cx -p3440' -#alias phpdoctor='php /usr/gnu/www/0-other/phpdoctor-head/phpdoc.php' -function xterm-title () { echo "];$@"; } # Oh, wait this one *is* a function -alias lock="clear; away -C 'This terminal is locked'" -alias plock="xterm-title Terminal Locked;lock" - -###################################################################### -# Other # -###################################################################### -case "$TERM" in - eterm*) alias editor='editor -n';; -esac diff --git a/.bash_login b/.bash_login new file mode 120000 index 0000000..31231da --- /dev/null +++ b/.bash_login @@ -0,0 +1 @@ +.config/bash/login.sh \ No newline at end of file diff --git a/.bash_logout b/.bash_logout deleted file mode 100644 index a8b88c1..0000000 --- a/.bash_logout +++ /dev/null @@ -1,9 +0,0 @@ -# ~/.bash_logout: executed by bash(1) when login shell exits. - -# when leaving the console clear the screen to increase privacy - -if [ "$SHLVL" = 1 ]; then - [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q -fi - -make -C "$HOME" diff --git a/.bash_logout b/.bash_logout new file mode 120000 index 0000000..d8117ff --- /dev/null +++ b/.bash_logout @@ -0,0 +1 @@ +.config/bash/logout.sh \ No newline at end of file diff --git a/.bashrc b/.bashrc deleted file mode 100644 index ff11c5b..0000000 --- a/.bashrc +++ /dev/null @@ -1,120 +0,0 @@ -# ~/.bashrc: executed by bash(1) for non-login shells. -# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) -# for examples - -# I include this file for all interactive invocations of bash(1), whether -# they are login shells or not. - -# If not running interactively, don't do anything -[ -z "$PS1" ] && return - -# don't put duplicate lines in the history. See bash(1) for more options -# don't overwrite GNU Midnight Commander's setting of `ignorespace'. -export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups -# ... or force ignoredups and ignorespace -export HISTCONTROL=ignoreboth - -# append to the history file, don't overwrite it -shopt -s histappend - -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) - -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. -shopt -s checkwinsize - -# Let ** recursively scan directories -shopt -s globstar - -# Why is this not on by default? -# "We have a cached value, but it isn't valid anymore. Should we trash it?" -shopt -s checkhash - -# make less more friendly for non-text input files, see lesspipe(1) -[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -# set variable identifying the chroot you work in (used in the prompt below) -if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) -fi - -case "$TERM" in - xterm) export TERM=xterm-256color;; -esac - -# set a fancy prompt (non-color, unless we know we "want" color) -case "$TERM" in - linux) color_prompt=yes;; - *-*color*) color_prompt=yes;; -esac - -# uncomment for a colored prompt, if the terminal has the capability; turned -# off by default to not distract the user: the focus in a terminal window -# should be on the output of commands, not on the prompt -#force_color_prompt=yes - -if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes - else - color_prompt= - fi -fi - -if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n\$ ' -else - PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\n\$ ' -fi -unset color_prompt force_color_prompt - -# If this is an xterm set the title to user@host:dir -case "$TERM" in -xterm*|rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" - ;; -*) - ;; -esac - -# Include modular config files -if [ -d ~/.bash.d ]; then - for file in ~/.bash.d/*.sh; do - . $file; - done -fi - -# Alias definitions. -# You may want to put all your additions into a separate file like -# ~/.bash_aliases, instead of adding them here directly. -# See /usr/share/doc/bash-doc/examples in the bash-doc package. - -if [ -f ~/.bash_aliases ]; then - . ~/.bash_aliases -fi - -# enable programmable completion features (you don't need to enable -# this, if it's already enabled in /etc/bash.bashrc and /etc/profile -# sources /etc/bash.bashrc). -if [ -f /etc/bash_completion ]; then - . /etc/bash_completion -fi - -if [ -f "$HOME/.login-daemons" ]; then - . "$HOME/.login-daemons" -fi - -if [ -f "${HOME}/.gnupg/agent-info" ]; then - . "${HOME}/.gnupg/agent-info" - export GPG_AGENT_INFO - #export SSH_AUTH_SOCK -fi - -export PERL_LOCAL_LIB_ROOT="/home/luke/perl5"; -export PERL_MB_OPT="--install_base /home/luke/perl5"; -export PERL_MM_OPT="INSTALL_BASE=/home/luke/perl5"; -export PERL5LIB="/home/luke/perl5/lib/perl5/i686-linux-thread-multi:/home/luke/perl5/lib/perl5"; -export PATH="/home/luke/perl5/bin:$PATH"; diff --git a/.bashrc b/.bashrc new file mode 120000 index 0000000..18faac1 --- /dev/null +++ b/.bashrc @@ -0,0 +1 @@ +.config/bash/rc.sh \ No newline at end of file diff --git a/.config/bash/aliases.sh b/.config/bash/aliases.sh new file mode 100644 index 0000000..8241b95 --- /dev/null +++ b/.config/bash/aliases.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# The above line probably should never be *used* in this file, but it +# lets text editors know that this is BASH syntax. + +###################################################################### +# Set up colors and settings for ls/dir/vdir # +###################################################################### +if [ -x "`which dircolors`" ]; then + eval "`dircolors -b`" + alias ls='ls -1v --color=auto' + alias dir='dir -v --color=auto' + alias vdir='vdir -v--color=auto' + + for xgrep in ${PATH//:/\/*grep }/*grep; do + if [ -f "$xgrep" ]; then + xgrep=`basename "$xgrep"` + if [ "$xgrep" != pgrep ]; then + alias $xgrep="$xgrep --color=auto" + fi + fi + done +else + alias ls='ls -1v' + alias dir='dir -v' + alias vdir='vdir -v' +fi + +###################################################################### +# Set up the standard aliases for ls # +###################################################################### +alias ll='ls -l' +alias la='ls -a' +alias l='ls -CF' + +###################################################################### +# Some preferences for miscellaneous stuff # +###################################################################### +#alias rm='gvfs-trash' +alias ssh='ssh -XC' +alias sed='sed --follow-symlinks' +alias tree='tree --charset utf8' +alias cd=pushd +alias gitk='gitk --all --date-order' + +###################################################################### +# Remember lat/long for redshift # +###################################################################### +redshift='redshift -l39.9030:85.9979' +alias gtk-redshift="gtk-$redshift" +alias redshift="$redshift" +unset redshift + +###################################################################### +# Some almost-function aliases # +###################################################################### +xterm-title() { echo "];$@"; } # Oh, wait this one *is* a function +alias lock="clear; away -C 'This terminal is locked'" +alias plock="xterm-title Terminal Locked;lock" +mvln() { mv $1 $2; ln -s $2 $1; } diff --git a/.config/bash/login.sh b/.config/bash/login.sh new file mode 100644 index 0000000..1269a03 --- /dev/null +++ b/.config/bash/login.sh @@ -0,0 +1,9 @@ +# ~/.bash_login: executed by bash(1) when login shell starts. + +# I think this is sane default behavior + +# Load user settings +. "$HOME/.profile" + +# Load bash settings (automatic for non-login shells) +. "$HOME/.bashrc" diff --git a/.config/bash/logout.sh b/.config/bash/logout.sh new file mode 100644 index 0000000..a8b88c1 --- /dev/null +++ b/.config/bash/logout.sh @@ -0,0 +1,9 @@ +# ~/.bash_logout: executed by bash(1) when login shell exits. + +# when leaving the console clear the screen to increase privacy + +if [ "$SHLVL" = 1 ]; then + [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q +fi + +make -C "$HOME" diff --git a/.config/bash/rc.d/emacs.sh b/.config/bash/rc.d/emacs.sh new file mode 100644 index 0000000..f484bbb --- /dev/null +++ b/.config/bash/rc.d/emacs.sh @@ -0,0 +1,8 @@ +case "$TERM" in + eterm*) + SELECTED_EDITOR='emacsclient' + EDITOR=$SELECTED_EDITOR + VISUAL=$SELECTED_EDITOR + export SELECTED_EDITOR EDITOR VISUAL + :;; +esac diff --git a/.config/bash/rc.sh b/.config/bash/rc.sh new file mode 100644 index 0000000..ed55f75 --- /dev/null +++ b/.config/bash/rc.sh @@ -0,0 +1,80 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# I include this file for all interactive invocations of bash(1), whether +# they are login shells or not. + +# If not running interactively, don't do anything +[ -z "$PS1" ] && return + +# don't put duplicate lines in the history. See bash(1) for more options +export HISTCONTROL=ignoredups +export HISTFILE=${XDG_CACHE_HOME}/bash/history +export HISTTIMEFORMAT='[%Y-%m-%d %H:%M] ' +shopt -s histappend # append to the history file, don't overwrite it + +shopt -s checkwinsize # update the values of LINES and COLUMNS +shopt -s globstar # Let ** recursively scan directories + +# Why is this not on by default? +# "We have a cached value, but it isn't valid anymore. Should we trash it?" +shopt -s checkhash + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x "`which lesspipe 2>/dev/null`" ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +make_prompt() { + local RESET='' + local BOLD='' + local GREEN='' + local BLUE='' + if $1; then + RESET="$(tput sgr0)" + BOLD="$(tput bold)" + GREEN="$(tput setaf 2)" + BLUE="$(tput setaf 4)" + fi + local CHROOT='${debian_chroot:+($debian_chroot)}' + echo "${RESET}${BOLD}${CHROOT}${GREEN}"'\u@\h'"${RESET}:${BOLD}${BLUE}"'\w'"${RESET}" +} + +if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + PS1="$(make_prompt true )"'\n\$ ' +else + PS1="$(make_prompt false)"'\n\$ ' +fi + +# If this is an xterm set the title to user@host:dir +case "$TERM" in + xterm*|rxvt*) + PS1="\[\e]0;$(make_prompt false)\a\]$PS1";; +esac + +unset make_prompt + +# Include modular config files +if [ -d "${XDG_CONFIG_HOME}/rc.d" ]; then + for file in "${XDG_CONFIG_HOME}/rc.d"/*.sh; do + . "$file" + done +fi + +if [ -f ${XDG_CONFIG_HOME}/bash/aliases.sh ]; then + . ${XDG_CONFIG_HOME}/bash/aliases.sh +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if [ -f /etc/bash_completion ]; then + . /etc/bash_completion +fi diff --git a/.git.info.exclude b/.git.info.exclude deleted file mode 100644 index 871ebf6..0000000 --- a/.git.info.exclude +++ /dev/null @@ -1,107 +0,0 @@ -# Defualt to ignoring all files -/* - -# Except dotfiles -!.* - -# Or Makefile -!Makefile - -# Ignore these for privacy -.ssh/* -!.ssh/config -.gnupg/* -!.gnupg/gpg.conf -.netrc - -# Ignore temp/log/history files -*.log -log* - -*.tmp -*.tmp.* -tmp.* -tmp-* -tmp - -*_history -*_hist -history.* -history - -*.lock -.~lock.*# -lock - -*.state -*.cookie -*.bak - -*authority -*cache* - -# Ignore files left by editors -*~ -.#* -\#*# - - -# Ignore these special-purpose cache/temp files -.camel_certs -.compiz/session/* -.config/chromium/Default/History\ Index* -.current.asound -.dbus/session-bus/* -.ddd/sessions -.dvdcss -.esd_auth -.evolution/.* -.gconfd/saved_state -.gnash-media -.gnash/SharedObjects/* -.kde/share/apps/RecentDocuments/* -.kde/socket-* -.kde4/share/apps/RecentDocuments/* -.kde4/share/apps/okular/docdata/* -.kde4/socket-* -.lesshst -.link*/*.his -.local/share/Trash/* -.local/share/gvfs-metadata/* -.local/share/icons/* -.local/share/recently-used.xbel -.pki -.pulse -.pulse-cookie -.recently-used -.recently-used.xbel* -.setroubleshoot -.shotwell/thumbs/* -.sudo_as_admin_successful -.thumbnails/* -.wireshark/recent* -.xsession-errors* - -# Ignore files that are autogenerated -.folders -.nanorc -.config/libretools/blacklist.txt - -# Ignore these files for no good reason -.bogofilter -.config/Trolltech.conf -.config/vlc -.gem -.offlineimap -.prefix -.prefix.* -.terminfo -.wine* - -# Ignore these files that if I tracked them, would be a separate repo -.config/chromium -.config/libreoffice -.config/transmission -.eclipse -.mozilla -.netbeans diff --git a/.git.info.exclude.in b/.git.info.exclude.in new file mode 100644 index 0000000..37c1ee4 --- /dev/null +++ b/.git.info.exclude.in @@ -0,0 +1,108 @@ +# Defualt to ignoring all files +/* + +# Except dotfiles +!.* + +# Or Makefile +!Makefile + +# Ignore these for privacy +.ssh/* +!.ssh/config +.gnupg/* +!.gnupg/gpg.conf +.netrc + +# Ignore temp/log/history files +*.log +log.* + +*.tmp +*.tmp.* +tmp.* +tmp-* +tmp + +*_history +*_hist +history.* +history + +*.lock +.~lock.*# +lock + +*.state +*.cookie +*.bak + +*authority +*cache* + +# Ignore files left by editors +*~ +.#* +\#*# + + +# Ignore these special-purpose cache/temp files +.camel_certs +.compiz/session/* +.config/chromium/Default/History\ Index* +.current.asound +.dbus/session-bus/* +.ddd/sessions +.dvdcss +.esd_auth +.evolution/.* +.gconfd/saved_state +.gnash-media +.gnash/SharedObjects/* +.kde/share/apps/RecentDocuments/* +.kde/socket-* +.kde4/share/apps/RecentDocuments/* +.kde4/share/apps/okular/docdata/* +.kde4/socket-* +.lesshst +.link*/*.his +.local/share/Trash/* +.local/share/gvfs-metadata/* +.local/share/icons/* +.local/share/recently-used.xbel +.pki +.pulse +.pulse-cookie +.recently-used +.recently-used.xbel* +.setroubleshoot +.shotwell/thumbs/* +.sudo_as_admin_successful +.thumbnails/* +.wireshark/recent* +.xsession-errors* + +# Ignore files that are autogenerated +.config/libretools/blacklist.txt +.folders +.git.info.exclude +.nanorc + +# Ignore these files for no good reason +.bogofilter +.config/Trolltech.conf +.config/vlc +.gem +.offlineimap +.prefix +.prefix.* +.terminfo +.wine* + +# Ignore these files that if I tracked them, would be a separate repo +.config/chromium +.config/libreoffice +.config/transmission +.eclipse +.mozilla +.netbeans diff --git a/.login-daemons b/.login-daemons deleted file mode 100644 index bf8cf21..0000000 --- a/.login-daemons +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -if [ -x "`which daemon`" ]; then - daemon maildirproc - daemon gpg-agent --daemon --write-env-file "${HOME}/.gnupg/agent-info" - daemon batterymon 20 " - alsactl restore --file $HOME/.full.asound; - espeak 'PLUG ME IN'; - sleep .2;" -fi diff --git a/.profile b/.profile index 2e2e1d0..a6c4d91 100644 --- a/.profile +++ b/.profile @@ -1,4 +1,8 @@ # ~/.profile: executed by the command interpreter for login shells. +# Should be whether logging in graphically or not. +# +# This file should be executable by /bin/sh, but I'm going to assume bash(1) +# # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login # exists. @@ -9,33 +13,44 @@ umask 022 ## Paths ############################################################# # Unix -bins=$(echo $HOME/bin $HOME/.local.`uname -m`/bin $HOME/.local/bin $HOME/.prefix.`uname -m`/bin $HOME/.prefix/bin $HOME/.gem/ruby/*/bin) -for dir in $bins; do - if [ -d "$dir" ]; then - export PATH="$dir:$PATH" - fi +bins=($HOME/bin $HOME/.local.`uname -m`/bin $HOME/.local/bin $HOME/.prefix.`uname -m`/bin $HOME/.prefix/bin $HOME/.gem/ruby/*/bin) +for dir in "${bins[@]}"; do + if [ -d "$dir" ]; then + export PATH="$dir:$PATH" + fi done # Ruby for dir in $HOME/.prefix/lib; do - if [ -d "$dir" ]; then - export RUBYLIB="$dir" - fi + if [ -d "$dir" ]; then + export RUBYLIB="$dir" + fi done # Settings ########################################################### # Text editor if [ -f "$HOME/.selected_editor" ]; then - . "$HOME/.selected_editor" - export SELECTED_EDITOR - export ALTERNATE_EDITOR - export EDITOR="${EDITOR:-$SELECTED_EDITOR}" - export VISUAL="${VISUAL:-$SELECTED_EDITOR}" + . "$HOME/.selected_editor" + export SELECTED_EDITOR + export ALTERNATE_EDITOR + export EDITOR="${EDITOR:-$SELECTED_EDITOR}" + export VISUAL="${VISUAL:-$SELECTED_EDITOR}" fi # GPG -export GPGKEY=D4FFBFC9 +if [ -z "$GPGKEY" ] && [ -f "${HOME}/.gnupg/gpg.conf" ]; then + export GPGKEY=`sed -nr 's/^\s*default-key\s+//p' "${HOME}/.gnupg/gpg.conf"` +fi +if [ -z "$(pgrep -u `whoami` gpg-agent)" ]; then + mkdir -p ${XDG_RUNTIME_DIR}/sessions/gpg + gpg-agent --daemon --write-env-file "${XDG_RUNTIME_DIR}/sessions/gpg" +fi +if [ -f "${XDG_RUNTIME_DIR}/sessions/gpg" ]; then + . "${XDG_RUNTIME_DIR}/sessions/gpg" + export GPG_AGENT_INFO + #export SSH_AUTH_SOCK +fi # Java _JAVA_OPTIONS='' @@ -43,36 +58,27 @@ _JAVA_OPTIONS+=' -Dawt.useSystemAAFontSettings=on' _JAVA_OPTIONS+=' -Dswing.aatext=true' _JAVA_OPTIONS+=' -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel' if [ -n "$TMPDIR" ]; then - _JAVA_OPTIONS+=" -Djava.io.tmpdir=$TMPDIR" + _JAVA_OPTIONS+=" -Djava.io.tmpdir=$TMPDIR" fi export _JAVA_OPTIONS -# ALSA -if [ -x "`which alsactl 2>/dev/null`" ]; then - alsactl restore "$HOME/.current.asound" &> /dev/null || true -fi - # X11 if [ -z "$XAUTHORITY" ]; then - export XAUTHORITY=$HOME/.Xauthority + export XAUTHORITY=$HOME/.Xauthority fi # D-Bus if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then - eval `dbus-launch` - export DBUS_SESSION_BUS_ADDRESS - export DBUS_SESSION_BUS_PID -fi + # I want a separate instance for each login + #dbus-launch > "${HOME}/.cache/sessions/dbus" + #. "${HOME}/.cache/sessions/dbus" + eval `dbus-launch` -# Start background programs ########################################## -if [ -f "$HOME/.login-daemons" ]; then - . "$HOME/.login-daemons" + export DBUS_SESSION_BUS_ADDRESS + export DBUS_SESSION_BUS_PID fi -# BASH ############################################################### -if [ -n "$BASH_VERSION" ]; then - # include .bashrc if it exists - if [ -f "$HOME/.bashrc" ]; then - . "$HOME/.bashrc" - fi +# Load any box-specific stuff +if [ -f "$HOME/.profile.local" ]; then + . "$HOME/.profile.local" fi diff --git a/Makefile b/Makefile index 3cecf33..160a64c 100644 --- a/Makefile +++ b/Makefile @@ -4,22 +4,19 @@ NANO_BIN_PREFIX = $(patsubst %/bin/nano,%,$(shell which nano)) NANO_CHECK = $(HOME)/.prefix:$(HOME):/usr/local:/usr:$(NANO_BIN_PREFIX) NANO_SHARE = $(firstword $(wildcard $(addsuffix /share/nano,$(subst :, ,$(NANO_CHECK))))) -ALSACTL=$(firstword $(shell . $(HOME)/.profile &>/dev/null; which alsactl) echo) - -targets=.nanorc .folders .crontab.cookie .current.asound +targets=.nanorc .folders .crontab.cookie .git.info.exclude all: $(targets) clean: rm -f $(targets) -%.asound: FORCE - $(ALSACTL) store --file '$@' - .nanorc: .nanorc.in $(NANO_SHARE) cat '$<' > '$@' for file in $(NANO_SHARE)/*.nanorc; do echo "include \"$$file\""; done >> '$@' .folders: Maildir ( echo '..'; find ~/Maildir -maxdepth 2 -type f -name "maildirfolder" -printf '%h\n'|sed -r 's@.*/(.*\.)(.*)@.\1\2@' )|sort>'$@' +.git.info.exclude: .git.info.exclude.in . + ( cat $<; find . -type f -name 'CACHEDIR.TAG' -printf '%h\n'|sed 's@^\./@/@' ) > $@ .crontab.cookie: .crontab .crontab.local -(cat $^; echo) | crontab - 2>/dev/null -- cgit v1.2.3-54-g00ecf From 318568fb6db4981692d7b2abc5e0a42f0907a2b5 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 10 Oct 2012 01:21:52 -0400 Subject: wmii: use a connected_to_x_server function --- .wmii/include.sh | 5 +++++ .wmii/rbar_battery | 3 +-- .wmii/rbar_clock | 3 +-- .wmii/rbar_cpu | 3 +-- .wmii/rbar_wifi | 3 +-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.wmii/include.sh b/.wmii/include.sh index 36f8f3e..f4b29b3 100644 --- a/.wmii/include.sh +++ b/.wmii/include.sh @@ -68,3 +68,8 @@ Action() { return 1 fi } + +connected_to_x_server() { + xdpyinfo &>/dev/null + return $? +} diff --git a/.wmii/rbar_battery b/.wmii/rbar_battery index 7a7f24f..0e70799 100755 --- a/.wmii/rbar_battery +++ b/.wmii/rbar_battery @@ -3,8 +3,7 @@ priority=$1 -set -e -while true; do +while connected_to_x_server; do acpi -b |a "$WMII_DIR/rbar/${priority}_battery" sleep 1 done diff --git a/.wmii/rbar_clock b/.wmii/rbar_clock index 8e7d2a4..86bf14d 100755 --- a/.wmii/rbar_clock +++ b/.wmii/rbar_clock @@ -3,8 +3,7 @@ priority=$1 -set -e -while true; do +while connected_to_x_server; do date |a "$WMII_DIR/rbar/${priority}_clock" sleep .5 done diff --git a/.wmii/rbar_cpu b/.wmii/rbar_cpu index 7f891da..d3bdd88 100755 --- a/.wmii/rbar_cpu +++ b/.wmii/rbar_cpu @@ -3,8 +3,7 @@ priority=$1 -set -e -while true; do +while connected_to_x_server; do # This doesn't work for me, it shows capacity #echo -n 'Core MHz:' $(cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/.*: //g; s/\..*//g;') |a "$WMII_DIR/rbar/${priority}_cpu" # This actually displays %idle diff --git a/.wmii/rbar_wifi b/.wmii/rbar_wifi index 608b164..2ea84a3 100755 --- a/.wmii/rbar_wifi +++ b/.wmii/rbar_wifi @@ -3,8 +3,7 @@ priority=$1 -set -e -while true; do +while connected_to_x_server; do echo 'Wlan0:' $(iwconfig wlan0 | sed 's/ /\n/g' | grep Quality) |a "$WMII_DIR/rbar/${priority}_wifi" sleep 1 done -- cgit v1.2.3-54-g00ecf From 48c87c85dc219ca3a4ab87a1861dba6d495e5e00 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 10 Oct 2012 01:23:39 -0400 Subject: maildirproc: add Jade's new email address --- .maildirproc/default.rc | 1 + 1 file changed, 1 insertion(+) diff --git a/.maildirproc/default.rc b/.maildirproc/default.rc index 71bc00c..c2ad6f2 100644 --- a/.maildirproc/default.rc +++ b/.maildirproc/default.rc @@ -165,6 +165,7 @@ def my_filters(mail): for address in [ "justicejade10@aol.com", "parsonsjade@aol.com", + "parsonstjade@gmail.com", ]: if mail["From"].contains(address): mail.move(".misc.Jade") -- cgit v1.2.3-54-g00ecf From 65cf2b407744320091f3bd1a1de0dee73992bd8c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 10 Oct 2012 01:32:35 -0400 Subject: symlink .kde4/share/{apps,config} to .config --- .git.info.exclude.in | 6 +++--- .kde | 1 + .kde4/share/apps | 1 + .kde4/share/config | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) create mode 120000 .kde create mode 120000 .kde4/share/apps create mode 120000 .kde4/share/config diff --git a/.git.info.exclude.in b/.git.info.exclude.in index 37c1ee4..fe97ec8 100644 --- a/.git.info.exclude.in +++ b/.git.info.exclude.in @@ -17,6 +17,7 @@ # Ignore temp/log/history files *.log log.* +log *.tmp *.tmp.* @@ -49,7 +50,9 @@ lock # Ignore these special-purpose cache/temp files .camel_certs .compiz/session/* +.config/RecentDocuments/* .config/chromium/Default/History\ Index* +.config/okular/docdata/* .current.asound .dbus/session-bus/* .ddd/sessions @@ -59,10 +62,7 @@ lock .gconfd/saved_state .gnash-media .gnash/SharedObjects/* -.kde/share/apps/RecentDocuments/* .kde/socket-* -.kde4/share/apps/RecentDocuments/* -.kde4/share/apps/okular/docdata/* .kde4/socket-* .lesshst .link*/*.his diff --git a/.kde b/.kde new file mode 120000 index 0000000..e604d30 --- /dev/null +++ b/.kde @@ -0,0 +1 @@ +.kde4 \ No newline at end of file diff --git a/.kde4/share/apps b/.kde4/share/apps new file mode 120000 index 0000000..7f8f949 --- /dev/null +++ b/.kde4/share/apps @@ -0,0 +1 @@ +../../.config \ No newline at end of file diff --git a/.kde4/share/config b/.kde4/share/config new file mode 120000 index 0000000..7f8f949 --- /dev/null +++ b/.kde4/share/config @@ -0,0 +1 @@ +../../.config \ No newline at end of file -- cgit v1.2.3-54-g00ecf From c13b6347ac065da59e8645479a37005fd3fb412d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 10 Oct 2012 01:33:02 -0400 Subject: ditch ConsoleKit in .xinitrc --- .xinitrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.xinitrc b/.xinitrc index 9c5ce55..bfc352b 100644 --- a/.xinitrc +++ b/.xinitrc @@ -23,4 +23,4 @@ fi # exec startkde # exec startxfce4 # ...or the Window Manager of your choice -exec ck-launch-session wmii +exec wmii -- cgit v1.2.3-54-g00ecf From e1127837281b134f3b141c2e417c0fb1dc4562ac Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 20:12:20 -0400 Subject: ditch wicd --- .wicd/WHEREAREMYFILES | 1 - 1 file changed, 1 deletion(-) delete mode 120000 .wicd/WHEREAREMYFILES diff --git a/.wicd/WHEREAREMYFILES b/.wicd/WHEREAREMYFILES deleted file mode 120000 index 5e06b02..0000000 --- a/.wicd/WHEREAREMYFILES +++ /dev/null @@ -1 +0,0 @@ -/var/lib/wicd/WHEREAREMYFILES \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 281adcda20ee3b0d65a416dfb0d6a0d1413dc1be Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 20:13:58 -0400 Subject: move the X11 config files to .config/X11, add a serverrc file remove extra newline from .config/X11/login --- .Xdefaults | 19 +------------------ .config/X11/clientrc | 27 +++++++++++++++++++++++++++ .config/X11/defaults | 18 ++++++++++++++++++ .config/X11/login | 9 +++++++++ .config/X11/modmap | 7 +++++++ .config/X11/serverrc | 6 ++++++ .xinitrc | 27 +-------------------------- .xserverrc | 1 + .xsession | 11 +---------- 9 files changed, 71 insertions(+), 54 deletions(-) mode change 100644 => 120000 .Xdefaults create mode 100644 .config/X11/clientrc create mode 100644 .config/X11/defaults create mode 100644 .config/X11/login create mode 100644 .config/X11/modmap create mode 100644 .config/X11/serverrc mode change 100644 => 120000 .xinitrc create mode 120000 .xserverrc mode change 100644 => 120000 .xsession diff --git a/.Xdefaults b/.Xdefaults deleted file mode 100644 index ceabc5c..0000000 --- a/.Xdefaults +++ /dev/null @@ -1,18 +0,0 @@ -URxvt.background: #000000 -URxvt.foreground: #CCCCCC - -URxvt.scrollstyle: plain -URxvt.scrollBar_floating: true - -URxvt.font: xft:Monospace-8 -URxvt.cursorBlink: true -URxvt.termName: xterm-256color -URxvt.pastableTabs: true - -URxvt.scrollTtyOutput: false -URxvt.scrollTtyKeypress: false -URxvt.scrollWithBuffer: true - -URxvt.perl-ext-common: default,matcher -URxvt.urlLauncher: v-www-browser -URxvt.matcher.button: 1 diff --git a/.Xdefaults b/.Xdefaults new file mode 120000 index 0000000..7588317 --- /dev/null +++ b/.Xdefaults @@ -0,0 +1 @@ +.config/X11/defaults \ No newline at end of file diff --git a/.config/X11/clientrc b/.config/X11/clientrc new file mode 100644 index 0000000..d1e1725 --- /dev/null +++ b/.config/X11/clientrc @@ -0,0 +1,27 @@ +#!/bin/sh +# +# ~/.xinitrc +# +# Executed by startx (run your window manager from here) + +if [ -d /etc/X11/xinit/xinitrc.d ]; then + echo ' ==> Running scripts in Entering xinitrc.d/*' + for f in /etc/X11/xinit/xinitrc.d/*; do + echo " -> $f" + [ -x "$f" ] && "$f" & + done + unset f + echo ' -> done' +fi + +usermodmap="$XDG_CONFIG_HOME/X11/modmap" +if [ -f "$usermodmap" ]; then + xmodmap "$usermodmap" +fi + +# exec gnome-session +# exec startkde +# exec startxfce4 +# ...or the Window Manager of your choice +#export WMII_CONFPATH="$XDG_CONFIG_HOME/wmii" +exec wmii diff --git a/.config/X11/defaults b/.config/X11/defaults new file mode 100644 index 0000000..ceabc5c --- /dev/null +++ b/.config/X11/defaults @@ -0,0 +1,18 @@ +URxvt.background: #000000 +URxvt.foreground: #CCCCCC + +URxvt.scrollstyle: plain +URxvt.scrollBar_floating: true + +URxvt.font: xft:Monospace-8 +URxvt.cursorBlink: true +URxvt.termName: xterm-256color +URxvt.pastableTabs: true + +URxvt.scrollTtyOutput: false +URxvt.scrollTtyKeypress: false +URxvt.scrollWithBuffer: true + +URxvt.perl-ext-common: default,matcher +URxvt.urlLauncher: v-www-browser +URxvt.matcher.button: 1 diff --git a/.config/X11/login b/.config/X11/login new file mode 100644 index 0000000..03bad2a --- /dev/null +++ b/.config/X11/login @@ -0,0 +1,9 @@ +#!/bin/sh + +# +# ~/.xsession +# +# Executed by xdm/gdm/kdm at login +# + +/bin/bash --login -i ~/.xinitrc diff --git a/.config/X11/modmap b/.config/X11/modmap new file mode 100644 index 0000000..e4ade24 --- /dev/null +++ b/.config/X11/modmap @@ -0,0 +1,7 @@ +remove lock = Caps_Lock +keysym Caps_Lock = Super_L + +keycode 135 = Super_R + +clear mod4 +add mod4 = Super_L Super_R Hyper_L Hyper_R Menu diff --git a/.config/X11/serverrc b/.config/X11/serverrc new file mode 100644 index 0000000..d6c6ffc --- /dev/null +++ b/.config/X11/serverrc @@ -0,0 +1,6 @@ +#!/bin/bash + +VT=vt07 +#VT=$(tty|sed 's@/dev/tty@vt@') + +exec /usr/bin/X -nolisten tcp "$VT" "$@" diff --git a/.xinitrc b/.xinitrc deleted file mode 100644 index bfc352b..0000000 --- a/.xinitrc +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# -# ~/.xinitrc -# -# Executed by startx (run your window manager from here) - -if [ -d /etc/X11/xinit/xinitrc.d ]; then - echo ' ==> Running scripts in Entering xinitrc.d/*' - for f in /etc/X11/xinit/xinitrc.d/*; do - echo " -> $f" - [ -x "$f" ] && "$f" & - done - unset f - echo ' -> done' -fi - -usermodmap="$HOME/.xmodmap" -if [ -f "$usermodmap" ]; then - xmodmap "$usermodmap" -fi - -# exec gnome-session -# exec startkde -# exec startxfce4 -# ...or the Window Manager of your choice -exec wmii diff --git a/.xinitrc b/.xinitrc new file mode 120000 index 0000000..c0f7e1c --- /dev/null +++ b/.xinitrc @@ -0,0 +1 @@ +.config/X11/clientrc \ No newline at end of file diff --git a/.xserverrc b/.xserverrc new file mode 120000 index 0000000..f46e3e3 --- /dev/null +++ b/.xserverrc @@ -0,0 +1 @@ +.config/X11/serverrc \ No newline at end of file diff --git a/.xsession b/.xsession deleted file mode 100644 index a16dc0b..0000000 --- a/.xsession +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# -# ~/.xsession -# -# Executed by xdm/gdm/kdm at login -# - -/bin/bash --login -i ~/.xinitrc - diff --git a/.xsession b/.xsession new file mode 120000 index 0000000..ee16887 --- /dev/null +++ b/.xsession @@ -0,0 +1 @@ +.config/X11/login \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 8f6fe81e1db6e1d95a4eb0ef303491b4aadf44c1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 10 Oct 2012 01:54:40 -0400 Subject: remove superfluous lines from .git.info.exclude.in --- .git.info.exclude.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/.git.info.exclude.in b/.git.info.exclude.in index fe97ec8..612ecf2 100644 --- a/.git.info.exclude.in +++ b/.git.info.exclude.in @@ -53,10 +53,8 @@ lock .config/RecentDocuments/* .config/chromium/Default/History\ Index* .config/okular/docdata/* -.current.asound .dbus/session-bus/* .ddd/sessions -.dvdcss .esd_auth .evolution/.* .gconfd/saved_state -- cgit v1.2.3-54-g00ecf From 4493d30ac4c747b08b2107a440084245a9157bd4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 12:48:36 -0400 Subject: wmii: use 9mount --- .wmii/include.sh | 2 +- .wmii/wmiirc | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.wmii/include.sh b/.wmii/include.sh index f4b29b3..29d4d67 100644 --- a/.wmii/include.sh +++ b/.wmii/include.sh @@ -4,7 +4,7 @@ if [ -z "$WMII_NAMESPACE" ]; then export WMII_NAMESPACE=`wmiir namespace` fi if [ -z "$WMII_DIR" ]; then - export WMII_DIR=$WMII_NAMESPACE/mnt + export WMII_DIR="$HOME/n/wmii" fi # a -- a work-around for buggy IO append in 9pfuse diff --git a/.wmii/wmiirc b/.wmii/wmiirc index 92adb8b..8d77394 100755 --- a/.wmii/wmiirc +++ b/.wmii/wmiirc @@ -5,9 +5,8 @@ wmiir xwrite /event Start . "$HOME/.wmii/include.sh" echo ' ==> Starting wmiirc' -mount9p=/opt/plan9/bin/9pfuse -mkdir -p $WMII_NAMESPACE/mnt -$mount9p $WMII_NAMESPACE/{wmii,mnt} +mkdir -p "$WMII_DIR" +9mount -i "unix!$WMII_NAMESPACE/wmii" "$WMII_DIR" MODKEY=Mod4 # super UP=p @@ -45,7 +44,7 @@ Event() { echo ' ==> Stopping wmiirc' echo " -> unmounting WMII_DIR=$WMII_DIR..." # might complain about /etc/mtab if the x server has already stopped - fusermount -u "$WMII_DIR" 2>>/dev/null + 9umount "$WMII_DIR" echo " -> rmdir'ing WMII_DIR=$WMII_DIR..." rmdir "$WMII_DIR" exit;; -- cgit v1.2.3-54-g00ecf From f5f19ca8e8d46ba1087f8531e2309ac392c24112 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 14:33:31 -0400 Subject: wmii: phase out wmiir --- .wmii/include.sh | 37 ++++++++++++------------ .wmii/quit | 2 +- .wmii/rbar_battery | 2 +- .wmii/rbar_clock | 2 +- .wmii/rbar_cpu | 4 +-- .wmii/rbar_wifi | 2 +- .wmii/wmiirc | 84 +++++++++++++++++++++++------------------------------- 7 files changed, 61 insertions(+), 72 deletions(-) diff --git a/.wmii/include.sh b/.wmii/include.sh index 29d4d67..b1ec901 100644 --- a/.wmii/include.sh +++ b/.wmii/include.sh @@ -7,20 +7,22 @@ if [ -z "$WMII_DIR" ]; then export WMII_DIR="$HOME/n/wmii" fi -# a -- a work-around for buggy IO append in 9pfuse -# useing '|a' should be just like using '>>', but will work -# when 9pfuse decides to bug out. -a() { - f="${1/#${WMII_DIR}/}" - if [ "$f" = "$1" ]; then - cat >> "$1" - else - if wmiir ls "$f" &>/dev/null; then - wmiir write "$f" - else - wmiir create "$f" - fi - fi +# Linux's 9p kernel module sometimes omits entries in directory listings +unalias ls 2>/dev/null +ls() { + real_ls="`which ls` -1F" + [ $# = 0 ] && set -- "`pwd`" + case $# in + 1) + f="${1/#${WMII_DIR}/}" + if [ "$f" = "$1" ]; then + $real_ls "$f" + else + wmiir ls "$f" + fi + ;; + *) $real_ls "$f";; + esac } # I like wmiir's setsid better than linux-utils' @@ -37,9 +39,8 @@ path_which() { PATH="$mypath" "$which" -- "$prog" 2>/dev/null } - lstags() { - ls $WMII_DIR/tag | sed '/^sel$/d' + ls $WMII_DIR/tag | sed -e 's@/@@' -e '/^sel$/d' } scansection() { @@ -70,6 +71,6 @@ Action() { } connected_to_x_server() { - xdpyinfo &>/dev/null - return $? + xdpyinfo &>/dev/null + return $? } diff --git a/.wmii/quit b/.wmii/quit index 54f64e7..876a60e 100755 --- a/.wmii/quit +++ b/.wmii/quit @@ -1,3 +1,3 @@ #!/bin/bash . "$HOME/.wmii/include.sh" -echo quit |a $WMII_DIR/ctl +echo quit >> $WMII_DIR/ctl diff --git a/.wmii/rbar_battery b/.wmii/rbar_battery index 0e70799..ae8980a 100755 --- a/.wmii/rbar_battery +++ b/.wmii/rbar_battery @@ -4,6 +4,6 @@ priority=$1 while connected_to_x_server; do - acpi -b |a "$WMII_DIR/rbar/${priority}_battery" + acpi -b >> "$WMII_DIR/rbar/${priority}_battery" sleep 1 done diff --git a/.wmii/rbar_clock b/.wmii/rbar_clock index 86bf14d..18c4493 100755 --- a/.wmii/rbar_clock +++ b/.wmii/rbar_clock @@ -4,6 +4,6 @@ priority=$1 while connected_to_x_server; do - date |a "$WMII_DIR/rbar/${priority}_clock" + date >> "$WMII_DIR/rbar/${priority}_clock" sleep .5 done diff --git a/.wmii/rbar_cpu b/.wmii/rbar_cpu index d3bdd88..22da985 100755 --- a/.wmii/rbar_cpu +++ b/.wmii/rbar_cpu @@ -5,8 +5,8 @@ priority=$1 while connected_to_x_server; do # This doesn't work for me, it shows capacity - #echo -n 'Core MHz:' $(cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/.*: //g; s/\..*//g;') |a "$WMII_DIR/rbar/${priority}_cpu" + #echo -n 'Core MHz:' $(cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/.*: //g; s/\..*//g;') >> "$WMII_DIR/rbar/${priority}_cpu" # This actually displays %idle - echo 'CPU: [ '$(tail -n3 ~/tmp/cputime|sed -ur 's/\s\s+/\t/g'|cut -f2,11|sed 's/\t\(.*\)/(\1)/')' ]' |a "$WMII_DIR/rbar/${priority}_cpu" + echo 'CPU: [ '$(tail -n3 ~/tmp/cputime|sed -ur 's/\s\s+/\t/g'|cut -f2,11|sed 's/\t\(.*\)/(\1)/')' ]' >> "$WMII_DIR/rbar/${priority}_cpu" sleep 1 done diff --git a/.wmii/rbar_wifi b/.wmii/rbar_wifi index 2ea84a3..2ada834 100755 --- a/.wmii/rbar_wifi +++ b/.wmii/rbar_wifi @@ -4,6 +4,6 @@ priority=$1 while connected_to_x_server; do - echo 'Wlan0:' $(iwconfig wlan0 | sed 's/ /\n/g' | grep Quality) |a "$WMII_DIR/rbar/${priority}_wifi" + echo 'Wlan0:' $(iwconfig wlan0 | sed 's/ /\n/g' | grep Quality) >> "$WMII_DIR/rbar/${priority}_wifi" sleep 1 done diff --git a/.wmii/wmiirc b/.wmii/wmiirc index 8d77394..1e88128 100755 --- a/.wmii/wmiirc +++ b/.wmii/wmiirc @@ -84,9 +84,9 @@ Event() { { case `wmii9menu Delete Fullscreen` in Delete) - echo kill |a $WMII_DIR/client/$client/ctl;; + echo kill >> $WMII_DIR/client/$client/ctl;; Fullscreen) - echo Fullscreen on |a $WMII_DIR/client/$1/ctl;; + echo Fullscreen on >> $WMII_DIR/client/$1/ctl;; esac }& ;; esac;; @@ -101,7 +101,7 @@ Event() { resp=$(wihack -transient $client \ xmessage -nearmouse -buttons Kill,Wait -print "$msg") if [ "$resp" = Kill ]; then - echo slay |a $WMII_DIR/client/$client/ctl + echo slay >> $WMII_DIR/client/$client/ctl fi }& ;; Fullscreen) ## $1=client $2=[on|off] @@ -110,24 +110,24 @@ Event() { ## Tag events CreateTag) ## $1=tag - echo "$WMII_NORMCOLORS" $@ |a $WMII_DIR/lbar/$1;; + echo "$WMII_NORMCOLORS" $@ >> $WMII_DIR/lbar/$1;; DestroyTag) ## $1=tag rm $WMII_DIR/lbar/$1;; FocusTag) ## $1=tag - echo "$WMII_FOCUSCOLORS" $1 |a $WMII_DIR/lbar/$1;; + echo "$WMII_FOCUSCOLORS" $1 >> $WMII_DIR/lbar/$1;; UnfocusTag) ## $1=tag - echo "$WMII_NORMCOLORS" $1 |a $WMII_DIR/lbar/$1;; + echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;; UrgentTag) ## $1=tag $2=[Manager|Client] - echo "$WMII_URGENTCOLORS" $1 |a $WMII_DIR/lbar/$1;; + echo "$WMII_URGENTCOLORS" $1 >> $WMII_DIR/lbar/$1;; NotUrgentTag) ## $1=tag $2=[Manager|Client] - echo "$WMII_NORMCOLORS" $1 |a $WMII_DIR/lbar/$1;; + echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;; ## LeftBar events (usually tag buttons) LeftBarMouseDown) ## $1=button $2=bar_item ;; LeftBarClick) ## $1=button $2=bar_item shift # ignore the button - echo view "$@" |a $WMII_DIR/ctl;; + echo view "$@" >> $WMII_DIR/ctl;; LeftMouseDND) ## $1=button $2=bar_item Event LeftBarClick "$@";; @@ -152,50 +152,49 @@ Key() { ## Moving around $MODKEY-$LEFT) ## Select the client to the left - echo select left |a $WMII_DIR/tag/sel/ctl;; + echo select left >> $WMII_DIR/tag/sel/ctl;; $MODKEY-$RIGHT) ## Select the client to the right - echo select right |a $WMII_DIR/tag/sel/ctl;; + echo select right >> $WMII_DIR/tag/sel/ctl;; $MODKEY-$UP) ## Select the client above - echo select up |a $WMII_DIR/tag/sel/ctl;; + echo select up >> $WMII_DIR/tag/sel/ctl;; $MODKEY-$DOWN) ## Select the client below - echo select down |a $WMII_DIR/tag/sel/ctl;; + echo select down >> $WMII_DIR/tag/sel/ctl;; $MODKEY-space) ## Toggle between floating and managed layers - echo select toggle |a $WMII_DIR/tag/sel/ctl;; + echo select toggle >> $WMII_DIR/tag/sel/ctl;; ## Moving clients around $MODKEY-Shift-$LEFT) ## Move selected client to the left - wmiir xwrite /tag/sel/ctl send sel left;; + echo send sel left >> $WMII_DIR/tag/sel/ctl;; $MODKEY-Shift-$RIGHT) ## Move selected client to the right - wmiir xwrite /tag/sel/ctl send sel right;; + echo send sel right >> $WMII_DIR/tag/sel/ctl;; $MODKEY-Shift-$UP) ## Move selected client up - wmiir xwrite /tag/sel/ctl send sel up;; + echo send sel up >> $WMII_DIR/tag/sel/ctl;; $MODKEY-Shift-$DOWN) ## Move selected client down - wmiir xwrite /tag/sel/ctl send sel down;; - + echo send sel down >> $WMII_DIR/tag/sel/ctl;; $MODKEY-Shift-space) ## Toggle selected client between floating and managed layers - wmiir xwrite /tag/sel/ctl send sel toggle;; + echo send sel toggle >> $WMII_DIR/tag/sel/ctl;; ## Moving through stacks $MODKEY-Control-$UP) ## Select the stack above - wmiir xwrite /tag/sel/ctl select up stack;; - $MODKEY-Control-$DOWN) # Select the stack below - wmiir xwrite /tag/sel/ctl select down stack;; + echo select up stack >> $WMII_DIR/tag/sel/ctl;; + $MODKEY-Control-$DOWN) ## Select the stack below + echo select down stack >> $WMII_DIR/tag/sel/ctl;; ## Client actions $MODKEY-shift-1) ## Toggle selected client's fullsceen state - wmiir xwrite /client/sel/ctl Fullscreen toggle;; + echo Fullscreen toggle >> $WMII_DIR/client/sel/ctl;; $MODKEY-shift-0) ## Close client - wmiir xwrite /client/sel/ctl kill;; + echo kill >> $WMII_DIR/client/sel/ctl;; ## Changing column modes $MODKEY-d) ## Set column to default mode - wmiir xwrite /tag/sel/ctl colmode sel default-max;; + echo colmode sel default-max >> $WMII_DIR/tag/sel/ctl;; $MODKEY-s) ## Set column to stack mode - wmiir xwrite /tag/sel/ctl colmode sel stack-max;; + echo colmode sel stack-max >> $WMII_DIR/tag/sel/ctl;; $MODKEY-m) ## Set column to max mode - wmiir xwrite /tag/sel/ctl colmode sel stack+max;; + echo colmode sel stack+max >> $WMII_DIR/tag/sel/ctl;; ## Running programs $MODKEY-a) ## Open wmii actions menu @@ -205,44 +204,33 @@ Key() { $MODKEY-Return) ## Launch a terminal setsid x-terminal-emulator & ;; - ## Other - $MODKEY-Control-t) ## Toggle all other key bindings - case $(wmiir read /keys | wc -l | tr -d ' \t\n') in - 0|1) - echo -n "$Keys" | wmiir write /keys - wmiir xwrite /ctl grabmod $MODKEY;; - *) - wmiir xwrite /keys $MODKEY-Control-t - wmiir xwrite /ctl grabmod Mod3;; - esac;; - ## Tag actions $MODKEY-t) ## Change to another tag { tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return - wmiir xwrite /ctl view $tag + echo view $tag >> $WMII_DIR/ctl }& ;; $MODKEY-Shift-t) ## Retag the selected client sel=$(sed 1q $WMII_DIR/client/sel/ctl) { tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return - wmiir xwrite /client/$sel/tags "$tag" + echo "$tag" >> $WMII_DIR/client/$sel/tags }& ;; esac } ## End Key # WM Configuration -echo font xft:Monospace-8 |a $WMII_DIR/ctl -echo focuscolors $WMII_FOCUSCOLORS |a $WMII_DIR/ctl -echo normcolors $WMII_NORMCOLORS |a $WMII_DIR/ctl -echo grabmod $MODKEY |a $WMII_DIR/ctl -echo border 1 |a $WMII_DIR/ctl +echo font xft:Monospace-8 >> $WMII_DIR/ctl +echo focuscolors $WMII_FOCUSCOLORS >> $WMII_DIR/ctl +echo normcolors $WMII_NORMCOLORS >> $WMII_DIR/ctl +echo grabmod $MODKEY >> $WMII_DIR/ctl +echo border 1 >> $WMII_DIR/ctl xsetroot -solid "$WMII_BACKGROUND" & progsfile=$WMII_NAMESPACE/.proglist path_ls $PATH > $progsfile & -eval arg `scansection Key|cut -sf2` |a $WMII_DIR/keys +eval arg `scansection Key|cut -sf2` >> $WMII_DIR/keys # Clear the LBar find $WMII_DIR/lbar -type f -delete @@ -265,6 +253,6 @@ fi trap "Event Quit" EXIT # use wmiir so it doesn't look like an open file -wmiir read /event 2>/dev/null | while read event; do +wmiir read /event | while read event; do Event $event done -- cgit v1.2.3-54-g00ecf From fdb7a68bec32153e696a440d2e7795c8e4b58e08 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 20:18:49 -0400 Subject: make .wmii/autostart a profile-local --- .wmii/autostart | 4 ---- 1 file changed, 4 deletions(-) delete mode 100755 .wmii/autostart diff --git a/.wmii/autostart b/.wmii/autostart deleted file mode 100755 index aae23f4..0000000 --- a/.wmii/autostart +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -daemon lxpanel &> /dev/null -daemon wicd-client -t &> /dev/null -daemon notifyd &> /dev/null -- cgit v1.2.3-54-g00ecf From 4414160a4cce0080f3f2b33f9e7a7583c77c7062 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 17:36:00 -0400 Subject: wmii: refactor --- .wmii/config.sh | 242 +++++++++++++++++++++++++++++++++++++++++++++++++++ .wmii/ctl-init | 5 ++ .wmii/fixes.sh | 24 ++++++ .wmii/include.sh | 71 ++------------- .wmii/tagrules | 3 + .wmii/util.sh | 121 ++++++++++++++++++++++++++ .wmii/wmiirc | 257 ++----------------------------------------------------- 7 files changed, 408 insertions(+), 315 deletions(-) create mode 100644 .wmii/config.sh create mode 100644 .wmii/ctl-init create mode 100644 .wmii/fixes.sh create mode 100644 .wmii/tagrules create mode 100644 .wmii/util.sh diff --git a/.wmii/config.sh b/.wmii/config.sh new file mode 100644 index 0000000..abe378f --- /dev/null +++ b/.wmii/config.sh @@ -0,0 +1,242 @@ +#!/bin/bash + +MODKEY=Mod4 # "super" +UP=p +DOWN=n +LEFT=b +RIGHT=f + +# Colors tuples: " " +. `conffile theme-solarized-dark` + +Event() { + event=$1; shift; + case "$event" in + ## Mouse event meanings: + ## MouseDown = mouse down + ## Click = mouse up + ## DND = hover, while dragging something (Drag 'n' Drop) + ## The associated mouse button is always "1" + ## + ## Mouse-button IDs: + ## 1 = left + ## 2 = middle + ## 3 = right + + ## Custom (non-WMII-generated) events + WmiircStart) ## No args + echo ' ==> Starting wmiirc' + 9umount "$WMII_DIR" &>/dev/null # just in case + mkdir -p "$WMII_DIR" + 9mount -i "unix!$WMII_NAMESPACE/wmii" "$WMII_DIR" + + # Configure wmii + < "`conffile tagrules`" expand_variables >> $WMII_DIR/tagrules + < "`conffile ctl-init`" expand_variables >> $WMII_DIR/ctl + scansection Key|cut -sf2 >> $WMII_DIR/keys + # Configure X11 + xsetroot -solid "$WMII_BACKGROUND" + + # Generate dynamic files + path_ls $PATH > $progsfile + + # Clear the LBar and RBar + find $WMII_DIR/{l,r}bar -type f -delete + # Populate the LBar by emulating [Create|Focus]Tag events + seltag=`sed 1q $WMII_DIR/tag/sel/ctl` + lstags | while read tag; do + Event CreateTag "$tag" + if [ "$tag" = "$seltag" ]; then + Event FocusTag "$tag" + fi + done + + # Run the autostart action + Action autostart 2>/dev/null & + ;; + WmiircQuit) ## No args + Event Quit;; + ## WMII-meta events + Quit) ## No args + echo ' ==> Stopping wmiirc' + echo " -> unmounting WMII_DIR=$WMII_DIR..." + 9umount "$WMII_DIR" + echo " -> rmdir'ing WMII_DIR=$WMII_DIR..." + rmdir "$WMII_DIR" + exit;; + Warning) ## $@=string + notify-send "wmii warning: $*";; + Key) ## $1=keystroke + Key "$@";; + + ## WMII Window management events + FocusFloating) ## No args + ;; + AreaFocus) ## $1=area + ;; + DestroyArea) ## $1=area + ;; + ColumnFocus) ## $1=column + ;; + CreateColumn) ## $1=column + ;; + + ## Client events + CreateClient) ## $1=client + ;; + DestroyClient) ## $1=client + ;; + Urgent) ## $1=client $2=[Manager|Client] + ;; + NotUrgent) ## $1=client $2=[Manager|Client] + ;; + ClientMouseDown) ## $1=client $2=button + client=$1 + button=$2 + case $button in + 1) ;; + 2) ;; + 3) + { + case `wmii9menu Delete Fullscreen` in + Delete) + echo kill >> $WMII_DIR/client/$client/ctl;; + Fullscreen) + echo Fullscreen on >> $WMII_DIR/client/$1/ctl;; + esac + }& ;; + esac;; + ClientClick) ## $1=client $2=button + ;; + Unresponsive) ## $1=client + client=$1 + client_name=`cat $WMII_DIR/client/$client/label` + msg="The client \`${client_name}' is not responding." + msg+=" What would you like to do?" + { + resp=$(wihack -transient $client \ + xmessage -nearmouse -buttons Kill,Wait -print "$msg") + if [ "$resp" = Kill ]; then + echo slay >> $WMII_DIR/client/$client/ctl + fi + }& ;; + Fullscreen) ## $1=client $2=[on|off] + # TODO: hide any clients with the 'panel' class + ;; + + ## Tag events + CreateTag) ## $1=tag + echo "$WMII_NORMCOLORS" $@ >> $WMII_DIR/lbar/$1;; + DestroyTag) ## $1=tag + rm $WMII_DIR/lbar/$1;; + FocusTag) ## $1=tag + echo "$WMII_FOCUSCOLORS" $1 >> $WMII_DIR/lbar/$1;; + UnfocusTag) ## $1=tag + echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;; + UrgentTag) ## $1=tag $2=[Manager|Client] + echo "$WMII_URGENTCOLORS" $1 >> $WMII_DIR/lbar/$1;; + NotUrgentTag) ## $1=tag $2=[Manager|Client] + echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;; + + ## LeftBar events (usually tag buttons) + LeftBarMouseDown) ## $1=button $2=bar_item + ;; + LeftBarClick) ## $1=button $2=bar_item + shift # ignore the button + echo view "$@" >> $WMII_DIR/ctl;; + LeftMouseDND) ## $1=button $2=bar_item + Event LeftBarClick "$@";; + + ## RightBar events + RightBarMouseDown) ## $1=button $2=bar_item + ;; + RightBarClick) ## $1=button $2=bar_item + ;; + RightMouseDND) ## $1=button $2=bar_item + Event RightBarClick "$@";; + esac +} ## End Event + +# Key Bindings +Key() { + key=$1 + case "$key" in + ## Moving around + + $MODKEY-$LEFT) ## Select the client to the left + echo select left >> $WMII_DIR/tag/sel/ctl;; + $MODKEY-$RIGHT) ## Select the client to the right + echo select right >> $WMII_DIR/tag/sel/ctl;; + $MODKEY-$UP) ## Select the client above + echo select up >> $WMII_DIR/tag/sel/ctl;; + $MODKEY-$DOWN) ## Select the client below + echo select down >> $WMII_DIR/tag/sel/ctl;; + + $MODKEY-space) ## Toggle between floating and managed layers + echo select toggle >> $WMII_DIR/tag/sel/ctl;; + + ## Moving clients around + + $MODKEY-Shift-$LEFT) ## Move selected client to the left + echo send sel left >> $WMII_DIR/tag/sel/ctl;; + $MODKEY-Shift-$RIGHT) ## Move selected client to the right + echo send sel right >> $WMII_DIR/tag/sel/ctl;; + $MODKEY-Shift-$UP) ## Move selected client up + echo send sel up >> $WMII_DIR/tag/sel/ctl;; + $MODKEY-Shift-$DOWN) ## Move selected client down + echo send sel down >> $WMII_DIR/tag/sel/ctl;; + $MODKEY-Shift-space) ## Toggle selected client between floating and managed layers + echo send sel toggle >> $WMII_DIR/tag/sel/ctl;; + + ## Moving through stacks + $MODKEY-Control-$UP) ## Select the stack above + echo select up stack >> $WMII_DIR/tag/sel/ctl;; + $MODKEY-Control-$DOWN) ## Select the stack below + echo select down stack >> $WMII_DIR/tag/sel/ctl;; + + ## Client actions + $MODKEY-shift-1) ## Toggle selected client's fullsceen state + echo Fullscreen toggle >> $WMII_DIR/client/sel/ctl;; + $MODKEY-shift-0) ## Close client + echo kill >> $WMII_DIR/client/sel/ctl;; + + ## Changing column modes + $MODKEY-d) ## Set column to default mode + echo colmode sel default-max >> $WMII_DIR/tag/sel/ctl;; + $MODKEY-s) ## Set column to stack mode + echo colmode sel stack-max >> $WMII_DIR/tag/sel/ctl;; + $MODKEY-m) ## Set column to max mode + echo colmode sel stack+max >> $WMII_DIR/tag/sel/ctl;; + + ## Running programs + $MODKEY-a) ## Open wmii actions menu + Action $(path_ls $WMII_CONFPATH | wimenu -h "${hist}.actions" -n 5000) & ;; + $MODKEY-x) ## Open program menu + setsid $(wimenu -h "${hist}.progs" -n 5000 <$progsfile) & ;; + $MODKEY-Return) ## Launch a terminal + setsid x-terminal-emulator & ;; + + ## Tag actions + $MODKEY-t) ## Change to another tag + { + tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return + echo view $tag >> $WMII_DIR/ctl + }& ;; + $MODKEY-Shift-t) ## Retag the selected client + sel=$(sed 1q $WMII_DIR/client/sel/ctl) + { + tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return + echo "$tag" >> $WMII_DIR/client/$sel/tags + }& ;; + esac +} ## End Key + +Action() { + prog=`path_which "$WMII_CONFPATH" $1`; shift + if [ -n "$prog" ]; then + "$prog" "$@" + return $? + else + return 1 + fi +} ## End Action diff --git a/.wmii/ctl-init b/.wmii/ctl-init new file mode 100644 index 0000000..026c0d5 --- /dev/null +++ b/.wmii/ctl-init @@ -0,0 +1,5 @@ +font xft:Monospace-8 +focuscolors $WMII_FOCUSCOLORS +normcolors $WMII_NORMCOLORS +grabmod $MODKEY +border 1 diff --git a/.wmii/fixes.sh b/.wmii/fixes.sh new file mode 100644 index 0000000..6e1f38b --- /dev/null +++ b/.wmii/fixes.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Fix various deficiencies in either the shell or the filesystem + +## +# Usage: ls DIRECTORY +# Linux's 9p kernel module sometimes omits entries in directory listings +## +unalias ls 2>/dev/null +ls() { + real_ls="`which ls` -1F" + [ $# = 0 ] && set -- "`pwd`" + f="${1/#${WMII_DIR}/}" + if [ "$f" = "$1" ]; then + $real_ls "$f" + else + wmiir ls "$f" + fi +} + +## +# Usage: setsid cmd [arguments...] +# I like wmiir's setsid better than linux-utils' +## +setsid() { wmiir setsid "$@"; } diff --git a/.wmii/include.sh b/.wmii/include.sh index b1ec901..43855e6 100644 --- a/.wmii/include.sh +++ b/.wmii/include.sh @@ -1,76 +1,15 @@ #!/bin/bash if [ -z "$WMII_NAMESPACE" ]; then - export WMII_NAMESPACE=`wmiir namespace` + export WMII_NAMESPACE="`wmiir namespace`" fi if [ -z "$WMII_DIR" ]; then export WMII_DIR="$HOME/n/wmii" fi -# Linux's 9p kernel module sometimes omits entries in directory listings -unalias ls 2>/dev/null -ls() { - real_ls="`which ls` -1F" - [ $# = 0 ] && set -- "`pwd`" - case $# in - 1) - f="${1/#${WMII_DIR}/}" - if [ "$f" = "$1" ]; then - $real_ls "$f" - else - wmiir ls "$f" - fi - ;; - *) $real_ls "$f";; - esac -} +. "$HOME/.wmii/util.sh" -# I like wmiir's setsid better than linux-utils' -setsid() { wmiir setsid "$@"; } +hist="`conffile history`" +progsfile=$WMII_NAMESPACE/.proglist -path_ls() { - find -L `echo "$@"|sed 'y/:/ /'` -maxdepth 1 -type f -executable -printf '%f\n' 2>/dev/null| sort -u -} - -path_which() { - mypath=$1 - prog=$2 - which=`which which` - PATH="$mypath" "$which" -- "$prog" 2>/dev/null -} - -lstags() { - ls $WMII_DIR/tag | sed -e 's@/@@' -e '/^sel$/d' -} - -scansection() { - file=`path_which "$WMII_CONFPATH" wmiirc` - sec=$1 - tmp=`mktemp` - if [ -n "$sec" ]; then - < "$file" sed -n "/^\s*$sec\s*()/,/##\s*End $sec/p" | sed '1d;$d'> $tmp - else - < "$file" sed "/\s*}\s*##\s*End\s/d" > $tmp - fi - < $tmp sed -n '/##/p'|sed -r 's/^\s*(.*)\)\s*## ?/\t\1\t/;s/\s*## ?//' - rm $tmp -} - -conffile() { - echo "$HOME/.wmii/$@" -} - -Action() { - prog=`path_which "$WMII_CONFPATH" $1`; shift - if [ -n "$prog" ]; then - "$prog" "$@" - return $? - else - return 1 - fi -} - -connected_to_x_server() { - xdpyinfo &>/dev/null - return $? -} +. "$HOME/.wmii/config.sh" diff --git a/.wmii/tagrules b/.wmii/tagrules new file mode 100644 index 0000000..990151f --- /dev/null +++ b/.wmii/tagrules @@ -0,0 +1,3 @@ +/Emacs|Navigator/ -> +sel +/Eclipse/ -> +sel +/panel/ -> /.*/ diff --git a/.wmii/util.sh b/.wmii/util.sh new file mode 100644 index 0000000..3234783 --- /dev/null +++ b/.wmii/util.sh @@ -0,0 +1,121 @@ +#!/bin/bash + +# I moved "fixes" into a separate file because it isn't so much configuration... +. "$HOME/.wmii/fixes.sh" + +################################################################################ +# Added shell features # +################################################################################ + +## +# Usage: dquote STRING +# Safely double-quotes a string. +# It escapes ways to execute code, but not variables. +## +dquote() { + str=$1 + str="${str//\\/\\\\}" # backslash + str="${str//\"/\\\"}" # dquote + str="${str//\$(/\\\$(}" # $(...) + str="${str//\`/\\\`}" # backtick + printf '"%s"\n' "$str" +} + +## +# Usage: expand_variables +# Expands variables read from /dev/stdin +## +expand_variables() { + while read; do + eval printf "'%s\n'" "$(dquote "$REPLY")" + done +} + +################################################################################ +# PATH manipulation # +################################################################################ + +## +# Usage: path_ls PATH +# List executables in PATH (PATH is delimited by `:') +## +path_ls() { + dirs="`echo "$@"|sed 'y/:/ /'`" + find -L $dirs -maxdepth 1 -type f -executable -printf '%f\n' 2>/dev/null | sort -u +} + +## +# Usage: path_which PATH PROGRAM +# Find the full path of PROGRAM by searching PATH +## +path_which() { + mypath=$1 + prog=$2 + which=`which which` + PATH="$mypath" "$which" -- "$prog" 2>/dev/null +} + +################################################################################ +# wmii convenience functions # +################################################################################ + +## +# Usage: lstags +# Lists wmii tags +## +lstags() { + ls $WMII_DIR/tag | sed -e 's@/@@' -e '/^sel$/d' +} + +################################################################################ +# X11 functions # +################################################################################ + +## +# Usage: connected_to_x_server +# Return status indicates whether there is an X server at $DISPLAY +## +connected_to_x_server() { + xdpyinfo &>/dev/null + return $? +} + +################################################################################ +# My wmii configuration # +################################################################################ + +## +# Usage: scansection [SECTION] +# Reads the doc comments from a section of wmiirc. +# If SECTION is not given, it reads all doc comments. +## +scansection() { + file=`conffile config.sh` + sec=$1 + tmp=`mktemp` + # Isolate the sections we want. + if [ -n "$sec" ]; then + # Find the section + < "$file" sed -n "/^\s*$sec\s*()/,/##\s*End $sec/p" | sed '1d;$d'> $tmp + else + # Remove extra lines that mark the end of a section + < "$file" sed "/\s*}\s*##\s*End\s/d" > $tmp + fi + < $tmp sed -n '/##/p' | while read; do + var="$(echo "$REPLY" | sed -nr 's/^\s*(.*)\)\s*##.*/\1/p')" + comment="$(echo "$REPLY" | sed -r 's/.*## ?//')" + if [ -z "$var" ]; then + printf '%s\n' "$comment" + else + printf '\t%s\t%s\n' "$(echo "$var"|expand_variables)" "$comment" + fi + done + rm $tmp +} + +## +# Usage: conffile FILE +## +conffile() { + echo "$HOME/.wmii/$@" +} diff --git a/.wmii/wmiirc b/.wmii/wmiirc index 1e88128..c513cd1 100755 --- a/.wmii/wmiirc +++ b/.wmii/wmiirc @@ -1,258 +1,17 @@ #!/bin/bash -# Let any running instances of wmiirc know that we're starting -wmiir xwrite /event Start - . "$HOME/.wmii/include.sh" -echo ' ==> Starting wmiirc' -mkdir -p "$WMII_DIR" -9mount -i "unix!$WMII_NAMESPACE/wmii" "$WMII_DIR" - -MODKEY=Mod4 # super -UP=p -DOWN=n -LEFT=b -RIGHT=f - -# Colors tuples: " " -. `conffile theme-solarized-dark` - -# Menu history -hist="`conffile history`" - -# Tagging Rules -echo '/Emacs|Navigator/ -> +sel' >> $WMII_DIR/tagrules -echo '/Eclipse/ -> +sel' >> $WMII_DIR/tagrules -echo '/panel/ -> /.*/' >> $WMII_DIR/tagrules - -Event() { - event=$1; shift; - case "$event" in - ## Mouse event meanings: - ## MouseDown = mouse down - ## Click = mouse up - ## DND = hover, while dragging something (Drag 'n' Drop) - ## The associated mouse button is always "1" - ## - ## Mouse-button IDs: - ## 1 = left - ## 2 = middle - ## 3 = right - - ## WMII-meta events - Quit) ## No args - echo ' ==> Stopping wmiirc' - echo " -> unmounting WMII_DIR=$WMII_DIR..." - # might complain about /etc/mtab if the x server has already stopped - 9umount "$WMII_DIR" - echo " -> rmdir'ing WMII_DIR=$WMII_DIR..." - rmdir "$WMII_DIR" - exit;; - Warning) ## $@=string - notify-send "wmii warning: $*";; - Key) ## $1=keystroke - Key "$@";; - - ## WMII Window management events - FocusFloating) ## No args - ;; - AreaFocus) ## $1=area - ;; - DestroyArea) ## $1=area - ;; - ColumnFocus) ## $1=column - ;; - CreateColumn) ## $1=column - ;; - - ## Client events - CreateClient) ## $1=client - ;; - DestroyClient) ## $1=client - ;; - Urgent) ## $1=client $2=[Manager|Client] - ;; - NotUrgent) ## $1=client $2=[Manager|Client] - ;; - ClientMouseDown) ## $1=client $2=button - client=$1 - button=$2 - case $button in - 1) ;; - 2) ;; - 3) - { - case `wmii9menu Delete Fullscreen` in - Delete) - echo kill >> $WMII_DIR/client/$client/ctl;; - Fullscreen) - echo Fullscreen on >> $WMII_DIR/client/$1/ctl;; - esac - }& ;; - esac;; - ClientClick) ## $1=client $2=button - ;; - Unresponsive) ## $1=client - client=$1 - client_name=`cat $WMII_DIR/client/$client/label` - msg="The client \`${client_name}' is not responding." - msg+=" What would you like to do?" - { - resp=$(wihack -transient $client \ - xmessage -nearmouse -buttons Kill,Wait -print "$msg") - if [ "$resp" = Kill ]; then - echo slay >> $WMII_DIR/client/$client/ctl - fi - }& ;; - Fullscreen) ## $1=client $2=[on|off] - # TODO: hide any clients with the 'panel' class - ;; - - ## Tag events - CreateTag) ## $1=tag - echo "$WMII_NORMCOLORS" $@ >> $WMII_DIR/lbar/$1;; - DestroyTag) ## $1=tag - rm $WMII_DIR/lbar/$1;; - FocusTag) ## $1=tag - echo "$WMII_FOCUSCOLORS" $1 >> $WMII_DIR/lbar/$1;; - UnfocusTag) ## $1=tag - echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;; - UrgentTag) ## $1=tag $2=[Manager|Client] - echo "$WMII_URGENTCOLORS" $1 >> $WMII_DIR/lbar/$1;; - NotUrgentTag) ## $1=tag $2=[Manager|Client] - echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;; - - ## LeftBar events (usually tag buttons) - LeftBarMouseDown) ## $1=button $2=bar_item - ;; - LeftBarClick) ## $1=button $2=bar_item - shift # ignore the button - echo view "$@" >> $WMII_DIR/ctl;; - LeftMouseDND) ## $1=button $2=bar_item - Event LeftBarClick "$@";; - - ## RightBar events - RightBarMouseDown) ## $1=button $2=bar_item - ;; - RightBarClick) ## $1=button $2=bar_item - ;; - RightMouseDND) ## $1=button $2=bar_item - Event RightBarClick "$@";; - - ## Custom (non-WMII-generated) events - Start) ## No args - Event Quit;; # get out of the way for a new event loop - esac -} ## End Event - -# Key Bindings -Key() { - key=$1 - case "$key" in - ## Moving around - - $MODKEY-$LEFT) ## Select the client to the left - echo select left >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-$RIGHT) ## Select the client to the right - echo select right >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-$UP) ## Select the client above - echo select up >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-$DOWN) ## Select the client below - echo select down >> $WMII_DIR/tag/sel/ctl;; - - $MODKEY-space) ## Toggle between floating and managed layers - echo select toggle >> $WMII_DIR/tag/sel/ctl;; - - ## Moving clients around - - $MODKEY-Shift-$LEFT) ## Move selected client to the left - echo send sel left >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-Shift-$RIGHT) ## Move selected client to the right - echo send sel right >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-Shift-$UP) ## Move selected client up - echo send sel up >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-Shift-$DOWN) ## Move selected client down - echo send sel down >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-Shift-space) ## Toggle selected client between floating and managed layers - echo send sel toggle >> $WMII_DIR/tag/sel/ctl;; - - ## Moving through stacks - $MODKEY-Control-$UP) ## Select the stack above - echo select up stack >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-Control-$DOWN) ## Select the stack below - echo select down stack >> $WMII_DIR/tag/sel/ctl;; - - ## Client actions - $MODKEY-shift-1) ## Toggle selected client's fullsceen state - echo Fullscreen toggle >> $WMII_DIR/client/sel/ctl;; - $MODKEY-shift-0) ## Close client - echo kill >> $WMII_DIR/client/sel/ctl;; - - ## Changing column modes - $MODKEY-d) ## Set column to default mode - echo colmode sel default-max >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-s) ## Set column to stack mode - echo colmode sel stack-max >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-m) ## Set column to max mode - echo colmode sel stack+max >> $WMII_DIR/tag/sel/ctl;; - - ## Running programs - $MODKEY-a) ## Open wmii actions menu - Action $(path_ls $WMII_CONFPATH | wimenu -h "${hist}.actions" -n 5000) & ;; - $MODKEY-x) ## Open program menu - setsid $(wimenu -h "${hist}.progs" -n 5000 <$progsfile) & ;; - $MODKEY-Return) ## Launch a terminal - setsid x-terminal-emulator & ;; - - ## Tag actions - $MODKEY-t) ## Change to another tag - { - tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return - echo view $tag >> $WMII_DIR/ctl - }& ;; - $MODKEY-Shift-t) ## Retag the selected client - sel=$(sed 1q $WMII_DIR/client/sel/ctl) - { - tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return - echo "$tag" >> $WMII_DIR/client/$sel/tags - }& ;; - esac -} ## End Key - -# WM Configuration -echo font xft:Monospace-8 >> $WMII_DIR/ctl -echo focuscolors $WMII_FOCUSCOLORS >> $WMII_DIR/ctl -echo normcolors $WMII_NORMCOLORS >> $WMII_DIR/ctl -echo grabmod $MODKEY >> $WMII_DIR/ctl -echo border 1 >> $WMII_DIR/ctl -xsetroot -solid "$WMII_BACKGROUND" & - -progsfile=$WMII_NAMESPACE/.proglist -path_ls $PATH > $progsfile & - -eval arg `scansection Key|cut -sf2` >> $WMII_DIR/keys - -# Clear the LBar -find $WMII_DIR/lbar -type f -delete - -# Emulate [Create|Focus]Tag events -seltag=`sed 1q $WMII_DIR/tag/sel/ctl` -lstags | while read tag; do - Event CreateTag "$tag" - if [ "$tag" = "$seltag" ]; then - Event FocusTag "$tag" - fi -done - -Action autostart 2>/dev/null & +# Let any running instances of wmiirc know that we're starting +PIDFILE=$WMII_NAMESPACE/.wmii.pid +echo $$ > $PIDFILE -if [ -f "`conffile wmiirc_local`" ]; then - . "`conffile wmiirc_local`" -fi +Event WmiircStart trap "Event Quit" EXIT # use wmiir so it doesn't look like an open file -wmiir read /event | while read event; do - Event $event +wmiir read /event 2>/dev/null | while read event; do + [[ $$ = $(cat $PIDFILE) ]] && Event $event done + +Event WmiircQuit -- cgit v1.2.3-54-g00ecf From 8996d931f15ae50bbae47bbafbd950fc420d2428 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 17:38:06 -0400 Subject: wmii: add help-events and help-keys actions --- .wmii/help-events | 3 +++ .wmii/help-keys | 3 +++ 2 files changed, 6 insertions(+) create mode 100755 .wmii/help-events create mode 100755 .wmii/help-keys diff --git a/.wmii/help-events b/.wmii/help-events new file mode 100755 index 0000000..25b7d41 --- /dev/null +++ b/.wmii/help-events @@ -0,0 +1,3 @@ +#!/bin/bash +. "$HOME/.wmii/include.sh" +scansection Event | xmessage -file - diff --git a/.wmii/help-keys b/.wmii/help-keys new file mode 100755 index 0000000..c6e7038 --- /dev/null +++ b/.wmii/help-keys @@ -0,0 +1,3 @@ +#!/bin/bash +. "$HOME/.wmii/include.sh" +scansection Key | xmessage -file - -- cgit v1.2.3-54-g00ecf From 198455ac623054f46b4da3fec040fb7cb0494ce1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 18:58:09 -0400 Subject: wmii: clean up a vew variables --- .wmii/config.sh | 13 ++++++------- .wmii/include.sh | 4 ---- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.wmii/config.sh b/.wmii/config.sh index abe378f..58217fa 100644 --- a/.wmii/config.sh +++ b/.wmii/config.sh @@ -6,6 +6,8 @@ DOWN=n LEFT=b RIGHT=f +HIST="`conffile history`" + # Colors tuples: " " . `conffile theme-solarized-dark` @@ -37,9 +39,6 @@ Event() { # Configure X11 xsetroot -solid "$WMII_BACKGROUND" - # Generate dynamic files - path_ls $PATH > $progsfile - # Clear the LBar and RBar find $WMII_DIR/{l,r}bar -type f -delete # Populate the LBar by emulating [Create|Focus]Tag events @@ -210,22 +209,22 @@ Key() { ## Running programs $MODKEY-a) ## Open wmii actions menu - Action $(path_ls $WMII_CONFPATH | wimenu -h "${hist}.actions" -n 5000) & ;; + Action $(path_ls $WMII_CONFPATH | wimenu -h "${HIST}.actions" -n 5000) & ;; $MODKEY-x) ## Open program menu - setsid $(wimenu -h "${hist}.progs" -n 5000 <$progsfile) & ;; + setsid $(path_ls $PATH | wimenu -h "${HIST}.progs" -n 5000) & ;; $MODKEY-Return) ## Launch a terminal setsid x-terminal-emulator & ;; ## Tag actions $MODKEY-t) ## Change to another tag { - tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return + tag=$(lstags | wimenu -h "${HIST}.tags" -n 50) || return echo view $tag >> $WMII_DIR/ctl }& ;; $MODKEY-Shift-t) ## Retag the selected client sel=$(sed 1q $WMII_DIR/client/sel/ctl) { - tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return + tag=$(lstags | wimenu -h "${HIST}.tags" -n 50) || return echo "$tag" >> $WMII_DIR/client/$sel/tags }& ;; esac diff --git a/.wmii/include.sh b/.wmii/include.sh index 43855e6..d4e58c3 100644 --- a/.wmii/include.sh +++ b/.wmii/include.sh @@ -8,8 +8,4 @@ if [ -z "$WMII_DIR" ]; then fi . "$HOME/.wmii/util.sh" - -hist="`conffile history`" -progsfile=$WMII_NAMESPACE/.proglist - . "$HOME/.wmii/config.sh" -- cgit v1.2.3-54-g00ecf From b18a02654e2c8b4a91f7c97352b75464e24c6edb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 18:59:31 -0400 Subject: wmii: redo the mount/unmount and quit code --- .wmii/config.sh | 28 ++++++++++++++++++---------- .wmii/util.sh | 7 +++++++ .wmii/wmiirc | 9 ++------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.wmii/config.sh b/.wmii/config.sh index 58217fa..4c2da38 100644 --- a/.wmii/config.sh +++ b/.wmii/config.sh @@ -28,9 +28,8 @@ Event() { ## Custom (non-WMII-generated) events WmiircStart) ## No args echo ' ==> Starting wmiirc' - 9umount "$WMII_DIR" &>/dev/null # just in case - mkdir -p "$WMII_DIR" - 9mount -i "unix!$WMII_NAMESPACE/wmii" "$WMII_DIR" + is_mounted $WMII_DIR && Event WmiircUnmount + Event WmiircMount # Configure wmii < "`conffile tagrules`" expand_variables >> $WMII_DIR/tagrules @@ -54,15 +53,24 @@ Event() { Action autostart 2>/dev/null & ;; WmiircQuit) ## No args - Event Quit;; - ## WMII-meta events - Quit) ## No args echo ' ==> Stopping wmiirc' - echo " -> unmounting WMII_DIR=$WMII_DIR..." - 9umount "$WMII_DIR" - echo " -> rmdir'ing WMII_DIR=$WMII_DIR..." - rmdir "$WMII_DIR" exit;; + WmiircMount) ## No args + echo " -> Creating mountpoint WMII_DIR=$WMII_DIR..." + mkdir -p "$WMII_DIR" + echo " -> Mounting WMII_DIR=$WMII_DIR..." + 9mount -i "unix!$WMII_NAMESPACE/wmii" "$WMII_DIR";; + WmiircUnmount) ## No args + echo " -> Unmounting WMII_DIR=$WMII_DIR..." + 9umount "$WMII_DIR" + echo " -> Removing mountpoint WMII_DIR=$WMII_DIR..." + rmdir "$WMII_DIR";; + ## WMII-meta events + Quit) ## No args + echo ' ==> wmii quit: unmounting' + trap - EXIT + Event WmiircUnmount + Event WmiircQuit;; Warning) ## $@=string notify-send "wmii warning: $*";; Key) ## $1=keystroke diff --git a/.wmii/util.sh b/.wmii/util.sh index 3234783..43d7d4a 100644 --- a/.wmii/util.sh +++ b/.wmii/util.sh @@ -31,6 +31,13 @@ expand_variables() { done } +is_mounted() { + dir="$(readlink -m $1)" + mntpnt="$(cut -d' ' -f2 /proc/mounts|grep -- "$dir")" + [[ $dir = "$mntpnt" ]] + return $? +} + ################################################################################ # PATH manipulation # ################################################################################ diff --git a/.wmii/wmiirc b/.wmii/wmiirc index c513cd1..1f1ea18 100755 --- a/.wmii/wmiirc +++ b/.wmii/wmiirc @@ -1,17 +1,12 @@ #!/bin/bash . "$HOME/.wmii/include.sh" -# Let any running instances of wmiirc know that we're starting -PIDFILE=$WMII_NAMESPACE/.wmii.pid -echo $$ > $PIDFILE +wmiir xwrite /event WmiircQuit # close any existing wmiirc's Event WmiircStart trap "Event Quit" EXIT -# use wmiir so it doesn't look like an open file wmiir read /event 2>/dev/null | while read event; do - [[ $$ = $(cat $PIDFILE) ]] && Event $event + Event $event done - -Event WmiircQuit -- cgit v1.2.3-54-g00ecf From 3515a46d330af1d09bf1e0b963c13a86c2dbe8a8 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 18:59:51 -0400 Subject: wmii: touch up --- .wmii/config.sh | 2 +- .wmii/fixes.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.wmii/config.sh b/.wmii/config.sh index 4c2da38..1dac0ad 100644 --- a/.wmii/config.sh +++ b/.wmii/config.sh @@ -34,7 +34,7 @@ Event() { # Configure wmii < "`conffile tagrules`" expand_variables >> $WMII_DIR/tagrules < "`conffile ctl-init`" expand_variables >> $WMII_DIR/ctl - scansection Key|cut -sf2 >> $WMII_DIR/keys + scansection Key | cut -sf2 >> $WMII_DIR/keys # Configure X11 xsetroot -solid "$WMII_BACKGROUND" diff --git a/.wmii/fixes.sh b/.wmii/fixes.sh index 6e1f38b..aa09157 100644 --- a/.wmii/fixes.sh +++ b/.wmii/fixes.sh @@ -5,7 +5,7 @@ # Usage: ls DIRECTORY # Linux's 9p kernel module sometimes omits entries in directory listings ## -unalias ls 2>/dev/null +unalias ls &>/dev/null ls() { real_ls="`which ls` -1F" [ $# = 0 ] && set -- "`pwd`" -- cgit v1.2.3-54-g00ecf