From b5f8ee46f0b8a97ddbe8b21e1605bfe2b41c0cb5 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 14 Aug 2013 15:07:04 -0400 Subject: re-jigger to have most everything in XDG directories --- .config/Makefile | 18 +++++++-- .config/login.local.sh | 11 +++++ .config/login.sh | 106 +++++++++++++++++++++++++++++++++++++++++++++++++ .config/symlinks | 3 ++ 4 files changed, 135 insertions(+), 3 deletions(-) create mode 100644 .config/login.local.sh create mode 100644 .config/login.sh (limited to '.config') diff --git a/.config/Makefile b/.config/Makefile index 391e43c..829b820 100644 --- a/.config/Makefile +++ b/.config/Makefile @@ -1,15 +1,22 @@ +#!/usr/bin/make -f + SHELL = /bin/bash -GITDIR=${HOME}/.git +GITDIR = ${HOME}/.git + +targets = \ + ${GITDIR}/info/exclude \ + ${HOME}/.folders \ + ${XDG_CACHE_HOME}/config-symlinks/cookie \ + ${XDG_CACHE_HOME}/cron/cookie -targets=${HOME}/.folders ${XDG_CACHE_HOME}/cron/cookie ${GITDIR}/info/exclude all: $(targets) clean: rm -f $(targets) ${HOME}/.folders: ${HOME}/Maildir ( echo '..'; find $< -maxdepth 2 -type f -name "maildirfolder" -printf '%h\n'|sed -r 's@.*/(.*\.)(.*)@.\1\2@' )|sort>'$@' -${GITDIR}/info/exclude: .git.info.exclude.in $(shell echo .??*/) +${GITDIR}/info/exclude: ${HOME}/.git.info.exclude.in $(shell echo .??*/) ( cat $<; find $^ -type f -name 'CACHEDIR.TAG' -printf '%h\n'|sed 's@^\./@/@' ) > $@ ${XDG_CACHE_HOME}/cron/cookie: ${XDG_CONFIG_HOME}/cron @@ -17,6 +24,11 @@ ${XDG_CACHE_HOME}/cron/cookie: ${XDG_CONFIG_HOME}/cron mkdir -p '$(@D)' date > '$@' +${XDG_CACHE_HOME}/config-symlinks/cookie: ${XDG_CONFIG_HOME}/symlinks + config-symlinks + mkdir -p '$(@D)' + date > '$@' + ${HOME}/Maildir: mkdir -p '$@'/{cur,new,tmp} ${HOME}/Maildir/%: | ${HOME}/Maildir diff --git a/.config/login.local.sh b/.config/login.local.sh new file mode 100644 index 0000000..25b322b --- /dev/null +++ b/.config/login.local.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# Start background programs ########################################## +if [ -x "`which daemon`" ]; then + daemon -i maildirproc.att maildirproc + daemon -i maildirproc.purdue maildirproc -r ~/.maildirproc/purdue.rc + daemon batterymon 20 " + amixer sset Master unmute 100%; + espeak 'PLUG ME IN'; + sleep .2;" +fi diff --git a/.config/login.sh b/.config/login.sh new file mode 100644 index 0000000..851f4ec --- /dev/null +++ b/.config/login.sh @@ -0,0 +1,106 @@ +#!/bin/sh +# ~/.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. + +# the default umask is set in /etc/profile; for setting the umask +# for ssh logins, install and configure the libpam-umask package. +umask 022 + +## Paths ############################################################# + +# Unix +prefixes=( + "$HOME" + "$HOME/.local.`uname -m`" + "$HOME/.local/bin" + "$HOME/.prefix.`uname -m`" + "$HOME/.prefix" + "$HOME"/.gem/ruby/* +) +for prefix in "${prefixes[@]}"; do + if [[ -d "$prefix/bin" ]]; then + export PATH="$prefix/bin:$PATH" + fi +done + +# Ruby +for dir in "$HOME"/.prefix/lib; do + if [[ -d "$dir" ]]; then + export RUBYLIB="$dir" + fi +done +unset prefixes dir prefix + +# TMPDIR ############################################################# + +if [[ ! -d "$HOME/tmp" ]]; then + tmp="$(mktemp --tmpdir -d "$USER-tmpdir.XXXXXXXXXXXXXXXXXXX")" + ln -sf "$tmp" "$HOME/tmp" + unset tmp +fi +export TMPDIR="$HOME/tmp" + +# XDG ################################################################ + +. "$HOME/.local/lib/xdg.sh" + +# 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}" +fi + +# GPG +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)" ]] && [[ -n $XDG_RUNTIME_DIR ]] && type gpg-agent &>/dev/null; then + mkdir -p "${XDG_RUNTIME_DIR}/sessions" + gpg-agent --daemon --write-env-file "${XDG_RUNTIME_DIR}/sessions/gpg" &>/dev/null +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='' +_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" +fi +export _JAVA_OPTIONS + +# X11 +if [[ -z $XAUTHORITY ]]; then + export XAUTHORITY=$HOME/.Xauthority +fi + +# D-Bus +if [[ -z $DBUS_SESSION_BUS_ADDRESS ]] && type dbus-launch &>/dev/null; then + # I want a separate instance for each login + #dbus-launch > "${HOME}/.cache/sessions/dbus" + #. "${HOME}/.cache/sessions/dbus" + eval `dbus-launch` + + export DBUS_SESSION_BUS_ADDRESS + export DBUS_SESSION_BUS_PID +fi + +# Load any box-specific stuff +if [[ -f "$XDG_CONFIG_HOME/login.local.sh" ]]; then + . "$XDG_CONFIG_HOME/login.local.sh" +fi diff --git a/.config/symlinks b/.config/symlinks index 01c8c4e..05d6631 100644 --- a/.config/symlinks +++ b/.config/symlinks @@ -1,5 +1,8 @@ # target link +# Generic +.config/login.sh .profile + # X11 .config/X11/defaults .Xdefaults .config/X11/clientrc .xinitrc -- cgit v1.2.3