Created
September 25, 2012 19:03
-
-
Save pablox-cl/3783783 to your computer and use it in GitHub Desktop.
Wrapper for xmessage to prevent it from run itself if xmonad has compile errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Author: Pablo Olmos de Aguilera C. pablo at glatelier dot org | |
# | |
# Little wrapper to prevent xmessage to pop if errors are thrown when | |
# (re)compiling xmonad. Of course this assumes that you should recompile it from | |
# the command line. | |
# | |
# Just make sure your $PATH is correctly set, before the original xmessage to | |
# this code run. | |
# | |
# Acknowledgements: | |
# * Brandon Allbery for the suggestion (http://permalink.gmane.org/gmane.comp.lang.haskell.xmonad/12794) | |
# * StackOverflow (once again...) for the ideas about how to know if "string contains": | |
# http://stackoverflow.com/questions/229551/string-contains-in-bash | |
# alternative using regex | |
if [[ "$3" =~ .*rror\ detected\ while\ loading\ xmonad\ configuration\ file:\ | |
.*xmonad/xmonad.hs.* ]]; then | |
# another alternative using wildcards | |
#if [[ "$3" == *.xmonad/xmonad.hs* ]] | |
exit 0 | |
fi | |
/usr/bin/xmessage "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another nice trick is to use the $TERM variable. It is set to "dumb" whenever xmonad is recompiled using mod + q.
Whenever it is recompiled with
xmonad --recompile
$TERM will be set to whatever your terminal is, e.g. xterm-256color.