scite-session 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/scite/session.rb +20 -5
- data/lib/scite/session/version.rb +1 -1
- data/lib/scite/window.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c32f20cdd4180c050bc11e714d640deede0f3f33
|
4
|
+
data.tar.gz: 2e840b0ec0326d68a29bea76175985e3cde42443
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54fdfd3ef168621c72e922a6e32308990e615ae024d0814d539b2dee2266be4d4c4528a5d9f65bdc8e4e105cfe3b0081beeb800e8f8e0feb97c329004f250d60
|
7
|
+
data.tar.gz: 0084919865a1bd5e59a641cba0db9b6aa56fcad2f2108a3188deabeb87afcb5f6021990786caa067579257480e1783bec5144dbeac83ded3afdcb3b3cc464129
|
data/lib/scite/session.rb
CHANGED
@@ -28,22 +28,31 @@ module SciTE
|
|
28
28
|
|
29
29
|
class << self
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
# Save session
|
32
|
+
# @ windows : Array(SciTE::Window) : Save session
|
33
|
+
# @ layout : String : session layout yml-file name (w/o extension)
|
34
|
+
# @ append : Boolean : add a window record to the layout yml instead of overwrite it (default: false)
|
35
|
+
def save(windows, layout:, append: false)
|
36
|
+
window_configs = windows.map {|win|
|
33
37
|
{session: win.session, title: win.title, move_to: win.position}
|
34
|
-
}
|
38
|
+
}
|
39
|
+
if append
|
40
|
+
window_configs = load_layout(layout) + window_configs
|
41
|
+
end
|
42
|
+
|
43
|
+
File.write "#{layouts_home}/#{layout}.yml", window_configs.to_yaml
|
35
44
|
end
|
36
45
|
|
37
46
|
def restore(windows: nil, layout: nil)
|
38
47
|
if layout
|
39
|
-
windows
|
48
|
+
windows = load_layout(layout)
|
40
49
|
end
|
41
50
|
|
42
51
|
windows.map! {|params|
|
43
52
|
if params.is Window
|
44
53
|
params
|
45
54
|
else
|
46
|
-
Window.new params
|
55
|
+
Window.new **params
|
47
56
|
end
|
48
57
|
}
|
49
58
|
windows.each {|w|
|
@@ -52,6 +61,12 @@ module SciTE
|
|
52
61
|
}
|
53
62
|
windows.each &:wait
|
54
63
|
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def load_layout(layout)
|
68
|
+
YAML.load read "#{layouts_home}/#{layout}.yml"
|
69
|
+
end
|
55
70
|
|
56
71
|
end
|
57
72
|
end
|
data/lib/scite/window.rb
CHANGED
@@ -69,9 +69,10 @@ module SciTE
|
|
69
69
|
attr_reader :session, :move_to
|
70
70
|
attr_writer :session
|
71
71
|
|
72
|
-
|
72
|
+
# @ title : String : regexp-ish of title of windows you want to select
|
73
|
+
def self.find_all(title: '.+ [-*] SciTE')
|
73
74
|
`wmctrl -l -p`.split("\n").map {|line|
|
74
|
-
if line[/^(0x\w+) +-?\d+ (\d+) +\S+ +(
|
75
|
+
if line[/^(0x\w+) +-?\d+ (\d+) +\S+ +(#{title})$/]
|
75
76
|
new(title: $3, pid: $2.to_i, wid: $1)
|
76
77
|
end
|
77
78
|
}.compact
|
@@ -87,7 +88,7 @@ module SciTE
|
|
87
88
|
@threads << Thread.new {
|
88
89
|
sleep 0.2
|
89
90
|
self.position = {w: 50, h: 20, x: 2550, y: -40}
|
90
|
-
sleep 3 #
|
91
|
+
sleep 3 # let tabs to be rendered
|
91
92
|
move if @move_to
|
92
93
|
set_title if @title
|
93
94
|
yield self if block_given?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scite-session
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Baev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|