dotfiles/.local/bin/screenlayout-set

25 lines
382 B
Bash
Executable file

#!/bin/sh
die() {
printf '%s: %s\n' "${0##*/}" "$1" >&2
exit 1
}
if [ "$1" = "-" ]; then
while IFS= read -r line; do
input="$line"
done
else
input="$1"
fi
[ -f "$input" ] || die "$input: no such file"
case "$input" in
/*) ;;
*) die "$input: not an absolute path" ;;
esac
ln -sf "$input" "$XDG_DATA_HOME/screenlayout"
. "$XDG_DATA_HOME/screenlayout"