topinambour 1.0.3 → 1.0.5

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: ebb72186258606bea34685031717fda37dd0e0c3
4
- data.tar.gz: 5f9126dbeb67655424c77ab18a5ccbee00a61c85
3
+ metadata.gz: 658f66555184e2186a21c944bb2d98538eeb1bd8
4
+ data.tar.gz: 1fb7a37aaee8a9b8f6ffbb0703c0b0eaa7eadca2
5
5
  SHA512:
6
- metadata.gz: fdf0c7271408c88ec111d7fe5a05571736ef9251bf6a1a5dbde356ce9c3325850a6f5e7162edad4c0ce170e6cf5c59880878cde87d4d902c3b92e766797a7055
7
- data.tar.gz: cb63168c754ccf4501d3a833e60602a8ebdd3b3ec04769fad5ef891eb7e892bb4f634149745e5e79646a534b92229b0abcb42c745d7bba1a187a5b22a55faf12
6
+ metadata.gz: a9805c6e16ec8a9a133253e6c3400cf04cffeca79a5fa75a5e534de8ecad0d8630d7eb9b96fad8f94efb2d73f20a70810e3b7233d6db4fda21a2143a892a5375
7
+ data.tar.gz: da3d12005d90dfa7fd2eb5d9548107885db6a664a62fa9d1acb66b65a36826f50d6dd067c8ae945acd786a728fb9cfc24ed23147b6c573de74c29baaf7605abc
data/README.md CHANGED
@@ -23,7 +23,7 @@ Topinambour is Terminal written with the Gtk3 and Vte3 ruby bindings from the pr
23
23
 
24
24
  * The Css file can be edited in a tab of Topinambour and saved. Each modifications are applied while you are writting them. (Use `Shift + Ctrl + w` to close the editor)
25
25
  <a href="https://raw.github.com/cedlemo/topinambour/master/screenshot5.png"><img src="https://raw.github.com/cedlemo/topinambour/master/screenshot5_prev.png" width="576" height="324" alt="Screenshot"></a>
26
- * Topinambour allows users to modify existing modules. For example if a user copy the css_editor.rb in the directory *~/.config/Topinambour/lib/css_editor.rb*, he should be able to modify it in order to fit its needs.
26
+ * Topinambour allows users to modify existing modules. For example if a user copy the css_editor.rb in the directory *~/.config/topinambour/lib/css_editor.rb*, he should be able to modify it in order to fit its needs.
27
27
 
28
28
  ## TODO:
29
29
  * 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.
@@ -53,7 +53,7 @@ Topinambour is Terminal written with the Gtk3 and Vte3 ruby bindings from the pr
53
53
 
54
54
  ## User configuration
55
55
 
56
- It can be found in the file `$HOME/.config/Topinambour/topinambour.css` (Be carefull by default Topinambour use fish as a default shell, if you want to use another one specify it in the topinambour.css file)
56
+ It can be found in the file `$HOME/.config/topinambour/topinambour.css` (Be carefull by default Topinambour use fish as a default shell, if you want to use another one specify it in the topinambour.css file)
57
57
 
58
58
  ```css
59
59
  *{
@@ -46,7 +46,7 @@ end
46
46
  resource = Gio::Resource.load(gresource_bin)
47
47
  Gio::Resources.register(resource)
48
48
  # Load default libraries !!WARNING!! loading order matters
49
- %w(actions style_properties css_handler application terminal_regex terminal notebook color_selector font_selector
49
+ %w(actions style_properties css_handler application terminal notebook color_selector font_selector
50
50
  terminal_chooser headerbar shortcuts window resize_message css_editor).each do |l|
51
51
  if File.exist?("#{USR_LIB_PATH}/#{l}.rb")
52
52
  require "#{USR_LIB_PATH}/#{l}.rb"
@@ -54,3 +54,37 @@ module TopinambourStyleProperties
54
54
  install_style_property(property) if property
55
55
  end
56
56
  end
57
+
58
+ TERMINAL_COLOR_NAMES = [:foreground, :background, :black, :red, :green, :yellow,
59
+ :blue, :magenta, :cyan, :white, :brightblack,
60
+ :brightred, :brightgreen, :brightyellow, :brightblue,
61
+ :brightmagenta, :brightcyan, :brightwhite
62
+ ]
63
+ DEFAULT_TERMINAL_COLORS = %w(#aeafad #323232 #000000 #b9214f #A6E22E #ff9800
64
+ #3399ff #8e33ff #06a2dc #B0B0B0 #5D5D5D #ff5c8d
65
+ #CDEE69 #ffff00 #9CD9F0 #FBB1F9 #77DFD8 #F7F7F7
66
+ )
67
+ DEFAULT_TERMINAL_FONT = "Monospace 11"
68
+
69
+ class TopinambourTerminal < Vte::Terminal
70
+ extend TopinambourStyleProperties
71
+ type_register
72
+ TERMINAL_COLOR_NAMES.each_with_index do |c|
73
+ name = c.to_s
74
+ install_style("boxed",
75
+ name,
76
+ GLib::Type["GdkRGBA"])
77
+ end
78
+ install_style("boxed",
79
+ "font",
80
+ GLib::Type["PangoFontDescription"])
81
+ end
82
+
83
+ class TopinambourWindow < Gtk::ApplicationWindow
84
+ extend TopinambourStyleProperties
85
+ type_register
86
+ install_style("string", "shell", "/usr/bin/fish")
87
+ install_style("int", "width", [-1, 2000, 1000])
88
+ install_style("int", "height", [-1, 2000, 500])
89
+ install_style("string", "css-editor-style", "classic")
90
+ end
@@ -14,27 +14,11 @@
14
14
  # You should have received a copy of the GNU General Public License
15
15
  # along with Topinambour. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
- TERMINAL_COLOR_NAMES = [:foreground, :background, :black, :red, :green, :yellow, :blue, :magenta, :cyan, :white,
18
- :brightblack, :brightred, :brightgreen, :brightyellow, :brightblue, :brightmagenta, :brightcyan, :brightwhite]
19
- DEFAULT_TERMINAL_COLORS = %w(#aeafad #323232 #000000 #b9214f #A6E22E #ff9800 #3399ff #8e33ff #06a2dc
20
- #B0B0B0 #5D5D5D #ff5c8d #CDEE69 #ffff00 #9CD9F0 #FBB1F9 #77DFD8 #F7F7F7)
21
- DEFAULT_TERMINAL_FONT = "Monospace 11"
22
17
  ##
23
18
  # The default vte terminal customized
24
- class TopinambourTerminal < Vte::Terminal
25
- extend TopinambourStyleProperties
19
+ class TopinambourTerminal
26
20
  attr_reader :pid, :menu
27
21
  attr_accessor :preview, :colors, :tab_label
28
- type_register
29
- TERMINAL_COLOR_NAMES.each_with_index do |c|
30
- name = c.to_s
31
- self.install_style("boxed",
32
- name,
33
- GLib::Type["GdkRGBA"])
34
- end
35
- self.install_style("boxed",
36
- "font",
37
- GLib::Type["PangoFontDescription"])
38
22
 
39
23
  ##
40
24
  # Create a new TopinambourTerminal instance that runs command_string
@@ -53,21 +37,14 @@ class TopinambourTerminal < Vte::Terminal
53
37
  notebook.toplevel.application.quit unless notebook.n_pages >= 1
54
38
  end
55
39
 
56
- signal_connect "window-title-changed" do |widget|
57
- if parent && parent.current == self
58
- current_label = parent.get_tab_label(widget)
59
- if @tab_label.class == String
60
- current_label.text = @tab_label
61
- else
62
- current_label.text = window_title
63
- parent.toplevel.current_label.text = window_title
64
- end
65
- end
40
+ signal_connect "window-title-changed" do
41
+ when_terminal_title_change if parent && parent.current == self
66
42
  end
67
43
 
68
- builder = Gtk::Builder.new(:resource => "/com/github/cedlemo/topinambour/terminal-menu.ui")
44
+ builder = Gtk::Builder.new(:resource =>
45
+ "/com/github/cedlemo/topinambour/terminal-menu.ui")
69
46
  @menu = Gtk::Popover.new(self, builder["termmenu"])
70
-
47
+
71
48
  signal_connect "button-press-event" do |widget, event|
72
49
  if event.type == Gdk::EventType::BUTTON_PRESS &&
73
50
  event.button == Gdk::BUTTON_SECONDARY
@@ -100,9 +77,7 @@ class TopinambourTerminal < Vte::Terminal
100
77
 
101
78
  def css_font
102
79
  font = style_get_property("font")
103
- unless font
104
- font = Pango::FontDescription.new(DEFAULT_TERMINAL_FONT)
105
- end
80
+ font = Pango::FontDescription.new(DEFAULT_TERMINAL_FONT) unless font
106
81
  font
107
82
  end
108
83
 
@@ -129,17 +104,17 @@ class TopinambourTerminal < Vte::Terminal
129
104
  end
130
105
 
131
106
  def add_matches
132
- @REGEXES = [:REGEX_URL_AS_IS, :REGEX_URL_FILE, :REGEX_URL_HTTP,
133
- :REGEX_URL_VOIP, :REGEX_EMAIL, :REGEX_NEWS_MAN]
134
- @REGEXES.each do |name|
135
- regex_name = TopinambourRegex.const_get(name)
136
- flags = [GLib::RegexCompileFlags::OPTIMIZE,
137
- GLib::RegexCompileFlags::MULTILINE]
138
- regex = GLib::Regex.new(regex_name, :compile_options => flags)
139
- match_add_gregex(regex, 0)
140
- end
107
+ # @REGEXES = [:REGEX_URL_AS_IS, :REGEX_URL_FILE, :REGEX_URL_HTTP,
108
+ # :REGEX_URL_VOIP, :REGEX_EMAIL, :REGEX_NEWS_MAN]
109
+ # @REGEXES.each do |name|
110
+ # regex_name = TopinambourRegex.const_get(name)
111
+ # flags = [GLib::RegexCompileFlags::OPTIMIZE,
112
+ # GLib::RegexCompileFlags::MULTILINE]
113
+ # regex = GLib::Regex.new(regex_name, :compile_options => flags)
114
+ # match_add_gregex(regex, 0)
115
+ # end
141
116
  end
142
-
117
+
143
118
  def display_copy_past_menu(widget, event)
144
119
  x, y = event.window.coords_to_parent(event.x,
145
120
  event.y)
@@ -150,8 +125,16 @@ class TopinambourTerminal < Vte::Terminal
150
125
  widget.menu.set_pointing_to(rect)
151
126
  widget.menu.show
152
127
  end
153
-
154
- def manage_regex_on_click(widget, event)
155
- #puts match_check_event(event).inspect
128
+
129
+ def manage_regex_on_click(_widget, event)
130
+ _match, _regex_type = match_check_event(event)
131
+ end
132
+
133
+ def current_terminal_title
134
+ @tab_label.class == String ? @tab_label : window_title
135
+ end
136
+
137
+ def when_terminal_title_change
138
+ parent.toplevel.current_label.text = current_terminal_title
156
139
  end
157
140
  end
@@ -14,16 +14,9 @@
14
14
  # You should have received a copy of the GNU General Public License
15
15
  # along with Topinambour. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
- class TopinambourWindow < Gtk::ApplicationWindow
18
- extend TopinambourStyleProperties
17
+ class TopinambourWindow
19
18
  attr_reader :notebook, :bar, :overlay, :current_label, :current_tab, :css_editor_style
20
19
 
21
- type_register
22
- install_style("string", "shell", "/usr/bin/fish")
23
- install_style("int", "width", [-1, 2000, 1000])
24
- install_style("int", "height", [-1, 2000, 500])
25
- install_style("string", "css-editor-style", "classic")
26
-
27
20
  def initialize(application)
28
21
  super(:application => application)
29
22
  set_icon_from_file("#{DATA_PATH}/topinambour-icon.png")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: topinambour
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.5
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-03-19 00:00:00.000000000 Z
11
+ date: 2016-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vte3
@@ -113,7 +113,6 @@ files:
113
113
  - lib/style_properties.rb
114
114
  - lib/terminal.rb
115
115
  - lib/terminal_chooser.rb
116
- - lib/terminal_regex.rb
117
116
  - lib/window.rb
118
117
  homepage: https://github.com/cedlemo/topinambour
119
118
  licenses:
@@ -1,100 +0,0 @@
1
- # Copyright 2016 Cédric LE MOIGNE, cedlemo@gmx.com
2
- # This file is part of Topinambour.
3
- #
4
- # Topinambour 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
- # Topinambour 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 Topinambour. If not, see <http://www.gnu.org/licenses/>.
16
-
17
- # Stolen from https://github.com/GNOME/gnome-terminal/blob/master/src/terminal-regex.h
18
- module TopinambourRegex
19
- SCHEME = "(?ix: news | telnet | nntp | https? | ftps? | sftp | webcal )"
20
- USERCHARS = "-+.[:alnum:]"
21
- # Nonempty username, e.g. "john.smith"
22
- USER = "[#{USERCHARS}]+"
23
- PASSCHARS_CLASS = '[-[:alnum:]\\Q,?;.:/!%$^*&~\"#\'\\E]'
24
- # Optional colon-prefixed password. I guess empty password should be allowed, right? E.g. ":secret", ":", "" */
25
- PASS = "(?x: :#{PASSCHARS_CLASS}* )?"
26
- # Optional at-terminated username (with perhaps a password too), e.g. "joe@", "pete:secret@", "" */
27
- USERPASS = "(?:#{USER}#{PASS}@)?"
28
- # S4: IPv4 segment (number between 0 and 255) with lookahead at the end so that we don't match "25" in the string "256".
29
- # The lookahead could go to the last segment of IPv4 only but this construct allows nicer unittesting. */
30
- S4_DEF = "(?(DEFINE)(?<S4>(?x: (?: [0-9] | [1-9][0-9] | 1[0-9]{2} | 2[0-4][0-9] | 25[0-5] ) (?! [0-9] ) )))"
31
- # IPV4: Decimal IPv4, e.g. "1.2.3.4", with lookahead (implemented in S4) at the end so that we don't match "192.168.1.123" in the string "192.168.1.1234". */
32
- IPV4_DEF = "#{S4_DEF}(?(DEFINE)(?<IPV4>(?x: (?: (?&S4) \\. ){3} (?&S4) )))"
33
- # IPv6, including embedded IPv4, e.g. "::1", "dead:beef::1.2.3.4".
34
- # Lookahead for the next char not being a dot or digit, so it doesn't get stuck matching "dead:beef::1" in "dead:beef::1.2.3.4".
35
- # This is not required since the surrounding brackets would trigger backtracking, but it allows nicer unittesting.
36
- # TODO: more strict check (right number of colons, etc.)
37
- # TODO: add zone_id: RFC 4007 section 11, RFC 6874 */
38
- # S6: IPv6 segment, S6C: IPv6 segment followed by a comma, CS6: comma followed by an IPv6 segment */
39
- S6_DEF = "(?(DEFINE)(?<S6>[[:xdigit:]]{1,4})(?<CS6>:(?&S6))(?<S6C>(?&S6):))"
40
- # No :: shorthand */
41
- IPV6_FULL = "(?x: (?&S6C){7} (?&S6) )"
42
- # Begins with :: */
43
- IPV6_LEFT = "(?x: : (?&CS6){1,7} )"
44
- # :: somewhere in the middle - use negative lookahead to make sure there aren't too many colons in total */
45
- IPV6_MID = "(?x: (?! (?: [[:xdigit:]]*: ){8} ) (?&S6C){1,6} (?&CS6){1,6} )"
46
- # Ends with :: */
47
- IPV6_RIGHT = "(?x: (?&S6C){1,7} : )"
48
- # Is "::" and nothing more */
49
- IPV6_NULL = "(?x: :: )"
50
- # The same ones for IPv4-embedded notation, without the actual IPv4 part */
51
- IPV6V4_FULL = "(?x: (?&S6C){6} )"
52
- IPV6V4_LEFT = "(?x: :: (?&S6C){0,5} )" # includes "::<ipv4>" */
53
- IPV6V4_MID = "(?x: (?! (?: [[:xdigit:]]*: ){7} ) (?&S6C){1,4} (?&CS6){1,4} ) :"
54
- IPV6V4_RIGHT= "(?x: (?&S6C){1,5} : )"
55
- # IPV6: An IPv6 address (possibly with an embedded IPv4).
56
- # This macro defines both IPV4 and IPV6, since the latter one requires the former. */
57
- IP_DEF = "#{IPV4_DEF}#{S6_DEF}(?(DEFINE)(?<IPV6>(?x: (?: #{IPV6_NULL} | #{IPV6_LEFT} | #{IPV6_MID} | #{IPV6_RIGHT}" +
58
- " | #{IPV6_FULL} | (?: #{IPV6V4_FULL} | #{IPV6V4_LEFT} | #{IPV6V4_MID} | #{IPV6V4_RIGHT}" +
59
- " ) (?&IPV4) ) (?! [.:[:xdigit:]] ) )))"
60
- # Either an alphanumeric character or dash; or if [negative lookahead] not ASCII
61
- # then any graphical Unicode character.
62
- # A segment can consist entirely of numbers.
63
- # (Note: PCRE doesn't support character class subtraction/intersection.) */
64
- HOSTNAMESEGMENTCHARS_CLASS = "(?x: [-[:alnum:]] | (?! [[:ascii:]] ) [[:graph:]] )"
65
- # A hostname of at least 1 component. The last component cannot be entirely numbers.
66
- # E.g. "foo", "example.com", "1234.com", but not "foo.123" */
67
- HOSTNAME1 = "(?x: (?: #{HOSTNAMESEGMENTCHARS_CLASS}+ \\. )* " + "#{HOSTNAMESEGMENTCHARS_CLASS}* (?! [0-9] ) #{HOSTNAMESEGMENTCHARS_CLASS}+ )"
68
- # A hostname of at least 2 components. The last component cannot be entirely numbers.
69
- # E.g. "example.com", "1234.com", but not "1234.56" */
70
- HOSTNAME2 = "(?x: (?: #{HOSTNAMESEGMENTCHARS_CLASS}+ \\.)+ #{HOSTNAME1} )"
71
- # For URL: Hostname, IPv4, or bracket-enclosed IPv6, e.g. "example.com", "1.2.3.4", "[::1]" */
72
- URL_HOST = "(?x: #{HOSTNAME1} | (?&IPV4) | \\[ (?&IPV6) \\] )"
73
- # For e-mail: Hostname of at least two segments, or bracket-enclosed IPv4 or IPv6, e.g. "example.com", "[1.2.3.4]", "[::1]".
74
- # Technically an e-mail with a single-component hostname might be valid on a local network,
75
- # but let's avoid tons of false positives (e.g. in a typical shell prompt). */
76
- EMAIL_HOST = "(?x: #{HOSTNAME2} | \\[ (?: (?&IPV4) | (?&IPV6) ) \\] )"
77
- # Number between 1 and 65535, with lookahead at the end so that we don't match "6789" in the string "67890",
78
- # and in turn we don't eventually match "http://host:6789" in "http://host:67890". */
79
- N_1_65535 = "(?x: (?: [1-9][0-9]{0,3} | [1-5][0-9]{4} | 6[0-4][0-9]{3} | 65[0-4][0-9]{2} | 655[0-2][0-9] | 6553[0-5] ) (?! [0-9] ) )"
80
- # Optional colon-prefixed port, e.g. ":1080", "" */
81
- PORT = "(?x: \\:#{N_1_65535} )?"
82
- PATHCHARS_CLASS = "[-[:alnum:]\\Q_$.+!*,:;@&=?/~#|%\\E]"
83
- # Chars not to end a URL */
84
- PATHNONTERM_CLASS = "[\\Q.!,?\\E]"
85
- # Lookbehind at the end, so that the last character (if we matched a character at all) is not from PATHTERM_CLASS */
86
- URLPATH = "(?x: /#{PATHCHARS_CLASS}* (?<! #{PATHNONTERM_CLASS} ) )?"
87
- VOIP_PATH = "(?x: [;?]#{PATHCHARS_CLASS}* (?<! #{PATHNONTERM_CLASS} ) )?"
88
- # Now let's put these fragments together */
89
- DEFS = IP_DEF
90
- #REGEX_URL_AS_IS = "#{SCHEME}://#{USERPASS}#{URL_HOST}#{PORT}#{URLPATH}"
91
- REGEX_URL_AS_IS = "#{DEFS}#{SCHEME}#://#{USERPASS}#{URL_HOST}#{PORT}#{URLPATH}"
92
- # TODO: also support file:/etc/passwd */
93
- REGEX_URL_FILE = "#{DEFS}(?ix: file:/ (?: / (?: #{HOSTNAME1} )? / )? (?! / ) )(?x: #{PATHCHARS_CLASS}+ (?<! #{PATHNONTERM_CLASS} ) )?"
94
- # Lookbehind so that we don't catch "abc.www.foo.bar", bug 739757.
95
- # Lookahead for www/ftp for convenience (so that we can reuse HOSTNAME1). */
96
- REGEX_URL_HTTP = "#{DEFS}(?<!(?:#{HOSTNAMESEGMENTCHARS_CLASS}|[.]))(?=(?i:www|ftp))#{HOSTNAME1}#{PORT}#{URLPATH}"
97
- REGEX_URL_VOIP = "#{DEFS}(?i:h323:|sips?:)#{USERPASS}#{URL_HOST}#{PORT}#{VOIP_PATH}"
98
- REGEX_EMAIL = "#{DEFS}(?i:mailto:)?#{USER}@#{EMAIL_HOST}"
99
- REGEX_NEWS_MAN = "(?i:news:|man:|info:)[-[:alnum:]\\Q^_{|}~!\"#$%&'()*+,./;:=?`\\E]+"
100
- end