Last active
March 19, 2017 03:51
-
-
Save FlatTargetInk/67452cdeabe486b78ad195219caed190 to your computer and use it in GitHub Desktop.
Simple display manager for X that doesn't get in the way of using Wayland compositors.
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 | |
function help { | |
echo -e "Usage: fstart [ -h | -a | -d ] [ wm-name ]" | |
echo -e "\t fstart : Starts last-used window manager" | |
echo -e "\t -h | --help : Shows this help" | |
echo -e "\t -a | --add [wm] : Adds new xinitrc file for specified wm " | |
echo -e "\t -d | --delete [wm] : Deletes xinitrc file for specified wm " | |
} | |
if [ $# -ge 1 ]; then | |
case "$1" in | |
-h|--help) | |
help | |
exit | |
;; | |
-a|--add) | |
if [ $# -lt 2 ]; then | |
echo Error, not enough arguments | |
help | |
exit | |
fi | |
"${EDITOR: -vi}" ~/.xinitrc-$2 | |
exit | |
;; | |
-d|--delete) | |
if [ $# -lt 2 ]; then | |
echo Error, not enough arguments | |
help | |
exit | |
fi | |
if [ "$1" == "-d" ]; then | |
echo "Are you sure you want to delete the xinitrc file for $2? [y/n]" | |
read yno | |
if [ "$yno" == "y" ] || [ "$yno" == "yes" ]; then | |
rm -v ~/.xinitrc-$2 | |
exit | |
fi | |
else | |
rm -v ~/.xinitrc-$2 | |
exit | |
fi | |
echo "Not deleting...." | |
exit | |
;; | |
*) | |
if [ ! -f ~/.xinitrc-$1 ]; then | |
echo "You can't type, your dumb, or your file magically disappeared." | |
echo "Can't find file ~/.xinitrc-$1" | |
help | |
exit | |
fi | |
ln -sf ~/.xinitrc-$1 ~/.xinitrc | |
esac | |
fi | |
startx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment