Make script POSIX shell compatible

Thanks a lot for swayshot, it's very helpful!

Right now, the shell script contains quite some bashisms, which should be easy to fix. if [[ ... ]] needs to be replaced with if [ ... ] and declare ... is not POSIX shell compatible either.

Another option would be to explicitly depend on bash and use #!/bin/bash as shebang, but I'd recommend to use POSIX shell for portability reasons instead. Not every system has bash installed.