Automate Logging Out

Pratyay DhondPratyay Dhond
3 min read

Building A distraction Free Zone!

Introduction

I had read about this in the book Make Time, a self-help productivity classic, there are multiple ways and checklist ticks you need to achieve in order to create a distraction free Zone (Like Trafalgar Law's Room).

Trafalgar law about to create a distraction free Room!

It's like creating this zone where you are in control of your attention, and for me who gets distracted easily, it is hard to maintain this zone when all my social media sites (linkedin, whatsapp, discord) are a tap away!

"When distraction is hard to access, you don’t have to worry about willpower."

So all I had to do now was get rid of these websites from being 1 tap away and add some resistance/friction in between.

"The Willpower is a limited resource; lesser you use it, better off you will be!"

It starts now..

So, that is why when I opened my laptop today, and logged into my browser I thought.. why don't I try to setup my browser in a way that every time I close tabs it would auto log-out for me.

  1. This would need a script so that every time I close the tab, before the tab closes, like a destructor a script would run which would sign me off

    OR

  2. I would have to make my browser behave like incognito but only in terms of login activity

Out of the two options I thought the second was easier to implement cause I wasn't feeling like writing a script to run every time. (talk about the overhead it would cause for the websites as well)

I started searching for what was possible and what was not, and then I came across a stackoverflow article which in short said

"... cookies save your info, disable cookies,..." Eureka!

So all I had do to now is, the following,

Steps to follow

  1. Go to browser settings (I use firefox cause it comes with ubuntu ; and it is nice)

  2. Go to privacy and security->cookies and site data

  3. Check the 'Delete cookies and site data when browser is closed' option

The Con (s)... :(

Now there were two downsides to this approach

  1. The logout wasn't happening every time I closed a tab, but it was occurring when the instance of browser was killed.

  2. It was hard to have to sign in to frequent, completely necessary (in today's world) websites such as google.com

The Solutions for the Con(s)..

The first con isn't really a con, its a feature, it might be annoying if I have to scan whatsapp or telegram QR from phone everytime I close the tab!

The second con can be handled with the option for exceptions for deleting cookies

Add Cookies to keep

Just directly add websites which will be allowed to use and store session cookies (such as google for me) -> i.e. cookies to keep!

and tadaa, we are done here, now the moment my browser is closed I am logged out of everything except google!

References

  1. The chapter from the book Make Time

The following is the reason why I decided to do this in the first place!

Thanks for reading!! Do share this among your peer network! Have an amazing day! Till next time <3

1
Subscribe to my newsletter

Read articles from Pratyay Dhond directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Pratyay Dhond
Pratyay Dhond

Learning from my experiences while joking about the stupid mistakes I did in my prior code!