all repos — dotfiles-extra @ e7b4874516df8a3f5886c29fff1d1ae88e86607a

extra configs that may be extraneous and/or may be platform specific

.config/i3/old_i3_config/battlemode.sh

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
#!/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