SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2010-03-13 23:42:14

danielrmt
#! CrunchBanger
Registered: 2009-11-13
Posts: 102

Deskrot: takes a screenshot from ALL your desktops

This script takes a screenshot from each of your virtual desktop, and merges them in one file.
Requires: wmctrl, imagemagick and scrot

#!/usr/bin/env bash
#  This program is free software. It comes without any warranty, to
#  the extent permitted by applicable law. You can redistribute it
#  and/or modify it under the terms of the Do What The Fuck You Want
#  To Public License, Version 2, as published by Sam Hocevar. See
#  http://sam.zoy.org/wtfpl/COPYING for more details.

# Define destination file name
dest=$1
if [ -z "$dest" ]; then
    base=scrot-`date +%Y%m%d%H%M`
    ext=png
    dest=$base.$ext
else
    base=`basename $dest | cut -d. -f1`
    ext=`echo $dest | cut -d. -f2-`
fi

# Remove tmp files
rm -fr /tmp/$base-desk*.$ext

# Save workspace count
deskn=`wmctrl -d | wc -l`
# Save workspace list
desks=`wmctrl -d | cut -d' ' -f1`
# Save current workspace
current=`wmctrl -d | grep '*' | cut -d' ' -f1`

# Iterate over workspaces
for desk in $desks; do
    # Move to such workspace
    wmctrl -s $desk
    # Take a rest (for xcompmgr/compiz animations)
    sleep 3
    # Take workspace screenshot
    # (Note: I prefer scrot because import ignores some transparency)
    tmpdest=/tmp/$base-desk$desk.$ext
    scrot $tmpdest || import -window root $tmpdest
done

# Return to last workspace
wmctrl -s $current

# Concatenate all workspace screenshots
montage -geometry +0+0 -tile 1x$deskn /tmp/$base-desk*.$ext $dest

# Create thumbnail
convert $dest -resize 256x`expr 256 \* $deskn` `echo $dest | cut -d. -f1`.thumb.$ext

# Open screenshot
thunar $dest || xdg-open $dest || gnome-open $dest || gpicview $dest || feh $dest || true >/dev/null 2>/dev/null

Offline

Be excellent to each other!

#2 2010-03-14 00:12:59

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 12,274

Re: Deskrot: takes a screenshot from ALL your desktops

Doesn't the screenshot command in the #! Openbox menu already do this?  I could have sworn it did.


I'm a moderator here.  How are we doing?  Feedback is encouraged.

Offline

#3 2010-03-14 00:16:02

anonymous
The Mystery Member
From: Arch Linux Forums
Registered: 2008-11-29
Posts: 9,418

Re: Deskrot: takes a screenshot from ALL your desktops

Afaik the command from #!'s menu only takes a screenshot of the current desktop.

Offline

#4 2010-03-14 00:22:01

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 12,274

Re: Deskrot: takes a screenshot from ALL your desktops

Well, I just took this shot from the (unmodified) menu.
tM3Rweg
No offense intended, danielrmt.


I'm a moderator here.  How are we doing?  Feedback is encouraged.

Offline

#5 2010-03-14 00:33:35

danielrmt
#! CrunchBanger
Registered: 2009-11-13
Posts: 102

Re: Deskrot: takes a screenshot from ALL your desktops

To tell the truth, I don't know. It has been some months since I have moved from Crunchbang to Arch...

Offline

#6 2010-03-14 00:51:03

danielrmt
#! CrunchBanger
Registered: 2009-11-13
Posts: 102

Re: Deskrot: takes a screenshot from ALL your desktops

pvsage wrote:

Well, I just took this shot from the (unmodified) menu.
tM3Rweg
No offense intended, danielrmt.

Why your desktops have different heights? Or they are different monitors? My script is to take screenshots of the virtual desktops or workspaces, not monitors.

Offline

#7 2010-03-14 00:56:35

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 12,274

Re: Deskrot: takes a screenshot from ALL your desktops

Ah!  Now I see.  Yes, they're different monitors.

Now I see what your script is doing.  Nice work!


I'm a moderator here.  How are we doing?  Feedback is encouraged.

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo