You are not logged in.
So I use scrot for screenshotting in my projects, I like how lightweight it is and simple. Up until now i've had to add 3 menu entries under the screenshot category as it's a cli app, so I called the 3 functions I wanted via menu entries since there hasn't been a GUI for it in many years near as I can tell. So I made a GUI yesterday, plain ol' Yad and shellscript. Scrot can do a lot of things but all I ever use are 3 options.
Screenshot of:
1. The entire desktop
2. The entire desktop with a 5 second delay
3. Select area using the mouse
And I like to view the shot right after I take it, so I set it up to open the new shot in a pic viewer after it's taken.
It was harder than it sounds, first of all if you use conky (I do) when you choose select area with mouse, if conky is running it will interfere with the selection process and you'll get some nasty artifacts in the shot, so I had previously written a tiny script that turns off conky when you click the entry, takes the shot, previews it for you, then turns conky back on afterwards. I tried and tried to integrate that with the main script, but it wasn't happening, so I modded it some and left it as an outboard script that gets called from the main script.
Yad's --form window was perfect for the main gui, but it has a quirk in that it doesn't shut down after you click a selection, that took some time and searching to figure out too. And for viewing the the shot after you take it, didn't make sense to try and guess the users pic viewer, so I used Yad for that as well, simple undecorated window with the shot and a close button.
Got just a hair more testing to do today, and then i'll post the scripts if anyone is interested.
Last edited by greenjeans (2025-07-11 14:41:18)
Offline
A similar yad screenshot script was developed by @sleekmason for his wonderful (but now inactive) 'Lilidog' distro.
This one lets you shoot fullscreen | fullscreen+delay | active window | select area, which are all saved to disk -- as well as fullscreen & area shots that are copied to clipboard only. The yad window is closed right before the actual scrot command is executed and a notification message is opened.
I made minor changes to this 'scrot-options' scipt, in such a way that a 'saved-to-disk' scrot is opened in my default image-viewer instead. A notification is only applied for copied-to-clipboard scrots.
Maybe you could find parts of this script useful for your above project.
#!/bin/bash
#
# original by @sleekmason for his wonderful 'Lilidog' distro.
# Minor/marginal modifications by @ceeslans for use in mxflux/fluxuan.
#
# Use scrot with different options and have yad close on click.
# Requires yad, xclip, libnotify-bin
#
## Add functions
NOW(){
# Use printf to store the current date/time as variables.
printf -v date "%(%Y%m%d)T"
printf -v time "%(%T)T"
# Create primary and secondary directories
DIR="$HOME/Pictures/scrot"
if ! test -f "$DIR"; then
mkdir -p "$DIR"
fi
mkdir -p "${DIR}"
# cd to directory and screenshot with time attached
cd "${DIR}" || exit
SCR="${DIR}/shot_${date}-${time}.png"
sleep 0.25 ; scrot -m "$SCR"
#notify-send --urgency low "Saved shot to ${DIR}" -i gnome-screenshot
sleep 0.15 ; xdg-open $SCR
}
LATER(){
# Use printf to store the current date/time as variables.
printf -v date "%(%Y%m%d)T"
printf -v time "%(%T)T"
# Create primary and secondary directories
DIR="$HOME/Pictures/scrot"
if ! test -f "$DIR"; then
mkdir -p "$DIR"
fi
mkdir -p "${DIR}"
# cd to directory and screenshot with time attached
cd "${DIR}" || exit
SCR="${DIR}/shot_${date}-${time}.png"
scrot -md 8 "$SCR"
#notify-send --urgency low "Saved shot to ${DIR}" -i gnome-screenshot
sleep 0.15 ; xdg-open $SCR
}
CAPTURE(){
# Use printf to store the current date/time as variables.
printf -v date "%(%Y%m%d)T"
printf -v time "%(%T)T"
# Create primary and secondary directories
DIR="$HOME/Pictures/scrot"
if ! test -f "$DIR"; then
mkdir -p "$DIR"
fi
mkdir -p "${DIR}"
# cd to directory and screenshot with time attached
cd "${DIR}" || exit
SCR="${DIR}/shot_${date}-${time}.png"
scrot -s "$SCR"
#notify-send --urgency low "Saved selection to ${DIR}" -i gnome-screenshot
sleep 0.15 ; xdg-open $SCR
}
WINDOW(){
# Use printf to store the current date/time as variables.
printf -v date "%(%Y%m%d)T"
printf -v time "%(%T)T"
# Create primary and secondary directories
DIR="$HOME/Pictures/scrot"
if ! test -f "$DIR"; then
mkdir -p "$DIR"
fi
mkdir -p "${DIR}"
# cd to directory and screenshot with time attached
cd "${DIR}" || exit
SCR="${DIR}/shot_${date}-${time}.png"
scrot -u -b -d1 "$SCR"
#notify-send --urgency low "Saved shot to ${DIR}" -i gnome-screenshot
sleep 0.15 ; xdg-open $SCR
}
COPY(){
# Use printf to store the current date/time as variables.
printf -v date "%(%Y%m%d)T"
printf -v time "%(%T)T"
# Create primary and secondary directories
DIR="$HOME/Pictures/scrot"
if ! test -f "$DIR"; then
mkdir -p "$DIR"
fi
mkdir -p "${DIR}"
# cd to directory and screenshot with time attached
cd "${DIR}" || exit
SCR="${DIR}/shot_${date}-${time}.png"
scrot -e 'xclip -selection clipboard -t image/png -i $f' "$SCR"
notify-send --urgency low "Copied shot to clipboard" -i gnome-screenshot
}
COPYSEL(){
# Use printf to store the current date/time as variables.
printf -v date "%(%Y%m%d)T"
printf -v time "%(%T)T"
# Create primary and secondary directories
DIR="$HOME/Pictures/scrot"
if ! test -f "$DIR"; then
mkdir -p "$DIR"
fi
mkdir -p "${DIR}"
# cd to directory and screenshot with time attached
cd "${DIR}" || exit
SCR="${DIR}/shot_${date}-${time}.png"
scrot -e 'xclip -selection clipboard -t image/png -i $f' -scapture "$SCR"
notify-send --urgency low "Copied selection to clipboard" -i gnome-screenshot
}
## Export functions
export -f NOW
export -f LATER
export -f WINDOW
export -f CAPTURE
export -f COPY
export -f COPYSEL
if ! [[ $(command -v scrot) ]]; then
notify-send --urgency low "Install 'scrot' to use this keybind"
else
yad --title "Scrot" --class "scrot-options" --escape-ok \
--width=180 --height=270 --borders=15 --center --on-top \
--button="gtk-cancel":0 --window-icon=video-display --text-align=center \
--form --columns=1 \
--field="":LBL "" \
--field="Fullscreen Now:FBTN" 'bash -c "NOW & kill $YAD_PID"' \
--field="Fullscreen +8s:FBTN" 'bash -c "LATER & kill $YAD_PID"' \
--field="Area Selection:FBTN" 'bash -c "CAPTURE & kill $YAD_PID"' \
--field="Active Window:FBTN" 'bash -c "WINDOW & kill $YAD_PID"' \
--field="":LBL "" \
--field="Clipboard | Full:FBTN" 'bash -c "COPY & kill $YAD_PID"' \
--field="Clipboard | Area:FBTN" 'bash -c "COPYSEL & kill $YAD_PID"' \
--field="":LBL ""
fi
Offline
I use to have a yad script for scrot then it hit me. Why run a menu from a menu.
So I put them all in OpenBox:
Choice of .jpg or .png
Now. = Desktop - same as tapping [Print Screen] key → should remove as I always use [Print Screen]
[ brackets ] → triple meaning.
· 1. Click in an open window it does a scrot of the open window
· 2. Click on desktop = same as Now and [Print Screen] - redundant move
· 3. Click|hold|drag = get the area boxed in - I can include pars of a conky without problem.
[jpg] +B → scrot of a window plus the border decoration
JPGs in → a timed delay of Desktop
Same for .pngs
So I have some redundant or unused entries to get rid of.
But by all means ... continue.
People tell me my OB menu is {koff koff} cluttered!
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Thanks guys, great info! I figured if anybody would have some scrot tricks up their sleeve it would be here at the BL forum.
Yeah my little app is tiny, I didn't mean for it to have a ton of scrot's options, those 3 are what I use most in my work/use flow. I wanted this to be quick, clean, and small, the two scripts and the .desktop only add up to 2 kb, and since yad and scrot are already in my system I didn't need to install any other depends.
@Sector11, yep I got a bit of menu-creep going on, I use obmenu-generator and I created a 'screenshot' section and had 3 different menu entries for the 3 options. So one of the goals of this project and the AlsaTune project was to cut down on the clutter, so 5 menu entries will now be cut down to just 2.
Offline
^ I use keyboard shortcuts.
Screenshot - Desktop
Command: gnome-screenshot
Shortcut: Ctrl + Alt + Super + S
Screenshot - Active Window
Command: gnome-screenshot -w
Shortcut: Ctrl + Alt + Super + W
Screenshot - Selected Area
Command: gnome-screenshot -a
Shortcut: Ctrl + Alt + Super + A
Screenshot - Desktop (Delay 8s) *(terminal - ImageMagick)
Command: sleep 8s; import -window root screenshot.png
Last edited by marens (2025-07-11 23:28:20)
If people would know how little brain is ruling the world, they would die of fear.
Offline
^^ yeppers, I have the prt sc button on my laptop setup to do an entire desktop shot, so the entry in the GUI may be a little redundant, but i'm a GUI guy, and one of the reasons for that is I convert a lot of former windows users to Linux, typically I start 'em off on Mate as that's pretty easy for them to learn, but at some point I always try to ease them into Openbox, especially if their machine is really old. But regardless, it's always like pulling teeth to try to get them to use keyboard shortcuts, much less open a terminal!
Offline
@Sector11, yep I got a bit of menu-creep going on, I use obmenu-generator and I created a 'screenshot' section and had 3 different menu entries for the 3 options. So one of the goals of this project and the AlsaTune project was to cut down on the clutter, so 5 menu entries will now be cut down to just 2.
Your Alsa Tune project is a great little thing. Looking forward to the final touch.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
There are already some scrot commands in the BL menu btw:
menu > Utilities > Take Screenshot > Scrot Screenshooter
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Online