Lock an application open, focused, for a period of time?
December 1, 2011 7:14 PM Subscribe
Hello,
Is it possible to lock an application open? Say I wanted to use Focuswriter (or some other text editor) for one hour without being able to access anything else (like an internet browser) or shutdown, is there any way to do that on Windows or Linux?
Is this a self-control thing? It shouldn't be too difficult to write a script that closes these windows when opened. Autohotkey in Windows is pretty easy to work with. You could write a script to close explorer or whatever as they appear. The script can be set to remain resident. There are also a bunch of self control apps, leechblock, etc you can use without writing any code.
If this is a kiosk type thing, then you should investigate kiosk modes, various types of lockdowns, steadystate, etc.
posted by damn dirty ape at 7:52 PM on December 1, 2011
If this is a kiosk type thing, then you should investigate kiosk modes, various types of lockdowns, steadystate, etc.
posted by damn dirty ape at 7:52 PM on December 1, 2011
Does it HAVE to prevent you from shutting down/rebooting? Because otherwise there's a couple that will cut off your Internet access and give you various options to fullscreen and focus. There's Freedom for Windows, just off the top of my head. You might peruse this Wikipedia article and see if those include the "kill the internet" options.
posted by Ghostride The Whip at 8:10 PM on December 1, 2011
posted by Ghostride The Whip at 8:10 PM on December 1, 2011
I've never heard of such a thing, but it wouldn't be too hard to roll your own in Linux.
I assume the target it yourself or someone else of goodwill, and not a dedicated attacker. (ie, the question is "give me a willpower crutch" not "help me build a stand alone kiosk to install in the subway.") If not, then this becomes a whole lot harder.
Assuming you're doing this in X-windows, then one easy approach would be to use "wmctrl", which is a command line utility that modifies window properties. A simple script could record the time, make your window of choice focused, full-screen, sticky (on-top), and undecorated (with no frame or buttons). It could then continue to check the time, returning your desktop to normal at the end of a set period. A slightly more extended version could also hide all your other windows and keep them hidden, and even check whether you've closed the good application and re-launch it as necessary. (More thorough and tamper-proof options are also straightforward, but would require more work to implement and have the potential for dangerous mistakes. For example, putting your good application and a minimal home directory in a chroot jail and then temporarily making it impossible to log in to the machine itself with a timer.)
If your text editor is a console application running in a terminal, you'll have to do some additional work to make it hard to background it. If you're lazy like me, just remapping the key may be good enough, ie using xmodmap. (If your favorite text editor happens to be my own favorite text editor, you'll also have to disable the browsers, shells, email and news readers, and tetris game built into it. . . )
If that sounds useful, and you're not sure how to go about doing it, I'd be happy to help. (No idea how to do it in Windows, though others here may well have ideas.)
- on preview - qxntpqbbbqxl's suggestion, with a few possible tweeks to make it hard to switch applications, is neat as well.
posted by eotvos at 8:29 PM on December 1, 2011
I assume the target it yourself or someone else of goodwill, and not a dedicated attacker. (ie, the question is "give me a willpower crutch" not "help me build a stand alone kiosk to install in the subway.") If not, then this becomes a whole lot harder.
Assuming you're doing this in X-windows, then one easy approach would be to use "wmctrl", which is a command line utility that modifies window properties. A simple script could record the time, make your window of choice focused, full-screen, sticky (on-top), and undecorated (with no frame or buttons). It could then continue to check the time, returning your desktop to normal at the end of a set period. A slightly more extended version could also hide all your other windows and keep them hidden, and even check whether you've closed the good application and re-launch it as necessary. (More thorough and tamper-proof options are also straightforward, but would require more work to implement and have the potential for dangerous mistakes. For example, putting your good application and a minimal home directory in a chroot jail and then temporarily making it impossible to log in to the machine itself with a timer.)
If your text editor is a console application running in a terminal, you'll have to do some additional work to make it hard to background it. If you're lazy like me, just remapping the key may be good enough, ie using xmodmap. (If your favorite text editor happens to be my own favorite text editor, you'll also have to disable the browsers, shells, email and news readers, and tetris game built into it. . . )
If that sounds useful, and you're not sure how to go about doing it, I'd be happy to help. (No idea how to do it in Windows, though others here may well have ideas.)
- on preview - qxntpqbbbqxl's suggestion, with a few possible tweeks to make it hard to switch applications, is neat as well.
posted by eotvos at 8:29 PM on December 1, 2011
Response by poster: qxntpqbbbqxl, damn dirty ape, Ghostride The Whip, eotvos - thank you.
Yes, you guessed correctly, it's self-control thing.
At the moment I mainly use Windows. I never use IE so I used its Content Advisor feature to block everything on it (the password is written down somewhere at home). I use Firefox with Leechblock (and that password is on a piece of paper at home too). If I know I'll have to use the internet without restrictions I bring in a USB drive with portable Firefox and Chrome on it.
It's a pretty good system.
However, my mind is most at ease when there is nothing else to think about besides getting the words out.
For example, I have research and general articles clipped in Evernote and lots of PDFs of journal articles, which tempt me to do more reading when I really want to just write. Sometimes there are emails in Thunderbird that I haven't replied to yet and that becomes something else to do before writing - so Freedom doesn't help with that.
And, sometimes on days when I only have my Leechblocked Firefox there are sites I need to use but can't.
I'm looking for the flexibility of Freedom but instead of just knocking out the internet connection, I want it to lock me into one app (a text editor) and after the time has expired return to a fully functioning desktop.
I could then have short bursts of intense, very focused writing, when I need to, with the peace of mind of having a computer for an hour that only has the functionality of a typewriter. It would work well with the Pomodoro technique (which I really like).
That's my very 'First World Problem' situation.
Basically, I want something that locks me into a text editor for a set period of time. I hope that explanation helps. I will read more about the suggestions you have made already.
posted by cimuir at 9:14 PM on December 1, 2011
Yes, you guessed correctly, it's self-control thing.
At the moment I mainly use Windows. I never use IE so I used its Content Advisor feature to block everything on it (the password is written down somewhere at home). I use Firefox with Leechblock (and that password is on a piece of paper at home too). If I know I'll have to use the internet without restrictions I bring in a USB drive with portable Firefox and Chrome on it.
It's a pretty good system.
However, my mind is most at ease when there is nothing else to think about besides getting the words out.
For example, I have research and general articles clipped in Evernote and lots of PDFs of journal articles, which tempt me to do more reading when I really want to just write. Sometimes there are emails in Thunderbird that I haven't replied to yet and that becomes something else to do before writing - so Freedom doesn't help with that.
And, sometimes on days when I only have my Leechblocked Firefox there are sites I need to use but can't.
I'm looking for the flexibility of Freedom but instead of just knocking out the internet connection, I want it to lock me into one app (a text editor) and after the time has expired return to a fully functioning desktop.
I could then have short bursts of intense, very focused writing, when I need to, with the peace of mind of having a computer for an hour that only has the functionality of a typewriter. It would work well with the Pomodoro technique (which I really like).
That's my very 'First World Problem' situation.
Basically, I want something that locks me into a text editor for a set period of time. I hope that explanation helps. I will read more about the suggestions you have made already.
posted by cimuir at 9:14 PM on December 1, 2011
On linux with fluxbox this would be pretty simple.
I'm sure you could do something similar with other window managers but fluxbox is what I use so it's really the only one I can give you specifics for.
Steps:
1. create a new account specifically for writing/working.
All configuration in fluxbox is done with simple text config files:
2. startup - in this file, put the text editor/word processor you want to use
3. keys - this file describes keyboard shortcuts. Delete (most of) the contents of this file, except for a shortcut to logout when you're done. This will take away all your access to menus, program launchers, shells, pretty much everything. These are system shortcuts, application specific shortcuts (ctrl-s, etc) will still work as expected.
4. apps - this file deals with the placement and display of applications. You can use it to set your text editor to fullscreen, remove buttons and titlebar, etc. You can also do this via a window menu so you wouldn't have to edit the file manually.
This wouldn't make it impossible for you to check on other stuff but it would make it pretty inconvenient since you'd have to log out, procrastinate, log back in, work, log out, and so on. When you're done just log into your normal account.
This has the added advantage that all your writing/work would be in one place completely separate from all your media, music, and other personal files.
Anyway, that's what I'd do, or something similar. Feel free to get in touch if you need more specifics.
posted by Mister_Sleight_of_Hand at 3:45 AM on December 2, 2011
I'm sure you could do something similar with other window managers but fluxbox is what I use so it's really the only one I can give you specifics for.
Steps:
1. create a new account specifically for writing/working.
All configuration in fluxbox is done with simple text config files:
2. startup - in this file, put the text editor/word processor you want to use
3. keys - this file describes keyboard shortcuts. Delete (most of) the contents of this file, except for a shortcut to logout when you're done. This will take away all your access to menus, program launchers, shells, pretty much everything. These are system shortcuts, application specific shortcuts (ctrl-s, etc) will still work as expected.
4. apps - this file deals with the placement and display of applications. You can use it to set your text editor to fullscreen, remove buttons and titlebar, etc. You can also do this via a window menu so you wouldn't have to edit the file manually.
This wouldn't make it impossible for you to check on other stuff but it would make it pretty inconvenient since you'd have to log out, procrastinate, log back in, work, log out, and so on. When you're done just log into your normal account.
This has the added advantage that all your writing/work would be in one place completely separate from all your media, music, and other personal files.
Anyway, that's what I'd do, or something similar. Feel free to get in touch if you need more specifics.
posted by Mister_Sleight_of_Hand at 3:45 AM on December 2, 2011
Indirect response:
I read a long time ago that a specific writer (Cory Doctorow?) would drop in hashtags (##) wherever he needed to look something up. Then he would just keep writing.
posted by jander03 at 7:00 AM on December 2, 2011
I read a long time ago that a specific writer (Cory Doctorow?) would drop in hashtags (##) wherever he needed to look something up. Then he would just keep writing.
posted by jander03 at 7:00 AM on December 2, 2011
This thread is closed to new comments.
Disable X windows and set your shell as a (console-based) text editor. Use root access to set this up, and then lose your root password so you can't tamper with it. Quitting the editor will take the user back to a login prompt.
If you want a fancier solution, search for something like "how to set up a kiosk on Linux / Windows"
posted by qxntpqbbbqxl at 7:46 PM on December 1, 2011