-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
skrot
executable file
·44 lines (34 loc) · 840 Bytes
/
skrot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/perl
# abstract: simple scrot wrapper
use strict;
use warnings FATAL => 'all';
use utf8;
use open qw(:std :utf8);
use IPC::Cmd qw(run);
use File::Basename;
use Clipboard;
use Getopt::Long;
use DDP;
use v5.30;
my $savedir = '/srv/http/vhosts/img/';
my $scrot_options = join(' ', grep { m/^-/ } @ARGV);
my ($file) = grep { ! m/^-/ } @ARGV;
scrot($file, $scrot_options);
sub scrot {
my $filename = shift;
my $opt = shift;
if(!$filename) {
print "enter filename: ";
chomp($filename = <STDIN>);
}
$filename = sprintf '%s%s.png', $savedir, $filename;
my $buffer;
scalar run(
command => "scrot -q 90 $scrot_options $filename",
verbose => 3,
buffer => \$buffer,
timeout => 0,
);
my $basename = basename($filename);
Clipboard->copy_to_all_selections("http://i.japh.se/$basename");
}