Hack On Self: The Alt-Tab Annihilator

Last time, I told you about a simple script I made to collect data about my laptop activity, talked about why collecting data about yourself is a moral imperative, and shared the upgraded script with you alongside my plans for it. Today, I will show you a problem I’ve been tackling, with help of this script and the data it gives, and I also would love to hear your advice on a particular high-level problem I’m facing.

Today’s problem is as old as time – I often can’t focus on tasks I badly need done, even ones I want done for myself. This has been a consistent problem in my life, closing off opportunities, getting me to inadvertently betray my friends and family, hurting my health and well-being, reinforcing a certain sort of learned helplessness, and likely reinforcing itself as it goes, too.

It’s deeply disturbing to sit down fully intending to work on a project, then notice no progress on it hours later, and come to a gut-wrenching realization you’ve had hundreds of such days before – I think this screws with you, on a fundamental level. Over the years, I’ve been squeezing out lessons from this failure mode, making observations, trying out all sorts of advice, in search of a solution.

Join me today in non-invasive brain augmentation and reprogramming, as I continue trying to turn my life around – this time, with help of my laptop, a computer that I already spend a ton of time interfacing with. Ever notice that starting work on a task  is often the hardest part of it? It’s the same for me, and I decided to hack away at it.

Staying On Track

As you might recall from the last article, I wrote a program that produces a stream of “currently open window” data – which is a good proxy for “what I’m doing right now”. That looks like a good start for figuring out when I’m planning to do a specific task and end up doing something else entirely!

Starting small, what kind of specific problem could I solve here? Let’s see. There’s a difficulty jump when I’m starting certain kinds of tasks (like writing articles!), but the difficulty lowers a fair bit once I’ve been typing for a few minutes. In that crucial time, it’s way too easy for me to Alt-Tab and get distracted, and not just then – I also become more distractable when I stumble upon a hard-to-write block of text. As you might imagine, Alt-Tabbing when things are hard is the undesirable kind of habit to develop, and I’m concerned that this habit is priming me to give up early when I’m struggling. It’s definitely not the kind of brain wiring I ever wanted to have!

I don’t even notice when I Alt-Tab away from a task I’m not yet focused on. It’s not a conscious reaction – instead, it’s more like a split-second reflex. This concerns me – Alt-Tabbing from a hard task is not something I genuinely think I should do, it’s more of a coping mechanism, and an effective one at that.

how to quickly build helpful tools that are easy to use? consider this.

The idea to fix this problem was simple – making noises into my headphones when I Alt-Tab into something I’m not supposed to Alt-Tab into, and stopping the noises once I’m back on track, very rudimentary negative feedback. I already rely on headphones to listen to music and videos as I write, so that’s the actuator sorted out.

As for classification, I could classify the windows as I went about it, using hotkeys – unknown windows resulting in a noise by default, requiring me to whitelist windows manually. Whitelisting makes the most sense – there’s an infinite amount of possible distractions, and a limited amount of windows I want to be focused into. An important project was upcoming, and I couldn’t afford to fail it, so I switched into “I must have this ready today” mode and finished it in an evening’s time.

A lot of required building blocks, were things I already had developed by then – for instance, it’s best for me to monitor hotkeys using direct evdev input, instead of DE-provided mechanisms, which are limited, and I had enough code for it written already. As for audio, the usual import pygame trick everyone uses to play short audio clips from Python, was nowhere near quick enough, and didn’t even really let me control audio playback. Instead, I wrote a small proof-of-concept library using gstreamer to play audio files on a whim. I pilfered an online sound effect library a little, arming myself with files like Siren.wav, Martian Scanner.wav and Alarm Alert Effect.wav, then glued the building blocks together, added a simple task tracking system on top, and got a working prototype.

The algorithm currently is simple and effective. Press a hotkey to start a new task or resume a previous one – a task contains a list of “good” windows, and optionally a list of “bad” windows. There’s a global whitelist of known-good windows, containing mostly window titles like New Window - Firefox and Save As. When I open a new window, the system starts beeping at me within half a second – giving me immediate feedback that my Alt-Tab was perhaps uncalled for. As it’s beeping, I have the option to either whitelist a window for this specific task, or blacklist it – the whitelisting stops the beeping immediately, and the latter raises the beeping noise intensity next time I switch to the window again. As I’m working Alt-Tabbing between windows I need, the workplace is, and whenever I switch to a blacklisted window, I instantly get a notification that this particular window switch is not something I want myself to be doing.

Hotkeys are focused on the right side of the keyboard, using right Ctrl and AltGr – an underutilized hotkey space.

Hotkey input, audio output – the system ties into the “flow” state pretty damn well, as long as I am wearing headphones – they are required for this specific augment program. And thankfully, I wear my headphones 24/7 already. Of course, I had to make the algorithm less obtrusive – make the relationship between “current window” and “what I’m doing right now” into a more direct one.

There’s a few heuristics I’ve added, that “normalize” the window name – for instance, Notepad++ adds an * in front of the title if you haven’t yet saved the document, which makes the window title change every time you save your text file, Discord, Gmail and YouTube append unread notification numbers in front of the tab (each in their own way), and GIMP puts the currently open image resolution in the title, which results in plenty of beeps as I’m resizing article images for Hackaday articles. Also, I ended up adding a few of my closest friends’ nicknames into the global whitelist – people I want to make sure I always pay attention to.

Does it Work?

Exceptionally well – I just used this system to write the very words you’re reading, this entire article, and many articles you might’ve read before. The audio files seem to lose their effectiveness over time, but I’ll soon be trying out swapping the files to a different sound – it’s not like there’s a shortage of siren sounds online. As you might noticed, in the end, I’ve built something like Windows Recall, except my program is a thousand times simpler, to its benefit. It is also consensual, open-source, and it actually does something directly useful for me, not to mention that it does not capture any passwords or private messages by accident.

I’ve been using this script for the past few months’ time, and my life is notably better nowadays because of it. Sometimes it’s finishing an article where the conclusion can’t quite seem to come into words, sometimes it’s pushing myself through writing a tricky email I must send out, and sometimes it’s staying in a chatroom with a friend helping them as they’re dealing with some emotional turmoil. Alt-Tabbing away from these situations never helps me or anyone else, somehow, it’s a reflex I ended up with, and I’m hell bent on rooting it out. Slowly, over time, it helps me re-align my life in the way I always wished it to be.

One thing I’ve noticed over time – this project focuses mainly on negative reinforcement. I don’t want to lean into negative reinforcement – it has notable negative consequences. For me, I often don’t want to switch into “task” mode when I’m supposed to work on something. This means that I have to look for various ways to add positive reinforcement sources to my life, and, I’m coming up short. I’ve also noticed that I rarely ever blacklist windows – instead, leaving the even distracting ones in the “beeping” state; associating a distraction window with a more-intense beep is not something I can quite teach myself to do automatically, somehow, even though I adore everything else about the system. There absolutely are methods of positive reinforcement that can work, so not tapping into that feels like a major waste.

I want to ask you all about positive reinforcement – it’s something I am a little baffled about. I strongly suspect that a cultural layer is missing here, because it feels so much easier to think of methods for negative reinforcement than positive reinforcement. Is it that my culture doesn’t treat positive reinforcement with the respect it deserves, or did I get trapped in a self-reinforcing loop because I only knew to put points in a specific skill tree? Maybe a mix of these two, maybe something else, the outcome here is the same – I struggle to come up with positive reinforcement methods, and today’s augment reflects it.

Positive Reinforcement: Gamification?

We have quite a few shining examples of positive reinforcement done right, like videogames – they rely a ton on it, at their core, tapping into fundamental human drives I didn’t even know I had. Some do it a little too well, usually, when money gets involved.

There’s a wealth of material on just how much focus you can extract from someone – the video above is a good introduction. Modern-day mobile games are a well-known offender, to the point where smartphone gaming companies hire behavioural psychology researchers, who then get paid to figure out ways of capturing our attention and converting it into money, hijacking the brains of people most susceptible. The consequences of the mobile game microtransaction-backed reinforcement loops are pretty daunting, and have a close parallel with gambling – from people pushed to recklessly spend their money, to increased suicidality and depression, and most often, significantly reduced ability to achieve tasks in day-to-day life. Remember the perils of external data collection? Once again, large entities wield significant power over us, in ways we barely discuss, and we get none of the benefits – even though we could benefit tremendously if we started to use the same methods.

honestly, I just want this kind of menu, but for tasks that actually benefit me

Videogame-tailored methods sure work well on me, in particular – I’ve spent dozens upon dozens of hours in videogames, feeling pretty fulfilled in life as I go through a list of in-game tasks, or perfect a level time after time. It’s not an unpopular topic, either – you’ll find quite a few open-source solutions trying to tap into it. Where’s my own quest menu, and why can’t I have a quest progression system for my real-life tasks? Why is this system of positive reinforcement reserved to virtual stories that I will forget in a year’s time?

I’ve only started learning about all the yet-unexplored ways of positive reinforcement harnessing, and there’s a ton of them that could work pretty well, and I keep discovering new options – just that they’re harder to think of. Audio feedback works for me well when it comes to noticing unwanted Alt-Tab presses – what about figuring out when I’m doing well, and giving me audio feedback on it too? Tracking time spent in whitelisted windows, together with monitoring typing speed, the system could put pleasant sounds in my headphones as long as I’m focused, reminding me that I’m on the right track, or maybe provide a summary right after. Could this help, or would it be distracting? Can’t know until I finally try them out, one by one.

What about keeping a running-tally summary of what I hack on, and perhaps creating some sort of “streak” or “levelling” system? Maybe, each morning, giving me an overview on how my days went? I’ve written a “productivity calendar” program before, a generator of printable PDFs for each month. Every day, I’d try and write in my day-to-day tasks with a ballpoint pen.

“Productivity” is not a word I use anymore – I find it tainted, typically aimed at you from the outside world. Today, I’d call this a “hacking calendar”.

It largely failed to uphold itself – the A4 sheet of paper and a pen were easy to lose track of, given how I move from place to place all the time. It would be pretty simple to repurpose this script, however, putting task summaries into the empty boxes and regenerate it every hour. Say, I have this summary generate & open automatically each morning, right after I wake up – could it help? What about adding messages from the past into the mix? I’m probably jumping ahead a bit too much here – this one’s a whole self-hacking topic of its own.

Once again, sadly, I have committed the sin of not collecting enough data over time – this program, too, needs to grow an API. The bringup of my software stack has been pretty recursive, in a bad way, aimed at solving exactly the problems preventing me from working on it – an uphill climb with no peak in sight. Seems like I really ought to forgive myself for this journey taking years. Exploring new ground, with what feels like barely enough language to describe it, is not a pleasant process, but today’s Alt-Tab Annihilator program has helped me gain a strong foothold that felt long overdue, and it helped me spot a fundamental weakness in the way I learn, too.

Thankfully, I know that I can ask advice from your all. What’s your experiences, ideas, and opinions on positive reinforcement methods? What kind of positive reinforcement methods do you use for yourself, or wish that someone explored?

11 thoughts on “Hack On Self: The Alt-Tab Annihilator

  1. Fundamentally, doing stuff on computers means that positive reinforcement is hard. If I dig a ditch, the ditch is real, and does a thing. I can go look at it later. There are things one can do on a computer to provide positive reinforcement, but it’s hard because it’s abstract, and it’s REALLY hard to compete with the huge industries that do positive reinforcement on computers (games, social media, etc). My suggestion would be to intentionally do more tangible things.

    1. “Tangible” is an interesting thing – helping others is a pretty tangible goal for me, even if it’s something that happens purely online, and, somehow, leveling up in videogames feels like a pretty tangible thing for me, too. Plus, at this point, I don’t get to pick the “type of things I do” as much – I have a life direction I’m pretty happy with, which does require a list of pretty tangible things from me, yet, those things might not always feel tangible from where I am at different points in time. So, gotta work with what I currently have =D

  2. I have made my fair share of tech to help with “productivity”. A phone widget which would show hours left until I hit 80 years of age (meant to scare me into working). Another simple but cool device was the device in the link below, an ESP8266 which would connect to my home server and keep track of how long I worked that day (I had to set it manually, but it worked well enough).

    https://imgur.com/a/epOgzOL

    Nothing ever worked for me, except

    Actually WANTING to finish the job
    Minimising distractions

    These days I just put my headphones on, listen to some synthwave music on low volume and get the job done. Of course, for that you have to deal with the hardest problem – wanting to do it and not just procrastinate ad infinitum.

    1. oh yeah I remember your comment from the first article!

      I don’t believe that “actually wanting” is real. In my experience, it’s an amorphous blob of a concept somewhere alongside “lazy” – it’s never helped me understand how executive function actually works or what actions t taoe. “want” IME is a pretty vague direction modulated by a myriad of factors: current ability of focus, tiredness levels, having the mental context ready, perceived difficulty of the task, emotions associated with the task, and so on. wherever I see “actually want”, it’s usually used to dumb down this complex interplay into a single variable, and I don’t believe that to be useful. Instead, I highly recommend learning what lies underneath.

      as for music – absolutely! music can modulate focus pretty wonderfully; I’ve been thinking about hotkey’ing some playlists for a proof-of-concept “focus helper”!

  3. I have to look for various ways to add positive reinforcement sources

    I often alt-tab away from a task when I have to wait for it to finish (conf. xkcd #303). Because most of such tasks i run in a shell, I made the prompt contain “\a” which makes xterm (and other terminals too) set an urgent hint on its window, which in turn depending on WM makes the window blink or do something else to draw my attention back. Currently I use liquid-prompt which can be configured to print “\a” if a command takes longer than a threshold to complete.

    Maybe it’s not a carrot, but it isn’t a stick either.

    1. oh that’s lovely! yeah I’m looking to write my own beep replacement; the typical one doesn’t seem to work on new systems. I have surprisingly few “runs for a long time” tasks in my own projects – a lot of my stuff is writing, PCB design, figuring out things together with friends, and so on. However, for such tasks – have you seen xnotify? it’s pretty wonderful, I use it for “get a red warning box in the center of the screen” kind of notifications, and it’s easily scriptable.

  4. Having ADHD and getting things done has been a lifelong struggle. I constantly find myself drawn to more interesting, but lower priority projects at work, than tedious, high priority projects. One pitfall I’ve come to discover for me is when I’m waiting 30 s or more for something to compile, I’ll shift to something else so I’m not “wasting time”, which usually ends up taking 10 min or more to come back. I’m now trying to just sit and wait for 30-60 s compilations to complete, rather than get derailed for many minutes. On the other hand, occasionally I’m able to hyper focus on the project that I should be working on, and I get huge amounts of work done in a relatively short amount of time. That’s pretty rare though.

    1. yeahhhhh this is a big problem, I call it “iteration intervals”, reducing those as much as possible is seriously fruitful. I ended up avoiding such long-winded tasks as much as possible in the kinds of things I do, and making sure my hardware is fast enough that routine tasks don’t take too long of a time. Still, this is a problem for writing and maintaining code tests in a large project I’m hacking on – the iteration interval for running the entire test suite is long enough, I invariably get distracted from the task in the meantime. Next time I get back to it, though, I’m going to try and put a xnotify call into an alias and run it like ./test.sh; beep – gives me floats-above-all bright red notification bubbles that are pretty hard to miss or accidentally close!

  5. If anyone is interested, I’ve been studying psychology for the past decade or so and have put together a project, on Hackaday.io, to improve motivation.

    It presents some of the information we know about motivation and gives it to the reader, and also asks the reader to do exercises that are known to increase motivation. It also uses some psychological tricks to increase motivation, such as priming.

    https://hackaday.io/project/180726-motivation

    Ironically, I didn’t actually finish that project. Not because I lost interest, but because there was no external interest from others. I know a fair bit about motivation now, I sometimes use the project on myself, but making an entire project that no one else is interested in is a bit of a stretch.

    This led me to examine my inner feelings of exactly why I put projects up on .IO in the first place, and has led me to stop documenting my projects on .IO. Some of which are interesting and would probably be written up in the blog, but again if there’s no value for others then there’s little reason for doing so.

    (Right now I’m refurbishing a harpsichord, and could easily document my progress and what I’ve found out, how to make the keys smooth and how to voice the jacks and all… but again, why bother?)

    Everything is a project, and everything takes time. Writing things up for .IO makes everything two projects, and takes twice as much time.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.