Key command for screen capturing

Booting, installing, newbie
Post Reply
Message
Author
rmcellig
Posts: 965
Joined: Sat 19 Nov 2011, 15:18
Location: Ottawa Ontario Canada
Contact:

Key command for screen capturing

#1 Post by rmcellig »

Every time I want to capture a region of the screen, I have to go to the menu to Graphics and select Pupsnap. Is there a way I can for example assign F2 to bring up the ability to capture a region? What are my options?

Peterm321
Posts: 411
Joined: Thu 29 Jan 2009, 14:09
Location: UK

#2 Post by Peterm321 »

If I want a screen capture, I don't use a keystroke maybe because I don't use very often.

In a command prompt window I type:

Code: Select all

sleep 8s ; mtpaint -s
The 8 second delay allows me to focus to whatever app I wish to take the screenshot from. The screen is sent to mtpaint which can save the result in a variety of image formats if you want.

I don't mind a bit of typing, you can shorten the typing by setting an alias command, eg

Code: Select all

 alias scrn="sleep 8s ; mtpaint -s" 
and use scrn to take screenshots.

I suppose it might be possible to assign a command to a function key in the JWM configuration files (or whatever window manager you use) to execute the "mtpaint -s" command via F2 etc. If you search the forums there may be a solution like this somewhere.

rmcellig
Posts: 965
Joined: Sat 19 Nov 2011, 15:18
Location: Ottawa Ontario Canada
Contact:

#3 Post by rmcellig »

I am going to try your suggestion even though I would never have thought of doing it this way. Maybe it is because i usually don't think CLI.

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#4 Post by jemimah »

Sven is a nice gui tool for assigning commands to hotkeys. Search the forum for it.

Peterm321
Posts: 411
Joined: Thu 29 Jan 2009, 14:09
Location: UK

#5 Post by Peterm321 »

I am going to try your suggestion even though I would never have thought of doing it this way. Maybe it is because i usually don't think CLI
If I regularly took a lot of screenshots, I would probably assign a hotkey.

I just remembered that you can edit destop icons and change their properties. So I edited a unused destop icon and changed the comand to /usr/bin/mtpaint , the parameter to -s, and gave it a hotkey of ALT+F12. It works!
Attachments
SCRNSHOT.PNG
(50.73 KiB) Downloaded 384 times

rmcellig
Posts: 965
Joined: Sat 19 Nov 2011, 15:18
Location: Ottawa Ontario Canada
Contact:

#6 Post by rmcellig »

Now that is cool! Pardon my ignorance (I'm still learning how Puppy works), but how do you create an unused icon so that I can set the command like in the screenshot in your last post?

Thanks!! :)

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#7 Post by don570 »

If you use psnapshot there is a keystroke combination
for the JWM window manager
I set up CTRL-shift-P

http://murga-linux.com/puppy/viewtopic. ... 44&t=70996

I show how easy it is for JWM.

Just one key to launch a program is harder.
It's explained on the forum somewhere.

________________________________

Peterm321
Posts: 411
Joined: Thu 29 Jan 2009, 14:09
Location: UK

#8 Post by Peterm321 »

Now that is cool! Pardon my ignorance (I'm still learning how Puppy works), but how do you create an unused icon so that I can set the command like in the screenshot in your last post?

Thanks!! Smile
Apparently its as simple as dragging any filename using rox or other file manager to the desktop, this creates an icon referencing the object just dragged. Then edit the icon to what you want.

I suppose you could also find mtpaint directly. At the command prompt, type

Code: Select all

rox /usr/bin
Then scroll down to mtpaint then drag it to the desktop.

There is some related information here http://www.murga-linux.com/puppy/viewtopic.php?t=51619

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#9 Post by Karl Godt »

Xbindkeys + Xbindkeys-config
http://murga-linux.com/puppy/viewtopic.php?t=61472
worked for me afaicr

Another possible feature for jwm is

/usr/local/jwmconfig2/keyboard
script
which does something don570 does manually .

jwmconfig is buggy , so i would try don's manual suggestion first
and read
/usr/local/jwmconfig2/keyConfigHelp .

/usr/local/jwmconfig2/keyboard
gets launched by
/usr/local/jwmconfig2/jwmConfigMgr GUI
which creates needed variables for
/usr/local/jwmconfig2/keyboard

Later Lupu 5 series had some features of /usr/local/jwmconfig2/jwmConfigMgr disabled .

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#10 Post by don570 »

If you want to launch an application ( such as mtpaint -s)
with just one press of a key there is trick.

It's explained HERE

It requires xev to be installed which most recent puppies have.

But here's a copy if you don't have it installed.

To get the number of the key that you are pressing,
the easiest way is read this carefully. I got it from
wikkipedia

Code: Select all

Using xev 

Another way to get the keycodes of your keys is to use the graphical X program "xev" (without having to switch to a console environment). With the following line you can start xev and directly grep the important parts: 

xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p' 
In the example below I pressed the "a", "r", "c" and "h" keys and two of the media keys on my Dell keyboard. This gives me the following output: 

38 a 
27 r 
54 c 
43 h 
153 NoSymbol 
144 NoSymbol 
This means that the "a", "r", "c" and "h" keys have the keycodes 38, 27, 54 and 43 and are properly bound while the media keys with the keycodes 153 and 144 have no function yet, which is indicated by "NoSymbol". If you press a key and nothing appears in the terminal, this means that the kernel doesn't see that key or that it is not mapped.

You use the number of the key in JWM's configuration

This uses the PRINT SCREEN key

<Key keycode="111">exec:mtpaint -s</Key>


Openbox WM does it slightly different since it converts the
keycode number to a hexadecimal number.

___________________________________________________
Attachments
xev.zip
keyboard application
(8.2 KiB) Downloaded 177 times

Post Reply