SelfControl for Ubuntu, GitHub to the rescue!

A colleague was wondering if there was a version for Ubuntu of SelfControl, a nice supporting application for those of us suffering from... difficulties focusing, let's say.

Sure enough, there is. Here is the original homepage of SelfControl for Ubuntu (found thanks to the excellent OMG! Ubuntu page).
However, the package that can be found there is quite old, and has a very annoying bug when you run it on Ubuntu 12.10: You can't see the list of hosts that you are blocking. Other than that, it works as described.
Since this is open source software, I decided to try to fix things myself, to fail utterly due to my total lack of knowledge of Perl and GTK. But! GitHub to the rescue! I couldn't be the only one to notice this, right?
There were actually at least two possible sources: zengargoyle and serch.
I picked the later one, downloaded the UI.pm file from his repository, replaced /usr/share/perl5/SelfControl/UI.pm with this updated version, and...

Success!!

Now back to work! :)

Update:
Looks like more detailed instructions could be useful.

  1. Install the package found in the OMG Ubuntu article.
  2. Open a terminal by pressing Ctrl-Alt-T or looking for it in the Applications list.
  3. In the terminal, enter exactly this line (it's all one line):

    sudo wget http://goo.gl/wVk3k -O /usr/share/perl5/SelfControl/UI.pm
  4. You will need to enter your user password. This line will, in one go, download the "raw" code of UI.pm and overwrite the original UI.pm that came in the package. I shortened the link to try to get it as clear as possible. The actual link to the "raw" code of UI.pm is this:
    https://raw.github.com/serch/selfcontrol/master/lib/SelfControl/UI.pm
Let me know if you run into more issues!



Comments

  1. Hi there,
    I'm having problems deleting previous or double entries to the list of websites that I want to block for a couple of hours. When I start a new study session with SelfControl, I can't see or increase the list of hosts already present in the main window, there's no handle to re-size it. I've tried replacing the UI.pm file (145kB) with the one in /usr/share/perl5/SelfControl/ but now something is wrong -- I click on the icon but the app won't start!

    ReplyDelete
  2. I've done what you suggested but the application won't start if I click on it.
    What to do after I replace the UI.pm file?

    ReplyDelete
  3. The UI.pm file is 13kB in size for me, not 145kB.
    Try using this link to download the one I used: https://raw.github.com/serch/selfcontrol/master/lib/SelfControl/UI.pm

    I'll update the post to give more detailed steps.

    To find out if something went wrong, try opening a terminal (press Ctrl-Alt-T or look for Terminal in the Applications list).
    Then type:
    SelfControl
    and press Enter.
    It should give you some error message if things don't work.

    ReplyDelete
  4. Hi,
    I managed to solve that annoying problem by adding few lines in the original UI.pm file (13kB) via gedit, in sudo mode, from Terminal. There's a thread in askubuntu.com too: http://askubuntu.com/questions/232571/how-to-empty-the-active-block-list-in-selfcontrol

    ReplyDelete
  5. Hi, so glad to discover this!

    What do you think it would take to modify the way this works so that I can schedule daily self-control times (e.g. certain sites blocked 9am-5pm, or all sites blocked midnight to 6am) in advance? I'm happy to do things to config files in my system for now, and I could test out some things and let you know how it goes if you like, but right now I need a pointer about what I would have to start experimenting with, as I don't yet know how SelfControl does what it does. Thanks for any hints you have!

    ReplyDelete
  6. FYI: you can only add more host to the block list when your computer connected to the Internet.

    ReplyDelete

Post a Comment