dotfiles/.config/i3/old_i3_config/battlemode.sh

43 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# battlemode.sh
# written by x1phosura
#
# This shell script merely switches i3 configs and restarts i3 to apply the
# changes, but one of the configs is a so-called "battlemode," which is
# sorta exciting I guess. I completely stole this idea from my friend Ethan,
# a fellow Arch i3 dweeb, and I'm really only writing this (besides it being
# cool) because I wanna beat him to it, in case he hasn't implemented his own
# yet.
# This battlemode script is also totally expandable in the future. One could
# add multiple different modes, each with their own file, and other stuff too
#
# Note: there is no 'include' directive or other way to include configurations
# from other files in i3. Technically there's a thing for Xresources, but
# that limits you to Xresources, and is still somewhat limiting. So while this
# isn't the ideal way to implement a "battle mode," it's the most elegant
# solution I could think of given i3's limitation on sourcing configs
# elsewhere.
# directory where i3 configs are stored
I3CONFDIR="/home/$HOME/.config/i3"
# perform the 'ol switcheroo
if [ -e "$I3CONFDIR"/config ]; then
mv "$I3CONFDIR"/config "$I3CONFDIR"/config.temp
if [ -e "$I3CONFDIR"/config.other ]; then
mv "$I3CONFDIR"/config.other "$I3CONFDIR"/config
mv "$I3CONFDIR"/config.temp "$I3CONFDIR"/config.other
else
mv "$I3CONFDIR"/config.temp "$I3CONFDIR"/config
fi
# reloads and restarts i3
i3-msg reload
i3-msg restart
fi