topinambour 1.0.6 → 1.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c91b7f16f9c3141e6876f79ce6246daf0567c8ff
4
- data.tar.gz: b0cf30204239e75195eae1a90101aad66fca0c1c
3
+ metadata.gz: 76fa93f28cb01a9f218e3f9bc87e64adf76ef14d
4
+ data.tar.gz: 834c19b5bdc2ea89740083164ef3bed96ef12c15
5
5
  SHA512:
6
- metadata.gz: 5b30bc9a61ebe66aac157a017481ca40041628623abddd15b62f9b9ba732d1340a8987a6474bf292abe2385d65d9db45302fd2bf0bfb896ea6e681d802a40b16
7
- data.tar.gz: 44ddb40ca20348587b194c7d4a36f6cf8b2f7ed971bd22a04824532388adb56b90e8448336a641c49d97f35f754042444a60d5aee2acb17b44505d8fb42ad055
6
+ metadata.gz: 49e9f72f92b495e00b42802938f22b0359a8c5f48316b50c22ad80b2abb7c4b123a908f5f8d36546fa76535d66f31b1e365c64649fa0d200247f99c8cbdf2777
7
+ data.tar.gz: 432e048bb7e5546f9e8fe3c053362fe3a0e3d3959c6b921654f6478df01b391f8d2eb0f178e0eda659ab27fa887c5df04b6d6fed3fe00c9c268883e9e8b57ba0
data/README.md CHANGED
@@ -4,7 +4,9 @@
4
4
  [![Code Climate](https://codeclimate.com/github/cedlemo/topinambour/badges/gpa.svg)](https://codeclimate.com/github/cedlemo/topinambour)
5
5
 
6
6
 
7
- <a href="https://raw.github.com/cedlemo/topinambour/master/screenshot1.png"><img src="https://raw.github.com/cedlemo/topinambour/master/screenshot1_prev.png" width="576" height="324" alt="Screenshot"></a>
7
+ <a href="https://raw.github.com/cedlemo/topinambour/master/terminal_selector_screen.gif"><img src="https://raw.github.com/cedlemo/topinambour/master/terminal_selector_screen.gif" style="width:576px;height:324px;" alt="Color selection gif"></a>
8
+
9
+ <a href="https://raw.github.com/cedlemo/topinambour/master/color_selection_screen.gif"><img src="https://raw.github.com/cedlemo/topinambour/master/color_selection_screen.gif" style="width:576px;height:324px;" alt="Color selection gif"></a>
8
10
 
9
11
  Topinambour is Terminal written with the Gtk3 and Vte3 ruby bindings from the project [ruby-gnome2](https://github.com/ruby-gnome2/ruby-gnome2). I have written it for testing purpose, but Topinambour works well and I use it as my primary terminal emulator.
10
12
 
data/bin/topinambour CHANGED
@@ -46,8 +46,8 @@ 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
50
- %w(actions style_properties css_handler application terminal notebook color_selector font_selector
49
+ #%w(actions style_properties css_handler application terminal notebook color_selector font_selector
50
+ %w(actions style_properties css_handler application terminal_regex terminal notebook color_selector font_selector
51
51
  terminal_chooser headerbar shortcuts window resize_message css_editor).each do |l|
52
52
  if File.exist?("#{USR_LIB_PATH}/#{l}.rb")
53
53
  require "#{USR_LIB_PATH}/#{l}.rb"
data/lib/actions.rb CHANGED
@@ -53,7 +53,16 @@ module TopinambourActions
53
53
 
54
54
  def self.generate_term_copy_action(application)
55
55
  action = generate_action("term_copy") do |_act, _param|
56
- application.windows[0].notebook.current.copy_clipboard
56
+ term = application.windows[0].notebook.current
57
+ event = Gtk.current_event
58
+
59
+ _match, regex_type = term.match_check_event(event)
60
+ if term.has_selection? || regex_type == -1
61
+ term.copy_clipboard
62
+ else
63
+ clipboard = Gtk::Clipboard.get_default(Gdk::Display.default)
64
+ clipboard.text = term.last_match
65
+ end
57
66
  end
58
67
  action
59
68
  end
data/lib/application.rb CHANGED
@@ -53,8 +53,6 @@ class TopinambourApplication < Gtk::Application
53
53
  end
54
54
  end
55
55
 
56
- private
57
-
58
56
  def replace_old_conf_with(new_conf)
59
57
  if File.exist?(USR_CSS)
60
58
  new_name = "#{USR_CSS}_#{Time.new.strftime('%Y-%m-%d-%H-%M-%S')}.backup"
@@ -64,8 +62,11 @@ class TopinambourApplication < Gtk::Application
64
62
  File.open(USR_CSS, "w") do |file|
65
63
  file.puts new_conf
66
64
  end
65
+ @css_content = new_conf
67
66
  end
68
67
 
68
+ private
69
+
69
70
  def load_menu_ui_in(application)
70
71
  builder = Gtk::Builder.new(:resource => "/com/github/cedlemo/topinambour/app-menu.ui")
71
72
  app_menu = builder["appmenu"]
@@ -99,18 +100,6 @@ class TopinambourApplication < Gtk::Application
99
100
  end
100
101
  end
101
102
 
102
- def css_properties
103
- @props = {}
104
- return @props if windows[0].notebook.current.class == TopinambourTerminal
105
-
106
- terminal_colors = windows[0].notebook.current.colors
107
- TERMINAL_COLOR_NAMES.each_with_index do |c, i|
108
- @props["-TopinambourTerminal-#{c}"] = terminal_colors[i].to_s
109
- end
110
- @props["-TopinambourTerminal-font"] = DEFAULT_TERMINAL_FONT
111
- @props["-TopinambourWindow-shell"] = "\'/usr/bin/fish\'"
112
- end
113
-
114
103
  def check_and_create_if_no_config_dir
115
104
  Dir.mkdir(CONFIG_DIR) unless Dir.exist?(CONFIG_DIR)
116
105
  end
data/lib/css_editor.rb CHANGED
@@ -20,7 +20,7 @@ class TopinambourCssEditor < Gtk::Grid
20
20
  super()
21
21
  @window = window
22
22
  @provider = window.application.provider
23
- @default_css = @provider.to_s
23
+ @default_css = window.application.css_content
24
24
  @modified_css = @default_css
25
25
  @tab_label = "Css Editor"
26
26
 
@@ -32,14 +32,17 @@ class TopinambourCssEditor < Gtk::Grid
32
32
  sw.add(@view)
33
33
  attach(sw, 0, 0, 3, 1)
34
34
 
35
- button = gen_reset_button
35
+ button = gen_close_button
36
36
  attach(button, 0, 1, 1, 1)
37
37
 
38
+ button = gen_reset_button
39
+ attach(button, 1, 1, 1, 1)
40
+
38
41
  @style_button = gen_style_chooser_button
39
- attach(@style_button, 1, 1, 1, 1)
42
+ attach(@style_button, 2, 1, 1, 1)
40
43
 
41
- button = gen_save_button
42
- attach(button, 2, 1, 1, 1)
44
+ button = gen_save_button(@view.buffer)
45
+ attach(button, 3, 1, 1, 1)
43
46
  manage_buffer_changes
44
47
  manage_css_errors
45
48
  show_all
@@ -64,6 +67,16 @@ class TopinambourCssEditor < Gtk::Grid
64
67
  @view.smart_backspace = true
65
68
  end
66
69
 
70
+ def gen_close_button
71
+ button = Gtk::Button.new(:label => "Close Tab")
72
+ button.signal_connect "clicked" do
73
+ toplevel.close_current_tab
74
+ end
75
+ button.vexpand = false
76
+ button.hexpand = false
77
+ button
78
+ end
79
+
67
80
  def gen_reset_button
68
81
  button = Gtk::Button.new(:label => "Reset")
69
82
  button.signal_connect "clicked" do
@@ -92,10 +105,10 @@ class TopinambourCssEditor < Gtk::Grid
92
105
  button
93
106
  end
94
107
 
95
- def gen_save_button
108
+ def gen_save_button(buffer)
96
109
  button = Gtk::Button.new(:label => "Save")
97
110
  button.signal_connect "clicked" do
98
- @window.application.update_css
111
+ @window.application.replace_old_conf_with(buffer.text)
99
112
  reload_custom_css_properties
100
113
  end
101
114
  button.vexpand = false
data/lib/notebook.rb CHANGED
@@ -22,12 +22,13 @@ class TopinambourNotebook < Gtk::Notebook
22
22
  signal_connect "hide" do
23
23
  @visible = false
24
24
  end
25
+
25
26
  signal_connect "show" do
26
27
  @visible = true
27
28
  end
28
29
 
29
30
  signal_connect "switch-page" do |_widget, next_page, next_page_num|
30
- toplevel.current_label.text = next_page.terminal_title
31
+ toplevel.current_label.text = next_page.terminal_title if next_page.class == TopinambourTerminal
31
32
  toplevel.current_tab.text = "#{next_page_num + 1}/#{n_pages}"
32
33
 
33
34
  if page >= 0 && @gen_preview
data/lib/terminal.rb CHANGED
@@ -17,7 +17,7 @@
17
17
  ##
18
18
  # The default vte terminal customized
19
19
  class TopinambourTerminal
20
- attr_reader :pid, :menu
20
+ attr_reader :pid, :menu, :regexes, :last_match
21
21
  attr_accessor :preview, :colors, :custom_title
22
22
 
23
23
  ##
@@ -48,6 +48,7 @@ class TopinambourTerminal
48
48
  signal_connect "button-press-event" do |widget, event|
49
49
  if event.type == Gdk::EventType::BUTTON_PRESS &&
50
50
  event.button == Gdk::BUTTON_SECONDARY
51
+ manage_regex_on_right_click(widget, event)
51
52
  display_copy_past_menu(widget, event)
52
53
  true
53
54
  elsif event.button == Gdk::BUTTON_PRIMARY
@@ -108,15 +109,15 @@ class TopinambourTerminal
108
109
  end
109
110
 
110
111
  def add_matches
111
- # @REGEXES = [:REGEX_URL_AS_IS, :REGEX_URL_FILE, :REGEX_URL_HTTP,
112
- # :REGEX_URL_VOIP, :REGEX_EMAIL, :REGEX_NEWS_MAN]
113
- # @REGEXES.each do |name|
114
- # regex_name = TopinambourRegex.const_get(name)
115
- # flags = [GLib::RegexCompileFlags::OPTIMIZE,
116
- # GLib::RegexCompileFlags::MULTILINE]
117
- # regex = GLib::Regex.new(regex_name, :compile_options => flags)
118
- # match_add_gregex(regex, 0)
119
- # end
112
+ @regexes = [:REGEX_URL_AS_IS, :REGEX_URL_FILE, :REGEX_URL_HTTP,
113
+ :REGEX_URL_VOIP, :REGEX_EMAIL, :REGEX_NEWS_MAN]
114
+ @regexes.each do |name|
115
+ regex_name = TopinambourRegex.const_get(name)
116
+ flags = [GLib::RegexCompileFlags::OPTIMIZE,
117
+ GLib::RegexCompileFlags::MULTILINE]
118
+ regex = GLib::Regex.new(regex_name, :compile_options => flags)
119
+ match_add_gregex(regex, 0)
120
+ end
120
121
  end
121
122
 
122
123
  def display_copy_past_menu(widget, event)
@@ -130,8 +131,26 @@ class TopinambourTerminal
130
131
  widget.menu.show
131
132
  end
132
133
 
134
+ def manage_regex_on_right_click(_widget, event)
135
+ @last_match, _regex_type = match_check_event(event)
136
+ end
137
+
133
138
  def manage_regex_on_click(_widget, event)
134
- _match, _regex_type = match_check_event(event)
139
+ match, regex_type = match_check_event(event)
140
+ return nil if regex_type == -1
141
+ modified_match = case @regexes[regex_type]
142
+ when :REGEX_EMAIL
143
+ "mailto:" + match
144
+ when :REGEX_URL_HTTP
145
+ "http://" + match
146
+ else
147
+ match
148
+ end
149
+ begin
150
+ Gio::AppInfo.launch_default_for_uri(modified_match)
151
+ rescue => e
152
+ puts "error : #{e.message}\n\tfor match: #{match} of type :#{@regexes[regex_type]}"
153
+ end
135
154
  end
136
155
 
137
156
  def when_terminal_title_change
data/lib/window.rb CHANGED
@@ -19,7 +19,7 @@ class TopinambourWindow
19
19
 
20
20
  def initialize(application)
21
21
  super(:application => application)
22
- set_icon_from_file("#{DATA_PATH}/topinambour-icon.png")
22
+ set_icon_name("utilities-terminal-symbolic")
23
23
  load_css_properties
24
24
  set_position(:center)
25
25
  create_header_bar
@@ -114,9 +114,9 @@ class TopinambourWindow
114
114
  "comments" => "Terminal Emulator based on the ruby bindings of Gtk3 and Vte3",
115
115
  "copyright" => "Copyright (C) 2015-2016 Cédric Le Moigne",
116
116
  "license" => "This program is licenced under the licence GPL-3.0 and later.",
117
- "logo" => Gdk::Pixbuf.new("#{DATA_PATH}/topinambour-icon-128.png"),
117
+ "logo_icon_name" => "utilities-terminal-symbolic",
118
118
  "program_name" => "Topinambour",
119
- "version" => "1.2.3",
119
+ "version" => "1.0.7",
120
120
  "website" => "https://github.com/cedlemo/topinambour",
121
121
  "website_label" => "Topinambour github repository"
122
122
  )
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.6
4
+ version: 1.0.7
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-28 00:00:00.000000000 Z
11
+ date: 2016-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vte3
@@ -90,11 +90,6 @@ files:
90
90
  - data/pan-start-symbolic.svg
91
91
  - data/tab-new-symbolic.svg
92
92
  - data/terminal-menu.ui
93
- - data/topinambour-icon-128.png
94
- - data/topinambour-icon-16.png
95
- - data/topinambour-icon-32.png
96
- - data/topinambour-icon-64.png
97
- - data/topinambour-icon.png
98
93
  - data/topinambour.css
99
94
  - data/topinambour.gresource.xml
100
95
  - data/window-close-symbolic.svg
Binary file
Binary file
Binary file
Binary file
Binary file