I want to take a screenshot of a whole desktop with Applications Menu selection.How to do this?
9 Answers
- Applications > Accessories > Take Screenshot > Grab the whole desktop > Grab after a delay of : 5 seconds (say)
- Do your Applications menu selection. Wait.
Actually, it is possible to do it without the delay, but with some hacks instead. I have written a small script which will allow you to do that without the delay. This is a big hack, but it works and is certainly (for me) more preferable than using the delay.
#!/bin/bash
######################################################################################
# Simple script to enable users to make screenshots of tooltips/menus/etc... #
# without timers #
######################################################################################
######################################################################################
# Configuration Section (defaults) #
######################################################################################
SCREENSHOT_COMMAND="shutter -s"
# The keys can be found out using xinput test "keyboard name"
MODIFIER_KEY=133 #The <Super> Key (aka. Meta or Windows Key)f
CANCEL_KEY=54 # C
CAPTURE_KEY=27 # R
DAEMON_MODE="false" # change to true if you want to keep the script running after the screenshot was taken
VERBOSE="true" #Change this to any value if you dont want to have notifications
######################################################################################
######################################################################################
# Command parsing #
######################################################################################
function usage {
echo "$0 [-hemrcdn]"
echo "-h prints this message"
echo "-e <command> - execute that command instead of shutter"
echo "-m <int> - The modifier key to use. Use xinput test <keyboar> to find out what is what"
echo "-r <int> - The key to use for capture."
echo "-c <int> - The key used for cancelling (only valid in non daemon mode)"
echo "-d - daemon mode. Will keep on running after a screenshot was taken. to kill the daemon, use \"killall xinput\""
echo "-n - disables notifications"
exit;
}
while getopts "he:m:r:c:dn" flag
do
if [ "$flag" == "h" ]; then
usage
fi
if [ "$flag" == "e" ]; then
SCREENSHOT_COMMAND=$OPTARG
fi
if [ "$flag" == "m" ]; then
CAPTURE_KEY=$OPTARG
fi
if [ "$flag" == "r" ]; then
SCREENSHOT_COMMAND=$OPTARG
fi
if [ "$flag" == "c" ]; then
CANCEL_KEY=$OPTARG
fi
if [ "$flag" == "d" ]; then
DAEMON_MODE="true"
fi
if [ "$flag" == "n" ]; then
VERBOSE="false"
fi
done
######################################################################################
KEYBOARDS=`xinput list | grep "slave" | grep "keyboard" | sed "s/[^a-zA-Z]*\(.*\)id=.*/\1/" | sed "s/[\t ]*$//"`
function run {
MODIFIER_PRESSED="false"
while read line;
do
COMMAND=`echo $line | awk '{print $2;}'`
KEY=`echo $line | awk '{print $3;}'`
if [ "$KEY" == "$MODIFIER_KEY" ]; then
if [ "$COMMAND" == "press" ]; then
MODIFIER_PRESSED="true"
else
MODIFIER_PRESSED="false"
fi
fi
if [ "$KEY" == "$CAPTURE_KEY" -a "$MODIFIER_PRESSED" == "true" -a "$COMMAND" == "press" ]; then
bash -c $SCREENSHOT_COMMAND
if [ "$VERBOSE" == "true" ]; then
notify-send "Taking Screenshot"
fi
if [ "$DAEMON_MODE" == "false" ]; then
quit
fi
fi
if [ "$KEY" == "$CANCEL_KEY" -a "$MODIFIER_PRESSED" == "true" -a "$COMMAND" == "press" -a "$DAEMON_MODE" == "false" ]; then
if [ "$VERBOSE" == "true" ]; then
notify-send "Canceling Screenshot"
fi
quit
fi
done;
}
function quit {
killall -9 xinput
exit
}
if [ "$VERBOSE" == "true" ]; then
notify-send "Screenshot script waiting. Press Meta + R to capture the screenshot"
fi
IFS=$'\n'
for i in $KEYBOARDS
do
unbuffer xinput test "$i" | run &
done
Before you can actually use the script (on ubuntu), you need to make sure you have xinput and unbuffer. To do that simply do:
sudo apt-get install xinput expect-dev
Then you can run the script. Run it first with the -h option to see the possible configuration options. By default, the script will only work once and you have to restart the script after every screenshot (e.g. by a keyboard shortcut). This is because the script might have a performance inpact. If you want to run it as a "daemon" run it with the -d
option.
By default it will also use shutter. If you want to use something else, use the -e
option, e.g. script.sh -c "ksnapshot"
By default, the capture button will be Meta + R. you can change that with the configuration options.
Since you were wondering if it was also possible with Shutter...
To do it in Shutter, open it up and select Full Screen from either the toolbar or from File > New > Fullscreen.
Make sure you have a time delay set so you have enough time to open the Applications menu (Edit > Preferences > Main tab; at the bottom, there is an selection box: Capture after a delay of __ seconds).
Yes. Open screenshot, and set a delay of whatever time you think is necessary to go back and open the menu. Keep it open until the shot is taken.
Fast answer / workaround
(for medium to advanced ubuntu users)
- Add a custom shortcut to the following command:
gnome-screenshot --delay=numIntValueInSecs
for example
gnome-screenshot --delay=3
Add another one to take active window screenshots:
gnome-screenshot -w --delay=3
That's it, but I'd also recommend setting 2 others that would give you more time to navigate deeper in menus.
gnome-screenshot --delay=10
gnome-screenshot -w --delay=10
Elaborate answer
(novice to hacker)
Intro:
Whenever you press PrntScr, all Ubuntu does is calling gnome-screenshot
which is usually located on the /usr/bin/
path and available from the "terminal" (teletype, tty, cli, command line/prompt), so you can use it in all sorts of ways to fit your funky purposes.
The gnome-screenshot
little program accepts optional parameters, you can see all options by passing the standard parameter to ask for help, you know the one (-h
)
If you're still not sure how to use this, you can always read a more detailed help, just ask for the manual typing man gnome-screenshot
The more you read full manuals, hacking ubuntu to fit your needs will become intuitive and you won't need other people to give you step by step instructions. Maybe by this point you even know how to make this workaround by yourself, if you're still lost (hopefully not), just keep reading...
Instructions:
- Step Zero: Open Ubuntu's system settings and navigate to the Keyboard option:
Now
- Navigate to
Shortcuts
tab. - Select
Custom Shortcuts
- Hit the
+
button to add your new custom shortcut. - Give a name and a command.
(just like described on the "Fast Answer" above)
4½. Assign the key combination you'd like. - Close this window or it wont work.
*presto!
You just took one further step to be an ubuntu master, I hope this answer was helpful *
-
Nice! I like the idea of set a default delay for the screenshot fired with the keyboard.– jgomo3Jul 4, 2014 at 13:54
-
Yeah, in the end it happens to have a few more use cases than just taking screenshots of dropdown menus. Jul 6, 2014 at 0:36
Use Screenshot (in accesssories) and set 'Grab after a delay of xx seconds'.
Worked for me
I have found a workaround for this, not an actual solution.
Open the Screenshot
application, in the opened window, set a time as Grab after a delay of x seconds.
Note: This cannot be used for grabing a specific portion of the window.
Note: Sorry, It is not also possible to take the screenshot of Screenshot application itself as a Window or grabing a specific portion.
I wouldn't say it's a bug. It's possible to use the "Screenshot" tool and set "Grab after a delay of x seconds" to the time you need to get the menu back open.
xfce:
xfce4-screenshooter -w -d 5
-d, --delay
Delay in seconds before taking the screenshot
-w, --window
Take a screenshot of the active window