Reclaim your focus with ~12 lines of bash
autodidacts.io
autodidacts.io
There are multiple ways to achieve this:
nohup focus.sh &
nohup stands for "no hang up". It will run a command/script in such a way that it ignores the SIGHUP signal. The SIGHUP signal is typically sent to a process when the terminal is closed or the session is terminated [0].Another way could be to put the process in the background and then use `disown`, which removes the job from the shell's job table [1], effectively disassociating it from the shell session. This prevents the job from receiving SIGHUP signals just as before.
./focus.sh &
disown
Finally setsid focus.sh
This will launch the script in a new session [2], so that when you close your terminal it won't receive your current session's SIGHUP signal.A very good StackOverflow explanation [3].
EDIT: actually, ^C the process already is a bit of a PITA since you would then need to manually put back the original /etc/hosts file :D
- [0]: https://www.man7.org/linux/man-pages/man1/nohup.1.html
- [1]: https://linuxcommand.org/lc3_man_pages/disownh.html
- [2]: https://www.man7.org/linux/man-pages/man2/setsid.2.html
Something like:
checking 60m --start-in 30m
export DURATION="${1:-1m}"
it should be just
DURATION="${1:-1m}"
“export” is a keyword that makes a variable available to subprocesses.
One of the most important keys to keep in mind is: always have a clear, delineated next action. Such that no thought is even necessary to know what you need to do. And plan the next step out /before/ you need to perform it, not in the moment of.
In fact, if I've got a project that I'm actually interested in, it'll consume weeks or even months of my time, to the point where I have to make an extra effort to break my focus on spend time doing other things (like going outside).
```
function growl() { echo $"\e]9;\"$1\"\007" }
```
You can however use "osascript" to generate the notification directly, see https://apple.stackexchange.com/questions/57412/how-can-i-tr...
function growl() { osascript -e "display notification \"$1\" with title \"Growl\" "
}