LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Custom Application Launcher/Keyboard Shortcuts (with flags) (https://www.linuxquestions.org/questions/linux-desktop-74/custom-application-launcher-keyboard-shortcuts-with-flags-867557/)

SeaborneClink 03-09-2011 04:13 PM

Custom Application Launcher/Keyboard Shortcuts (with flags)
 
I'm trying to recreate some of the functionality of OneNote (winKey+S = screen grab area), on my linux laptop. Given that gnome-screenshot exists and has a 'grab area' function, available from the command line, gnome-screenshot --area (-a), this seemed like a step in the right direction.

So my first attempt was to create a keyboard shortcut with that command but it didn't work, and after a bit of googling I came across a suggestion (or three) to create a bash script, and have the keyboard shortcut call that bash script.

screenGrab.sh
Code:

#! /bin/bash
gnome-screenshot --area
exit 0

Then take my keyboard shortcut and call that script /home/<user>/scripts/screenGrab.sh

Well that works insofar as the screen capture dialog pops up, asking where I would like to save the captured picture (output is identical to pushing the print screen button, i.e. the entire view, not just current window as alt+printscreen would provide)

Executing this script directly from the command line works successfully and will provide the area-grab crosshairs.

Creating a custom launcher (This is where it gets interesting..)

Given a launcher on the desktop, type: application, command: /home/<user>/scripts/screenGrab.sh double clicking on the launcher, immediately after created will sometimes result in the desired behavior, there is no method to the madness as far as I can tell.

Right click the launcher, and click 'Open' will result in the desired behavior every single time.

Adding the launcher to the gnome-panel and clicking it will result in the desired behavior every time.

Clicking on the script in the folder will result in the desired behavior every time, provided you select 'Run' or 'Run in Terminal' (terminal obviously opens up a terminal window along with the behavior)

So I guess my question is, how can I take the results that I'm getting, and combine this all into what I'd like to happen? (keyboard combo -> screen grab)

Did I miss something obvious in the script and what is causing the quirky double click behavior of the launcher? Can anyone else reproduce that?

bluebox 03-09-2011 08:31 PM

Try "xbindkeys" to start your script on a keyboard shortcut:
http://www.nongnu.org/xbindkeys/xbindkeys.html

Start the command "/home/<user>/scripts/screenGrab.sh > /home/<user>/scripts/screenGrab.txt" and check screenGrab.txt if things don't work as expected.

btw, there seems to be "gnome-screenshot" and "gnome-panel-screenshot". This guy uses gnome-panel-screenshot:
http://tips.webdesign10.com/how-to-t...h-ubuntu-linux


All times are GMT -5. The time now is 02:19 PM.