x4ss 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/x4ss.rb +56 -8
- metadata +24 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 726a9ca0ea55ee32d4bda684cb8a07fa0aa23fcaff588afc40eabaaf7e7ff22e
|
4
|
+
data.tar.gz: c80f73f70c4328cf16d08105bf29cdae004628a2cc2171bbeac277a8bc79c575
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c39042dd818dda12c38cc784ec6b9aa56c884eabc9e02ecd4712664bbeb93e258b793abbfd99e655bac8e95faaf65987640373cba10e3712d34c47bd3a3e5760
|
7
|
+
data.tar.gz: 98f5d0ffedd543bb2bbdf3edb20771b3280ac14ab3e5064d64b0fa4ab00689b774b202e6e9b5c407aaecd3cd0d99041474b79843e1b197f9e2777e73a7cdae26
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/x4ss.rb
CHANGED
@@ -3,30 +3,78 @@
|
|
3
3
|
# file: x4ss.rb
|
4
4
|
|
5
5
|
# A wrapper for xfce4-screenshooter and xclip to save screenshots
|
6
|
+
# Looking for a simple command-line progam? Try scrot.
|
7
|
+
|
8
|
+
require 'c32'
|
9
|
+
|
6
10
|
|
7
11
|
class X4ss
|
12
|
+
using ColouredText
|
8
13
|
|
9
|
-
def initialize(savefile=nil, mouse: false)
|
14
|
+
def initialize(savefile=nil, mouse: false, window: false, debug: false)
|
10
15
|
|
11
16
|
@file = savefile
|
12
17
|
@count = 1
|
13
|
-
@mouse = mouse ? '
|
18
|
+
@mouse = mouse ? 'm' : ''
|
19
|
+
@blob = []
|
20
|
+
@mode = window ? :window : :fullscreen
|
21
|
+
@debug = debug
|
14
22
|
|
15
23
|
end
|
16
24
|
|
17
25
|
# mode options: :window, :fullscreen
|
18
26
|
#
|
19
|
-
def capture(mode
|
27
|
+
def capture(mode=@mode)
|
28
|
+
|
29
|
+
blob = screenshot(mode)
|
30
|
+
|
31
|
+
if @file then
|
32
|
+
|
33
|
+
File.write @file % @count, blob
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
@count += 1
|
38
|
+
@blob << blob
|
20
39
|
|
21
|
-
area = mode == :fullscreen ? 'f' : 'w'
|
22
|
-
`xfce4-screenshooter -c#{area}#{@mouse}`
|
23
|
-
@blob = `xclip -selection clipboard -target image/png -out`
|
24
|
-
File.write @file % @count, @blob
|
25
|
-
@count += 1
|
26
40
|
end
|
27
41
|
|
28
42
|
def from_blob
|
29
43
|
@blob
|
30
44
|
end
|
31
45
|
|
46
|
+
def record(interval: 1, duration: 6, mode: @mode)
|
47
|
+
|
48
|
+
return 'interval must be 0.8 or greater' if interval < 0.8
|
49
|
+
|
50
|
+
t = Time.now
|
51
|
+
|
52
|
+
while(Time.now <= t+duration) do
|
53
|
+
|
54
|
+
puts 'time: ' + Time.now.inspect
|
55
|
+
@blob << screenshot(mode)
|
56
|
+
sleep interval
|
57
|
+
yield(@blob.shift) if block_given?
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
def save(file=@file)
|
64
|
+
|
65
|
+
@blob.each.with_index {|blob, i| File.write file % (i+1).to_s, blob }
|
66
|
+
|
67
|
+
:saved
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def screenshot(mode=@mode)
|
73
|
+
|
74
|
+
area = mode == :fullscreen ? 'f' : 'w'
|
75
|
+
|
76
|
+
`xfce4-screenshooter -c#{area}#{@mouse}`
|
77
|
+
`xclip -selection clipboard -target image/png -out`
|
78
|
+
|
79
|
+
end
|
32
80
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: x4ss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,8 +31,28 @@ cert_chain:
|
|
31
31
|
T8EEvno4Yr6u3HjCydaJJ72Dq1RKcpnTDYiYzFRF9KFXdVkhaXBH1d8nOCcpgxlc
|
32
32
|
uUB84fdao69LcA==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
35
|
-
dependencies:
|
34
|
+
date: 2020-05-12 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: c32
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.2.0
|
43
|
+
- - "~>"
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0.2'
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.2.0
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0.2'
|
36
56
|
description:
|
37
57
|
email: james@jamesrobertson.eu
|
38
58
|
executables: []
|
@@ -59,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
79
|
- !ruby/object:Gem::Version
|
60
80
|
version: '0'
|
61
81
|
requirements: []
|
62
|
-
rubygems_version: 3.0.
|
82
|
+
rubygems_version: 3.0.3
|
63
83
|
signing_key:
|
64
84
|
specification_version: 4
|
65
85
|
summary: A wrapper for xfce4-screenshooter and xclip to save screenshots.
|
metadata.gz.sig
CHANGED
Binary file
|