Notings of Attention™
Acmlmboard 2 Released
Github/GIT | @acmlmboard
Chatting Places
Discord

Affiliates
Super Mario Bros. X | Kuribo64 | NeoRHDN
Views: 11,051,782
Main | FAQ | IRC chat | Memberlist | Active users | Latest posts | Stats | Ranks | Online users | Search
11-24-24 07:28 AM
Guest: Register | Login

0 users currently in msg db 'Computer Address',0xa | 1 bot

Main - msg db 'Computer Address',0xa - Auto screenshot uploader [Linux]
Next newer thread | Next older thread


Nadia
Posted on 06-05-14 11:48 PM, in (rev. 2 of 06-05-14 11:49 PM by Nadia) Link | ID: 66292
Normal User
Axew
Axew
Level: 23


Posts: 80/93
EXP: 61528
Next: 6195

Since: 01-05-12
From: Denmark

Last post: 2355 days
Last view: 1273 days
Just made this little script and thought I'd share it if anyone wants it.
The script takes a screenshot and automatically uploads it to a directory on a server using scp, then it copies the URL to the clipboard for easy pasting to an IRC channel or something. It even shows desktop notifications! :D

Dependencies:
  • scrot, gnome-screenshot, …: For taking the screenshot
  • xclip: To copy the URL to the clipboard
  • notify-send: To display desktop notifications
Usage:
  1. Edit the configuration to point to the server you want to upload to
  2. Set up keyboard shortcuts in your desktop environment
  3. You're done :)
The script:
#!/usr/bin/bash
#
# Script to take a screenshot and scp it to a directory on a host.
# The file name is the current UNIX time in hex.
# After the screenshot has been uploaded, a desktop notification will be
# displayed and the URL will be copied to the clipboard.
#
# The command line arguments are passed to the screenshot tool.
#

# Options
local_temp_directory=/tmp
ssh_host=your-server.com
target_directory="~/screenshots"
url_base="http://your-server.com/screenshots"
screenshot_tool=gnome-screenshot

# Get the file name and take the screenshot
name=$(printf "%x\n" $(date +%s)).png
$screenshot_tool $@ -f $local_temp_directory/$name

# Upload it
scp $local_temp_directory/$name $ssh_host:$target_directory

# Did we succeed?
if [[ $? -eq 0 ]]; then # We did
echo -n $url_base/$name | xclip -selection clipboard -i
notify-send "Screenshot taken" "$url_base/$name" \
--urgency=low \
--hint=int:transient:1
else
notify-send "Screenshot upload failed." \
--hint=int:transient:1
fi

# Delete the temporary file
rm $local_temp_directory/$name

Next newer thread | Next older thread
Main - msg db 'Computer Address',0xa - Auto screenshot uploader [Linux]


Acmlmboard v2.5.6 (06/11/2024)
© 2005-2024 Acmlm, Emuz, et al.

Page rendered in 0.032 seconds. (767KB of memory used)
MySQL - queries: 58, rows: 479/511, time: 0.027 seconds.