Skip to content

Instantly share code, notes, and snippets.

@monokrome
Created June 23, 2012 08:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monokrome/2977584 to your computer and use it in GitHub Desktop.
Save monokrome/2977584 to your computer and use it in GitHub Desktop.
My .xinitrc process for running window managers through SLiM.
#!/bin/bash
# An additional script that will execute for wm-specific configuration
wm_init_script = "${HOME}/.config/${1}/init.sh"
# Execute the window manager and save it's pid for later
exec $1 &
wm_pid = $!
# A bit of a time gap for the window manager to get started.
sleep 1
# Creates custom keybinds for commands.
xbindkeys &
if [[ -f "${wm_init_script}" ]]; then
exec "${wm_init_script}"
fi
# Wait for the WM to close before this script and it's subprocesses exit
wait ${wm_pid}
#!/bin/bash
while true; do
./status.sh
done &
#!/bin/bash
dwm_status=""
update_interval=5
# Appends the provided arguments as text in the status bar
appendstatus () {
dwm_status=${dwm_status}$@
}
# Get the current playing song if available
xmms2_current=$(xmms2 current | cut -f2 -d: | sed 's/ *$//g | sed 's/^ *//g')
xmms2_status=$(xmms2 current | cut -f1 -d:)
if [[ ${xmms2_status} != Stopped ]]; then
if [[ ${xmms2_status} != Paused ]]; then
appendstatus ${xmms2_current}
fi
fi
# Appends the amount of battery remaining if not charged
battery_remaining=$(acpi | cut -f 2 -d, | sed 's/ *$//g | sed 's/^ *//g')
if [[ "${battery_remaining}"!="100%" ]]; then
if [[ "${dwm_status}" != "" ]]; then
battery_remaining_text=" (${battery_remaining})"
else
battery_remaining_text=${battery_remaining}
fi
appendstatus ${battery_remaining_text}
fi
# Appends the hostname to the status if nothing else is in it
if [[ "${dwm_status}" = "" ]]; then
appendstatus $(hostname)
fi
xsetroot -name "${dwm_status}"
sleep ${update_interval}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment