You are not logged in.

#1 2019-12-14 11:51:19

damo
....moderator....
Registered: 2015-08-20
Posts: 5,411

Imgur screenshooter script for BL

Feedback on this would be appreciated wink

imgur

################### imgur.sh ###########################################
# Take screenshots and upload them to Imgur.
# This can be to an existing account, or anonymously.
#
# Credentials and access token for an account can be set up.
#
# Settings (settings.conf) and credentials (credentials.conf}) files are created in \
# $HOME/.config/imgur/
#
# The script returns BB-Code for the direct image link, and a linked thumbnail.
# YAD dialogs are used for user interaction.
#
# Kudos to the writer of the script at https://github.com/jomo/imgur-screenshot,
# which has provided most of the OAuth2 and Imgur API functions adapted here.
# ("imgur-screenshot" is featured in https://imgur.com/tools.)
#
# Copyright (C) 2019 damo    <damo@bunsenlabs.org>
########################################################################

xfce4-screenshooter has the option to upload a scrot to Imgur, but it is as an anonymous user. This script also allows upload to an existing account and album.

It is BL-specific because it is using yad-includes, but is easily adapted to other yad dialogs.

Last edited by damo (2019-12-23 21:05:40)


Be Excellent to Each Other...

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

Offline

#2 2019-12-14 12:32:14

clusterF
Member
Registered: 2019-05-07
Posts: 450

Re: Imgur screenshooter script for BL

Not a fan of imgur. Everytime i click on an imgur link here and elsewhere i never get the full view and when i try it asks me to join up.


"Common sense is like deodorant, those who need it the most never use it."

git: clusterF

Offline

#3 2019-12-14 18:48:48

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 172

Re: Imgur screenshooter script for BL

Sorry, but I could need some fuller instructions to be able to evalute the function...


// Regards rbh

Online

#4 2019-12-14 19:19:34

damo
....moderator....
Registered: 2015-08-20
Posts: 5,411

Re: Imgur screenshooter script for BL

rbh wrote:

Sorry, but I could need some fuller instructions to be able to evalute the function...

Run the script with no args and it will upload a full desktop screenshot, then give you back the BBCode for a linked thumbnail, or a direct image link.

Get the options with

imgur.sh -h

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-12-15 03:03:26

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,175
Website

Re: Imgur screenshooter script for BL

An option to allow upload of a random image file via a Thunar custom action?


John

...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Offline

#6 2019-12-15 03:04:54

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,175
Website

Re: Imgur screenshooter script for BL

clusterF wrote:

Not a fan of imgur. Everytime i click on an imgur link here and elsewhere i never get the full view and when i try it asks me to join up.

Hmm wonder what that is? I never get that problem.


John

...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Offline

#7 2019-12-15 04:16:20

clusterF
Member
Registered: 2019-05-07
Posts: 450

Re: Imgur screenshooter script for BL

johnraff wrote:
clusterF wrote:

Not a fan of imgur. Everytime i click on an imgur link here and elsewhere i never get the full view and when i try it asks me to join up.

Hmm wonder what that is? I never get that problem.

I probably should have worded that better, sometimes not everytime. Maybe its changed since as it was a few months ago i was trying to browse imgur without an account and some images failed to render in full size and i would get popups asking to join imgur to see more. Might depend on how the uploader links images as well.


"Common sense is like deodorant, those who need it the most never use it."

git: clusterF

Offline

#8 2019-12-15 15:28:49

DeepDayze
Member
From: In Linux Land
Registered: 2017-05-28
Posts: 778

Re: Imgur screenshooter script for BL

johnraff wrote:

An option to allow upload of a random image file via a Thunar custom action?

That sounds like a good idea. Think you can also create a similar custom action in PCManFM as well. Maybe a simple command line script would also be useful for those who use the command line the most.

Last edited by DeepDayze (2019-12-15 15:29:43)


Real Men Use Linux

Offline

#9 2019-12-16 08:24:43

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,175
Website

Re: Imgur screenshooter script for BL

Hmm I should have actually looked at damo's code before posting my suggestion.  He's already provided an image upload option:

--file  <filepath/filename>    Upload specified image. Overrides scrot options

Sorry damo. m(._.)m


John

...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Offline

#10 2019-12-16 09:27:16

damo
....moderator....
Registered: 2015-08-20
Posts: 5,411

Re: Imgur screenshooter script for BL

You said a random image, and I thought....someone else can hack that hmm

BTW it is proving tricky to add progress bars, but I'm getting close; and many popular free image hosts don't have public APIs, although anonymous uploads should be possible for most.

With a bit more code the script could do away with xfce4-screenshooter altogether.


Be Excellent to Each Other...

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

Offline

#11 2019-12-16 21:24:37

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,966
Website

Re: Imgur screenshooter script for BL

johnraff wrote:
clusterF wrote:

Not a fan of imgur. Everytime i click on an imgur link here and elsewhere i never get the full view and when i try it asks me to join up.

Hmm wonder what that is? I never get that problem.

My version https://github.com/brontosaurusrex/buce … /bin/imgur attempts to solve that with free proxy prefix, also tries to handle transparent thumbnails and probably some more. However it definately needs a smart rewrite and I asked myself and I said no.

Offline

#12 2019-12-17 07:30:28

ohnonot
...again
Registered: 2015-09-29
Posts: 4,222
Website

Re: Imgur screenshooter script for BL

damo wrote:

With a bit more code the script could do away with xfce4-screenshooter altogether.

Did you look at

maim

?

Offline

#13 2019-12-17 08:05:46

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,175
Website

Re: Imgur screenshooter script for BL

damo wrote:

With a bit more code the script could do away with xfce4-screenshooter altogether.

A bit more... That's already quite a monumental creation, but I never imagined stuff like OAUTH for a job like this. I guess if you want proper access to a user account it's needed.

But anyway, I couldn't find any reference to xfce4-screenshooter in there.


John

...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Offline

#14 2019-12-17 08:30:56

damo
....moderator....
Registered: 2015-08-20
Posts: 5,411

Re: Imgur screenshooter script for BL

ohnonot wrote:
damo wrote:

With a bit more code the script could do away with xfce4-screenshooter altogether.

Did you look at

maim

?

That is my personal favourite - it is very versatile and a lot better than scrot IMO. I have a submenu with various maim options.

ATM I am trying to hack something together that uses BL stuff OOTB, so maim will be next on the list to be included as an an option wink


Be Excellent to Each Other...

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

Offline

#15 2019-12-17 08:49:07

damo
....moderator....
Registered: 2015-08-20
Posts: 5,411

Re: Imgur screenshooter script for BL

johnraff wrote:

...
But anyway, I couldn't find any reference to xfce4-screenshooter in there.

I meant that BL may not need it as a gui screenshooter. It should be fairly trivial to have an xfce4-screenshooter-like interface for options, including editing, using YAD,. Maybe even upload options for various image hosts.

Also, @ohnonot also points out, maim is a good option instead of scrot. This is a script I'm using for shooting to the clipboard:

#!/bin/bash
##
## scrotclip by damo Feb 2019
# Requires maim, xclip, xdotool

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

arg="$1"
case "$arg" in
    clipwin )   maim -i $(xdotool getactivewindow) | xclip -selection clipboard -target image/png
                notify-send -t 6000 "Active window screenshot saved to clipboard"
                ;;
    clipall )   maim | xclip -selection clipboard -target image/png
                notify-send -t 6000 "Desktop screenshot saved to clipboard"
                ;;
    clipsel )   maim -s | xclip -selection clipboard -target image/png
                notify-send -t 6000 "Selected area screenshot saved to clipboard"
                ;;
    clipclean)  maim -d 3 -u | xclip -selection clipboard -target image/png  # wait 3 secs (close menu, hide cursor)
                notify-send -t 6000 "Screenshot saved to clipboard"
                ;;
            *)  notify-send -t 6000 "Nothing saved to clipboard..."
                ;;
esac
exit

Be Excellent to Each Other...

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

Offline

#16 2019-12-20 05:12:58

ohnonot
...again
Registered: 2015-09-29
Posts: 4,222
Website

Re: Imgur screenshooter script for BL

^ nice.
the clipwin action isn't strictly necessary - 'maim -s' will select the clicked window when you just click insteadof click-dragging.

Offline

#17 2019-12-23 21:08:56

damo
....moderator....
Registered: 2015-08-20
Posts: 5,411

Re: Imgur screenshooter script for BL

Original post and link updated for improved imgur upload script.

It now includes progress bars while uploading or deletion is in progress'


Be Excellent to Each Other...

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

Offline

#18 2019-12-25 02:00:52

DeepDayze
Member
From: In Linux Land
Registered: 2017-05-28
Posts: 778

Re: Imgur screenshooter script for BL

This is looking good...nice work!


Real Men Use Linux

Offline

Board footer

Powered by FluxBB