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

Affiliates
Super Mario Bros. X | Kuribo64
Views: 8,952,194
Main | FAQ | IRC chat | Memberlist | Active users | Latest posts | Stats | Ranks | Online users | Search
03-28-24 12:44 PM
Guest: Register | Login

0 users currently in msg db 'Computer Address',0xa | 5 bots

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: 59934
Next: 7789

Since: 01-05-12
From: Denmark

Last post: 2114 days
Last view: 1032 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.5 (10/04/2020)
© 2005-2024 Acmlm, Emuz, et al.

Page rendered in 0.035 seconds. (767KB of memory used)
MySQL - queries: 58, rows: 482/514, time: 0.029 seconds.