You are not logged in.

#1 2019-05-02 13:00:01

schwim
Member
From: Western NC, US
Registered: 2015-09-29
Posts: 228
Website

[SOLVED] Saving screenie to clipboard

Hi there guys!

I received from help from you guys about half a decade ago relating to saving screenshots to my clipboard.  I pulled the bash file out of the Crunchbang install to use again but when I run it , I receive an "xcmenu not found" error.  I can't find any mention of that executable so I thought I'd ask how I would update this for 2020.

#!/bin/sh

# get a name for a temporary file
temp="$(mktemp -u).png"

# use scrot to put a screenshot into said temporary file
scrot "$temp"

# copy the image to the X clipboard, tagging it as image data 
cat "$temp" | xcmenu --binary image/png --clipboard 

# remove the temporary file
rm -f "$temp"

Thanks for your time!

Last edited by schwim (2019-05-07 23:12:58)


Schw.im! A social site with an identity crisis.

Offline

#2 2019-05-02 13:05:53

damo
....moderator....
Registered: 2015-08-20
Posts: 4,972

Re: [SOLVED] Saving screenie to clipboard

Install maim, then use:

maim | xclip -selection clipboard -target image/png

My full screenshooter script:

#!/bin/bash
##
## scrotclip.sh by damo Feb 2019

# Requires maim, xclip, xdotool

# USAGE: scrotclip.sh [clipwin|clipall|clipsel|clipclean]

arg="$1"
if [[ $arg = "clipwin" ]];then
    maim -i $(xdotool getactivewindow) | xclip -selection clipboard -target image/png
    notify-send -t 6000 "Active window screenshot saved to clipboard"
elif [[ $arg = "clipall" ]];then
    maim | xclip -selection clipboard -target image/png
    notify-send -t 6000 "Desktop screenshot saved to clipboard"
elif [[ $arg = "clipsel" ]];then
    maim -s | xclip -selection clipboard -target image/png
    notify-send -t 6000 "Selected area screenshot saved to clipboard"
elif [[ $arg = "clipclean" ]];then
    maim -d 3 -u | xclip -selection clipboard -target image/png         # wait 3 secs (close menu, hide cursor)
    notify-send -t 6000 "Selected area screenshot saved to clipboard"
else
    notify-send -t 6000 "Nothing saved to clipboard..." 
fi

exit

Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2019-05-02 13:22:30

schwim
Member
From: Western NC, US
Registered: 2015-09-29
Posts: 228
Website

Re: [SOLVED] Saving screenie to clipboard

xclip is also missing for me, will simply installing get me working or do I need to alter Openbox to swap out clipboard apps?


Schw.im! A social site with an identity crisis.

Offline

#4 2019-05-02 15:05:55

damo
....moderator....
Registered: 2015-08-20
Posts: 4,972

Re: [SOLVED] Saving screenie to clipboard

schwim wrote:

xclip is also missing for me, will simply installing get me working or do I need to alter Openbox to swap out clipboard apps?

Just make menu entries or keybinds for your commands, and/or edit bl-graphics-pipemenu, so the writeScrot function looks like:

writeScrot() {                  # Write scrot submenu items
    IMG="$SCROTSDIR/%F-%H-%M-%S_scrot.png"
    VIEW="'bl-image-viewer $IMG'"
    
    menuSubmenu 'clipscrot' 'Clipboard Screenshots'
        menuItem "Desktop Screenshot" "scrotclip.sh clipall"
        menuItem "Desktop Screenshot clean" "scrotclip.sh clipclean"
        menuItem "Active Window Screenshot" "scrotclip.sh clipwin"
        menuItem "Select Area Screenshot" "scrotclip.sh clipsel"
    menuSubmenuEnd

    menuSubmenu 'scrot' 'scrot Screenshooter'
        menuItem "scrot Now" "scrot $IMG -e $VIEW"
        menuItem "scrot In 5 secs..." "scrot -d 5 $IMG -e $VIEW"
        menuItem "scrot In 10 secs..." "scrot -d 10 $IMG -e $VIEW"
        menuItem "scrot Select Area" "scrot -s $IMG -e $VIEW"
        menuItem "scrot Current Focus" "scrot -u $IMG -e $VIEW"
        menuItem "scrot Multi-Monitor" "scrot -m $IMG -e $VIEW"
    menuSubmenuEnd
}

Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#5 2019-05-04 09:38:19

ohnonot
...again
Registered: 2015-09-29
Posts: 3,773
Website

Re: [SOLVED] Saving screenie to clipboard

i think damo's advice is sane - use what bunsenlabs provides instead of hacking your own.

but since you asked:

schwim wrote:

xclip is also missing for me, will simply installing get me working or do I need to alter Openbox to swap out clipboard apps?

yes, just install xclip.

Offline

#6 2019-05-07 17:22:47

cherkie
Member
From: UK(still...)
Registered: 2018-08-09
Posts: 93

Re: [SOLVED] Saving screenie to clipboard

This is my baby script for selection prt scr. It's also courtesy of @Damo from few months back. Completely works for my needs. Selection prt scr to clipboard.

#!/bin/bash
maim -s /tmp/woot.png && xclip -selection clipboard -t image/png /tmp/woot.png && rm /tmp/woot.png
exit

I don't have patience or skill to dig deep enough every time system breaks itself or when I break something because of lack of patience and skill.
nore, 23 Feb 2019

Offline

#7 2019-05-07 23:12:35

schwim
Member
From: Western NC, US
Registered: 2015-09-29
Posts: 228
Website

Re: [SOLVED] Saving screenie to clipboard

cherkie wrote:

This is my baby script for selection prt scr. It's also courtesy of @Damo from few months back. Completely works for my needs. Selection prt scr to clipboard.

#!/bin/bash
maim -s /tmp/woot.png && xclip -selection clipboard -t image/png /tmp/woot.png && rm /tmp/woot.png
exit

Fantastic!  Thanks to Damo for it and to you for continuing the share!


Schw.im! A social site with an identity crisis.

Offline

#8 2019-05-08 06:51:50

cherkie
Member
From: UK(still...)
Registered: 2018-08-09
Posts: 93

Re: [SOLVED] Saving screenie to clipboard

no worries, glad I could help.


I don't have patience or skill to dig deep enough every time system breaks itself or when I break something because of lack of patience and skill.
nore, 23 Feb 2019

Offline

Board footer

Powered by FluxBB