Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Having just written my perfect screenshot tool, I've been trying to work out how it should set itself up for use by people who are not me. Screenshots are traditionally taken by pressing the PrtSc key. So, I could do the following things:

As soon as the app is installed, make pressing PrtSc invoke the app

Pros:

  • works immediately, out of the box, as expected. A user installs the app, hits PrtSc, they get the app they've just installed. Hooray.

Cons:

  • unconditionally overrides any existing setup you have for PrtSc, which might be annoying
  • if you uninstall the app, it won't reset PrtSc to what it was before, which is also annoying
  • problematic for multiple users, because app installation runs under sudo, so how does it know which user's PrtSc setup to override? It's certainly possible to add a gconf key as part of installation, but that may be problematic if two different screenshot apps both try?

On first-run of the app, seize the PrtSc key

Pros:

  • avoids the above problem of wrongly seizing other users' PrtSc keys

Cons:

  • you have to run the app once manually first, which is annoying (and how do you know how to do that?)
  • will still not restore the old setting if the app is uninstalled

Have a configuration dialog in the app where you configure it to seize PrtSc

Pros:

  • Only seizes PrtSc for people that really want it to

Cons:

  • you have to run the app once manually first, which is annoying (and how do you know how to do that?)
  • you have to go into a configuration dialog to make the app actually do what it's intended to do; take screenshots when you press PrtSc. Ubuntu is past that configure-everything stage now, surely? How irritating. Not doing this!

Something else I haven't thought of

A better cleverer approach that just hasn't dawned on me yet.

Suggestions welcomed!

share|improve this question
    
Good question, lousy answer: you are treading in very murky waters, go with your first choice and document how to get back to the default, if you can identify in which of 5 places the default really lives, which I can't. –  msw Sep 20 '10 at 4:41
    
Out of curiosity, do you have a link to your project? –  dv3500ea Sep 20 '10 at 16:07
    
Your question seems more appropriate for the User Interface SE, by the way you asked it :) –  badp Oct 10 '10 at 13:42

4 Answers 4

up vote 2 down vote accepted

I think scenario A and C are the way to go.

You could plug into the Alternatives system and add the relevant entry to the System → Preferences → Default Applications screen, like this:

alt text

I believe that setting yourself as default on install is fine, however. Displaying a notice on first run asking each user if they want to use the previous default instead would be nice.

(Is it even possible to add a new entry in that dialog?)

share|improve this answer

You could perhaps set the keyboard short cut for your app but record what was previously bound to that shortcut. Then on first run (possibly when the user presses prt sc, you could pop up a dialog that asks them something like:

This application has been set as the default screenshot application that will be run whenever you press the 'print screen' key. Do you wish to keep to this behaviour or revert to previous settings?

Enabling them to easily get back to the previous settings if they want.

share|improve this answer

I will go for a configuration dialog in the app, plus a command line script.

Both should read the previous keyboard shortcut value, store it and restore it when the user asks (or delete the value if no one was present).

The dialog should let final users adjust the behaviour. The command line script can be used by packagers to set the default behaviour according to distribution guidelines, and to make it uninstall clean (restoring the keyboard shortcuts that it grabbed).

share|improve this answer

unconditionally overrides any existing setup you have for PrtSc, which might be annoying

It would. As others have said, I'd make this an option somewhere prominent in the preferences, perhaps a first-run choice-dialogue too.

But importantly, I would have it remember the setting it was changing from and store that somewhere. On uninstallation, I'd have it go through all the users and if enabled reset their print-screen keybind to whatever it was before.

The complicated bit is the post-rm script will run as root and you need to run commands as all the desktop users. I'm sure it's possible and it's by far the best solution.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.