Germinal 1.1.7 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b24f02bcd5fa9f53e135f09240c96da374286ef
4
- data.tar.gz: 0b186193374daecfedb80955a2188b12a29b2ae1
3
+ metadata.gz: 857ce9762355a5dd4ed9d4512d320cd8b11e56cb
4
+ data.tar.gz: fa872d399fc923051d3954ea33525c579800187e
5
5
  SHA512:
6
- metadata.gz: dbefcb109b6cdb9b3001450cfbd10300917b47141eac0246fe6c06c7ceed81e7a92a9ee80cadaec7a6cdea75deb66ebd1ad10a9d48cb335015b9d97a696b697a
7
- data.tar.gz: e0cb378ea82fc8035dd13155dab54a30ddb9de1d56f9c1b6780ae36c6cd7ee8dc76b9ae98e20049d7a813c3fa0957b9bdaf07d5788dced00b6caa8e5d2340bf8
6
+ metadata.gz: a2e32a81a5278fafeba205c6cd1e75c141be1231046e695754a9344caa64bdbb6e94523a05c6e015bc1c69e60abb2f12191d9387f7a2a355fe181e071047fb42
7
+ data.tar.gz: 32f34c05a3c5b5221f868da1f923146c5588cea2ca446fb26807dba345c8bf581f0a86d472d46698420a16960c6ee44c2ffbd26c9ce5d01d0a89ee885cd2dec5
data/README.md CHANGED
@@ -10,7 +10,7 @@ Germinal is Terminal written with the Gtk3 and Vte3 ruby bindings from the proje
10
10
  * tabs can be reordered or selected through the preview mode ( `Shift + Ctrl + o` )
11
11
  <a href="https://raw.github.com/cedlemo/germinal/master/screenshot2.png"><img src="https://raw.github.com/cedlemo/germinal/master/screenshot2_prev.png" width="576" height="324" alt="Screenshot"></a>
12
12
 
13
- * Each tab can be renammed
13
+ * Each tab can be named.
14
14
  * The configuration can be done via a Css file
15
15
  * Terminal colors can be changed on the fly and saved in the CSS configuration file
16
16
  <a href="https://raw.github.com/cedlemo/germinal/master/screenshot3.png"><img src="https://raw.github.com/cedlemo/germinal/master/screenshot3_prev.png" width="576" height="324" alt="Screenshot"></a>
@@ -23,6 +23,8 @@ Germinal is Terminal written with the Gtk3 and Vte3 ruby bindings from the proje
23
23
  ## TODO:
24
24
  * Regex support in the terminals in order to launch web navigator if there is an url or launch a media player if there is a match for avi file for example.
25
25
  * Create more Css properties in oder to configure the terminals (cursor shape or blink mode, audible bell or not ...)
26
+ * Make Germinal allows users to modify existing modules. For example if a user copy the css_editor.rb in the directory *~/.config/Germinal/lib/css_editor.rb*, he should be able to modify it in order to fit its needs.
27
+ * Make Germinal allows users to easily create their own modules. For example create a tab that will act as a MPD client. There will be widgets that control a MPD server and a GtkTree widget that displays the playlist of the MPD server for example.
26
28
 
27
29
  ## Shortcuts
28
30
 
@@ -36,7 +38,7 @@ Germinal is Terminal written with the Gtk3 and Vte3 ruby bindings from the proje
36
38
 
37
39
  * `Shift + Ctrl + right` next tab
38
40
 
39
- * ` Shift + Ctrl + c` display color selectors for the vte in overlay mod (Esc to leave)
41
+ * `Shift + Ctrl + c` display color selectors for the vte in overlay mod (Esc to leave)
40
42
 
41
43
  * `Shift + Ctrl + f` display font selector for the vte in overlay mod (Esc to leave)
42
44
 
@@ -80,9 +82,8 @@ It can be found in the file `$HOME/.config/Germinal/germinal.css` (Be carefull b
80
82
  GerminalWindow GtkHeaderBar GtkEntry{
81
83
  border-radius: 4px;
82
84
  }
83
-
84
85
  GerminalWindow GtkOverlay GtkBox#resize_box{
85
- background-color: rgba(49, 150, 188, 0.5);
86
+ background: rgba(49, 150, 188, 0.5);
86
87
  border-top: 1px;
87
88
  border-left: 1px;
88
89
  border-bottom: 1px;
@@ -90,7 +91,6 @@ GerminalWindow GtkOverlay GtkBox#resize_box{
90
91
  border-color: rgba(49, 150, 188, 1);
91
92
  border-radius: 6px 0px 0px 0px;
92
93
  }
93
-
94
94
  GerminalWindow GtkOverlay GtkScrolledWindow#terminal_chooser GtkBox{
95
95
  background-color: rgba(49, 150, 188, 0.5);
96
96
  border-top: 1px;
@@ -101,13 +101,22 @@ GerminalWindow GtkOverlay GtkScrolledWindow#terminal_chooser GtkBox{
101
101
  border-radius: 6px 0px 0px 6px;
102
102
  }
103
103
 
104
- GerminalWindow GtkOverlay GtkScrolledWindow GtkBox GtkButton {
104
+ GerminalWindow GtkOverlay GtkScrolledWindow GtkGrid GtkButton {
105
105
  margin: 0px;
106
106
  padding: 0px;
107
107
  }
108
- GerminalWindow GtkOverlay GtkScrolledWindow GtkBox GtkImage {
108
+
109
+ GerminalWindow GtkOverlay GtkScrolledWindow GtkGrid GtkButton GtkImage {
109
110
  border: solid 3px rgba(0, 0, 0, 0.0);
110
111
  }
112
+
113
+ .tooltip {
114
+ background:rgba(50, 50, 50,0.5);
115
+ border:none;
116
+ color: #ddd;
117
+ border-top-right-radius: 6px;
118
+ border-bottom-left-radius: 6px;
119
+ }
111
120
  ```
112
121
 
113
122
  Each time you modify this configuration via the interface of Germinal (terminal colors selector, terminal font selector, css editor) and that you save your modifications, Germinal create a copy of your previous Css file under a new name with :
@@ -147,7 +156,7 @@ the ruby gem binaries (for example).
147
156
 
148
157
  git clone https://github.com/cedlemo/germinal.git
149
158
  cd germinal/bin
150
-
159
+
151
160
  ##### Edit the files Germinal and test
152
161
  The filenames correspond to their functionnalities.
153
162
  Simply run `./Germinal` when you have done your modifications.
data/bin/Germinal CHANGED
@@ -18,6 +18,7 @@
18
18
  # Germinal is a terminal emulator written with the ruby gtk3 and
19
19
  # vte 3 bindings.
20
20
  # Author:: Cedlemo (mailto:cedlemo@gmx.com)
21
+
21
22
  require "gtk3"
22
23
  require "vte3"
23
24
  require "fileutils"
@@ -26,9 +27,9 @@ require "sass"
26
27
  CURRENT_PATH = File.expand_path(File.dirname(__FILE__))
27
28
  LIB_PATH = "#{CURRENT_PATH}/../lib"
28
29
  DATA_PATH = "#{CURRENT_PATH}/../data"
29
- CONFIG_DIR = "#{ENV['HOME']}/.config/Germinal"
30
+ CONFIG_DIR = File.expand_path("#{ENV['HOME']}/.config/Germinal")
30
31
  USR_CSS = "#{CONFIG_DIR}/germinal.css"
31
-
32
+ USR_LIB_PATH = "#{CONFIG_DIR}/lib"
32
33
  gresource_bin = "#{DATA_PATH}/germinal.gresource"
33
34
  gresource_xml = "#{DATA_PATH}/germinal.gresource.xml"
34
35
 
@@ -43,122 +44,13 @@ end
43
44
 
44
45
  resource = Gio::Resource.load(gresource_bin)
45
46
  Gio::Resources.register(resource)
46
-
47
- require "#{LIB_PATH}/terminal.rb"
48
- require "#{LIB_PATH}/notebook.rb"
49
- require "#{LIB_PATH}/color_selector.rb"
50
- require "#{LIB_PATH}/font_selector.rb"
51
- require "#{LIB_PATH}/terminal_chooser.rb"
52
- require "#{LIB_PATH}/window.rb"
53
- require "#{LIB_PATH}/resize_message.rb"
54
- require "#{LIB_PATH}/css_editor.rb"
55
-
56
- class GerminalApplication < Gtk::Application
57
- attr_reader :provider
58
- def initialize
59
- super("com.github.cedlemo.germinal", :non_unique)
60
-
61
- signal_connect "startup" do
62
- load_css_config
63
- display = Gdk::Display.default
64
- screen = display.default_screen
65
- Gtk::StyleContext.add_provider_for_screen(screen, @provider, Gtk::StyleProvider::PRIORITY_USER)
66
- end
67
-
68
- signal_connect "activate" do |application|
69
- window = GerminalWindow.new(application)
70
- window.present
71
- window.add_terminal
72
- window.notebook.current.grab_focus
73
- end
74
- end
75
-
76
- def update_css(new_props = nil)
77
- css_properties
78
- @props.merge!(new_props) if new_props
79
- css = update_css_properties
80
- merged_css = Sass::Engine.new(css, :syntax => :scss).render
81
- if File.exist?(USR_CSS)
82
- FileUtils.mv(USR_CSS, "#{USR_CSS}_#{Time.new.strftime('%Y-%m-%d-%H-%M-%S')}.backup")
83
- File.open(USR_CSS, "w") do |file|
84
- file.puts merged_css
85
- end
86
- else
87
- File.open(USR_CSS, "w") do |file|
88
- file.puts merged_css
89
- end
90
- end
91
- end
92
-
93
- private
94
-
95
- def load_css_config
96
- @provider = Gtk::CssProvider.new
97
- default_css = Gio::Resources.lookup_data("/com/github/cedlemo/germinal/germinal.css", 0)
98
- if File.exist?(USR_CSS)
99
- begin
100
- @provider.load(:path => USR_CSS)
101
- rescue
102
- puts "Bad css file using default css"
103
- @provider.load(:data => default_css)
104
- end
105
- else
106
- puts "No custom CSS, using default css"
107
- @provider.load(:data => default_css)
108
- end
109
- end
110
-
111
- def load_css_to_tree
112
- engine = Sass::Engine.new(@provider.to_s, :syntax => :scss)
113
- engine.to_tree
114
- end
115
-
116
- def update_css_properties
117
- modified_sass = change_existing_properties
118
- sass_to_add = @props.empty? ? "" : add_new_css_properties
119
- Sass::Engine.new(sass_to_add + modified_sass, :syntax => :sass).render
120
- end
121
-
122
- def add_new_css_properties
123
- new_sass = "*"
124
- @props.each do |k, v|
125
- new_sass += "\n #{k}: #{v}"
126
- end
127
- new_sass + "\n"
128
- end
129
-
130
- def change_existing_properties
131
- keys_found = []
132
- tree = load_css_to_tree
133
- # we search for properties that are already configured
134
- tree.children.each do |node|
135
- node.each do |prop|
136
- next if prop.class != Sass::Tree::PropNode
137
- name = prop.name[0]
138
- next unless @props[name]
139
- keys_found << name unless keys_found.include?(name)
140
- if @props[name] != prop.value.value
141
- value_object = prop.value.value.class.new(@props[name])
142
- prop.value = Sass::Script::Tree::Literal.new(value_object)
143
- end
144
- end
145
- end
146
- keys_found.each do |k|
147
- @props.delete(k)
148
- end
149
- tree.to_sass
150
- end
151
-
152
- def css_properties
153
- @props = {}
154
- if windows[0].notebook.current.class == GerminalTerminal
155
- terminal_colors = windows[0].notebook.current.colors
156
- TERMINAL_COLOR_NAMES.each_with_index do |c, i|
157
- @props["-GerminalTerminal-#{c}"] = terminal_colors[i].to_s
158
- end
159
- @props["-GerminalTerminal-font"] = DEFAULT_TERMINAL_FONT
160
- @props["-GerminalWindow-shell"] = "\'/usr/bin/fish\'"
161
- end
47
+ # Load default libraries
48
+ %w(application terminal notebook color_selector font_selector
49
+ terminal_chooser window resize_message css_editor).each do |l|
50
+ if File.exist?("#{USR_LIB_PATH}/#{l}.rb")
51
+ require "#{USR_LIB_PATH}/#{l}.rb"
52
+ else
53
+ require "#{LIB_PATH}/#{l}.rb"
162
54
  end
163
55
  end
164
56
 
data/data/germinal.css CHANGED
@@ -24,6 +24,7 @@
24
24
  -GerminalWindow-height: 500;
25
25
  -GerminalWindow-width: 1000;*/
26
26
  }
27
+
27
28
  GerminalWindow GtkHeaderBar GtkEntry{
28
29
  border-radius: 4px;
29
30
  }
@@ -45,10 +46,20 @@ GerminalWindow GtkOverlay GtkScrolledWindow#terminal_chooser GtkBox{
45
46
  border-color: rgba(49, 150, 188, 1);
46
47
  border-radius: 6px 0px 0px 6px;
47
48
  }
49
+
48
50
  GerminalWindow GtkOverlay GtkScrolledWindow GtkGrid GtkButton {
49
51
  margin: 0px;
50
52
  padding: 0px;
51
53
  }
54
+
52
55
  GerminalWindow GtkOverlay GtkScrolledWindow GtkGrid GtkButton GtkImage {
53
56
  border: solid 3px rgba(0, 0, 0, 0.0);
54
57
  }
58
+
59
+ .tooltip {
60
+ background:rgba(50, 50, 50,0.5);
61
+ border:none;
62
+ color: #ddd;
63
+ border-top-right-radius: 6px;
64
+ border-bottom-left-radius: 6px;
65
+ }
@@ -0,0 +1,124 @@
1
+ # Copyright 2016 Cédric LE MOIGNE, cedlemo@gmx.com
2
+ # This file is part of Germinal.
3
+ #
4
+ # Germinal is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # any later version.
8
+ #
9
+ # Germinal is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with Germinal. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ class GerminalApplication < Gtk::Application
18
+ attr_reader :provider
19
+ def initialize
20
+ super("com.github.cedlemo.germinal", :non_unique)
21
+
22
+ signal_connect "startup" do
23
+ load_css_config
24
+ display = Gdk::Display.default
25
+ screen = display.default_screen
26
+ Gtk::StyleContext.add_provider_for_screen(screen, @provider, Gtk::StyleProvider::PRIORITY_USER)
27
+ end
28
+
29
+ signal_connect "activate" do |application|
30
+ window = GerminalWindow.new(application)
31
+ window.present
32
+ window.add_terminal
33
+ window.notebook.current.grab_focus
34
+ end
35
+ end
36
+
37
+ def update_css(new_props = nil)
38
+ css_properties
39
+ @props.merge!(new_props) if new_props
40
+ css = update_css_properties
41
+ merged_css = Sass::Engine.new(css, :syntax => :scss).render
42
+ if File.exist?(USR_CSS)
43
+ FileUtils.mv(USR_CSS, "#{USR_CSS}_#{Time.new.strftime('%Y-%m-%d-%H-%M-%S')}.backup")
44
+ File.open(USR_CSS, "w") do |file|
45
+ file.puts merged_css
46
+ end
47
+ else
48
+ File.open(USR_CSS, "w") do |file|
49
+ file.puts merged_css
50
+ end
51
+ end
52
+ end
53
+
54
+ private
55
+
56
+ def load_css_config
57
+ @provider = Gtk::CssProvider.new
58
+ default_css = Gio::Resources.lookup_data("/com/github/cedlemo/germinal/germinal.css", 0)
59
+ if File.exist?(USR_CSS)
60
+ begin
61
+ @provider.load(:path => USR_CSS)
62
+ rescue
63
+ puts "Bad css file using default css"
64
+ @provider.load(:data => default_css)
65
+ end
66
+ else
67
+ puts "No custom CSS, using default css"
68
+ @provider.load(:data => default_css)
69
+ end
70
+ end
71
+
72
+ def load_css_to_tree
73
+ engine = Sass::Engine.new(@provider.to_s, :syntax => :scss)
74
+ engine.to_tree
75
+ end
76
+
77
+ def update_css_properties
78
+ modified_sass = change_existing_properties
79
+ sass_to_add = @props.empty? ? "" : add_new_css_properties
80
+ Sass::Engine.new(sass_to_add + modified_sass, :syntax => :sass).render
81
+ end
82
+
83
+ def add_new_css_properties
84
+ new_sass = "*"
85
+ @props.each do |k, v|
86
+ new_sass += "\n #{k}: #{v}"
87
+ end
88
+ new_sass + "\n"
89
+ end
90
+
91
+ def change_existing_properties
92
+ keys_found = []
93
+ tree = load_css_to_tree
94
+ # we search for properties that are already configured
95
+ tree.children.each do |node|
96
+ node.each do |prop|
97
+ next if prop.class != Sass::Tree::PropNode
98
+ name = prop.name[0]
99
+ next unless @props[name]
100
+ keys_found << name unless keys_found.include?(name)
101
+ if @props[name] != prop.value.value
102
+ value_object = prop.value.value.class.new(@props[name])
103
+ prop.value = Sass::Script::Tree::Literal.new(value_object)
104
+ end
105
+ end
106
+ end
107
+ keys_found.each do |k|
108
+ @props.delete(k)
109
+ end
110
+ tree.to_sass
111
+ end
112
+
113
+ def css_properties
114
+ @props = {}
115
+ if windows[0].notebook.current.class == GerminalTerminal
116
+ terminal_colors = windows[0].notebook.current.colors
117
+ TERMINAL_COLOR_NAMES.each_with_index do |c, i|
118
+ @props["-GerminalTerminal-#{c}"] = terminal_colors[i].to_s
119
+ end
120
+ @props["-GerminalTerminal-font"] = DEFAULT_TERMINAL_FONT
121
+ @props["-GerminalWindow-shell"] = "\'/usr/bin/fish\'"
122
+ end
123
+ end
124
+ end
@@ -115,8 +115,12 @@ class GerminalTermChooser < Gtk::ScrolledWindow
115
115
  button.tooltip_text = "Quit Germinal"
116
116
  image = Gtk::Image.new(:stock => Gtk::Stock::QUIT, :size => :button)
117
117
  button.add(image)
118
+ button.signal_connect "button_press_event" do
119
+ @window.quit_gracefully
120
+ end
118
121
  button
119
122
  end
123
+
120
124
  def generate_previews_pixbufs
121
125
  current_page = @window.notebook.page
122
126
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Germinal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cédric LE MOIGNE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-01 00:00:00.000000000 Z
11
+ date: 2016-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vte3
@@ -84,6 +84,7 @@ files:
84
84
  - data/germinal.css
85
85
  - data/germinal.gresource.xml
86
86
  - data/window.ui
87
+ - lib/application.rb
87
88
  - lib/color_selector.rb
88
89
  - lib/css_editor.rb
89
90
  - lib/font_selector.rb