topinambour 2.0.4 → 2.0.6

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
  SHA256:
3
- metadata.gz: '0691d6722ae037b1a62082537bbab8c33ff8cd37ab8539a8e8bc4b79476bab5e'
4
- data.tar.gz: 64940e7dcddc3316cb25d0e61d56631b068daff15b41485736ed3d5e873833ec
3
+ metadata.gz: c051e0f90536143f79f773b54aaf57a26f7e547273a7df6c47969d46f20f7c95
4
+ data.tar.gz: ae1f7425d773901cfbc676e74a62f65e3a24073f3e944391fc9b07e0383b956c
5
5
  SHA512:
6
- metadata.gz: 0bb15b54d2064783f90b90103373340bc4ad4116ed6dc79ef59c75e5a0655ba0ecce9946f0e18b6718f41376a42f8a002b9c9db81ad3b8557280f4c921b69a2e
7
- data.tar.gz: 1eb0653f29eebe9f6e80cda523d38596572c94b0e83239889c5ae19513fde6fa1c403dfcc0dd2beeaea2df28f445b642e7c4275055c0c15cd02862c95aedc5e9
6
+ metadata.gz: 8487cfb2100b779913d4cc1e735c1adb88b120a2f98040f22996ba22762c932a956bc1aa013a53365faf5edd0f7931d7c316ce1415f9e621d50cc3beacb6fc03
7
+ data.tar.gz: b6f1ccc359cf0ae366f44ad4460a9052fc8efe86810b518ee8a5fc35a5695a0f9a6a6ab96bd31b31b869c609e0b0c8539f867d9a91137700b2e22dcf2a277166
data/bin/topinambour CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright 2015-2017 Cedric LE MOIGNE, cedlemo@gmx.com
2
+ # Copyright 2015-2018 Cedric LE MOIGNE, cedlemo@gmx.com
3
3
  # This file is part of Topinambour.
4
4
  #
5
5
  # Topinambour is free software: you can redistribute it and/or modify
@@ -19,39 +19,37 @@
19
19
  # vte 3 bindings.
20
20
  # Author:: Cedlemo (mailto:cedlemo@gmx.com)
21
21
 
22
- require "vte3"
23
- require "fileutils"
22
+ require 'vte3'
23
+ require 'fileutils'
24
24
 
25
- Signal.trap("INT") {
26
- STDERR.puts "\tTopinambour processus pid = #{Process.pid} has been interrupted with Ctrl-C"
25
+ err_msg = "\tTopinambour processus pid = #{Process.pid} has been "
26
+
27
+ Signal.trap('INT') do
28
+ STDERR.puts err_msg + 'interrupted with Ctrl-C'
27
29
  exit
28
- }
30
+ end
29
31
 
30
- Signal.trap("TERM") {
31
- STDERR.puts "\tTopinambour processus pid = #{Process.pid} has been killed"
32
+ Signal.trap('TERM') do
33
+ STDERR.puts err_msg + 'has been killed'
32
34
  exit
33
- }
35
+ end
34
36
 
35
- CURRENT_PATH = File.expand_path(File.dirname(__FILE__))
36
- LIB_PATH = "#{CURRENT_PATH}/../lib"
37
- DATA_PATH = "#{CURRENT_PATH}/../data"
37
+ CURRENT_PATH = __dir__
38
+ LIB_PATH = "#{CURRENT_PATH}/../lib".freeze
39
+ DATA_PATH = "#{CURRENT_PATH}/../data".freeze
38
40
  CONFIG_DIR = File.expand_path("#{ENV['HOME']}/.config/topinambour")
39
- USR_CSS = "#{CONFIG_DIR}/topinambour.css"
40
- USR_LIB_PATH = "#{CONFIG_DIR}/lib"
41
+ DATA_HOME_DIR = File.expand_path("#{ENV['HOME']}/.local/share/topinambour")
42
+ USR_CSS = "#{CONFIG_DIR}/topinambour.css".freeze
43
+ USR_LIB_PATH = "#{CONFIG_DIR}/lib".freeze
41
44
  gresource_bin = "#{DATA_PATH}/topinambour.gresource"
42
-
43
45
  resource = Gio::Resource.load(gresource_bin)
44
46
  Gio::Resources.register(resource)
45
- # Load default libraries !!WARNING!! loading order matters
46
47
 
47
- %w(actions application rgb_names_regexes
48
- terminal_regex terminal color_selector font_selector
49
- shortcuts window preferences).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"
54
- end
48
+ # Load default libraries !!WARNING!! loading order matters
49
+ %w[version about actions application rgb_names_regexes
50
+ terminal_regex terminal color_selector font_selector
51
+ shortcuts window preferences].each do |l|
52
+ require "#{LIB_PATH}/#{l}.rb"
55
53
  end
56
54
 
57
55
  topinambour = TopinambourApplication.new
Binary file
data/data/prefs-dialog.ui CHANGED
@@ -3,14 +3,14 @@
3
3
  <interface>
4
4
  <requires lib="gtk+" version="3.20"/>
5
5
  <object class="GtkAdjustment" id="width_adjustment">
6
- <property name="upper">2000</property>
7
- <property name="step_increment">5</property>
8
- <property name="page_increment">10</property>
6
+ <property name="upper">500</property>
7
+ <property name="step_increment">1</property>
8
+ <property name="page_increment">1</property>
9
9
  </object>
10
10
  <object class="GtkAdjustment" id="height_adjustment">
11
- <property name="upper">2000</property>
12
- <property name="step_increment">5</property>
13
- <property name="page_increment">10</property>
11
+ <property name="upper">500</property>
12
+ <property name="step_increment">1</property>
13
+ <property name="page_increment">1</property>
14
14
  </object>
15
15
  <template class="TopinambourPreferences" parent="GtkWindow">
16
16
  <property name="can_focus">False</property>
data/data/topinambour.css CHANGED
@@ -1,73 +1,34 @@
1
1
  *{
2
- /* Default css properties
3
- -TopinambourTerminal-foreground: #aeafad;
4
- -TopinambourTerminal-background: #323232;
5
- -TopinambourTerminal-black: #000000;
6
- -TopinambourTerminal-red: #b9214f;
7
- -TopinambourTerminal-green: #A6E22E;
8
- -TopinambourTerminal-yellow: #ff9800;
9
- -TopinambourTerminal-blue: #3399ff;
10
- -TopinambourTerminal-magenta: #8e33ff;
11
- -TopinambourTerminal-cyan: #06a2dc;
12
- -TopinambourTerminal-white: #B0B0B0;
13
- -TopinambourTerminal-brightblack: #5D5D5D;
14
- -TopinambourTerminal-brightred: #ff5c8d;
15
- -TopinambourTerminal-brightgreen: #CDEE69;
16
- -TopinambourTerminal-brightyellow: #ffff00;
17
- -TopinambourTerminal-brightblue: #9CD9F0;
18
- -TopinambourTerminal-brightmagenta: #FBB1F9;
19
- -TopinambourTerminal-brightcyan: #77DFD8;
20
- -TopinambourTerminal-brightwhite: #F7F7F7;
21
- -TopinambourTerminal-font: Monospace 11;
22
- -TopinambourWindow-shell: "/usr/bin/fish";
23
- -TopinambourWindow-css-editor-style: "monokai-extended";
24
- -TopinambourWindow-height: 500;
25
- -TopinambourWindow-width: 1000;*/
26
2
  }
27
3
 
28
- #topinambour-overview-box {
29
- background-color: rgba(43,45,54,0.95);
30
- border-radius: 6px 0px 0px 6px;
4
+ #topinambour-window {
5
+ background-color: rgba(0,0,0,0);
31
6
  }
32
7
 
33
8
  #topinambour-headerbar {
34
- background-color: #323232;
9
+ background-color: #282828;
35
10
  border: none;
36
11
  box-shadow: none;
37
12
  }
38
-
39
13
  #topinambour-headerbar:backdrop {
40
14
  background-color: rgba(50,50,50,0.7);
41
15
  border: none;
42
16
  box-shadow: none;
43
17
  }
44
18
 
45
- #topinambour-scrollbar{
19
+ #topinambour-scrollbar {
46
20
  background-color: rgba(0,0,0,0);
47
21
  border: none;
48
22
  }
49
-
50
23
  #topinambour-scrollbar trough{
51
24
  background-color: rgba(0,0,0,0);
52
25
  border: none;
53
26
  }
54
-
55
27
  #topinambour-scrollbar slider{
56
- margin-left: 8px;
57
- background-color: rgba(49,150,188,0.5);
58
- }
59
-
60
- #topinambour-tab-term {
61
- background-color: rgba(0,0,0,0);
62
- }
63
-
64
- grid button image {
65
- border: solid 3px rgba(0, 0, 0, 0.0);
66
28
  margin: 0px;
67
- padding: 0px;
29
+ background-color: rgba(255,255,255,0.1);
68
30
  }
69
31
 
70
- grid button {
71
- margin: 0px;
72
- padding: 0px;
32
+ #topinambour-term-box {
33
+ background-color: #282828;
73
34
  }
Binary file
@@ -1,7 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <gresources>
3
3
  <gresource prefix="/com/github/cedlemo/topinambour">
4
- <file preprocess="xml-stripblanks">window.ui</file>
5
4
  <file preprocess="xml-stripblanks">app-menu.ui</file>
6
5
  <file preprocess="xml-stripblanks">window-menu.ui</file>
7
6
  <file preprocess="xml-stripblanks">terminal-menu.ui</file>
@@ -25,12 +25,12 @@
25
25
  <summary>Font of the terminal.</summary>
26
26
  </key>
27
27
  <key name="width" type="i">
28
- <range min="1" max="2000"/>
29
- <default>800</default>
28
+ <range min="1" max="500"/>
29
+ <default>80</default>
30
30
  </key>
31
31
  <key name="height" type="i">
32
- <range min="1" max="2000"/>
33
- <default>500</default>
32
+ <range min="1" max="500"/>
33
+ <default>20</default>
34
34
  </key>
35
35
  <key name="custom-css" type="b">
36
36
  <default>false</default>
data/lib/about.rb ADDED
@@ -0,0 +1,46 @@
1
+ # Copyright 2018 Cedric 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
+ require "#{__dir__}/version"
18
+ ## About stores metainformation about Topinambour.
19
+ module About
20
+ AUTHORS = ["Cedric Le Moigne <cedlemo@gmx.com>"].freeze
21
+ SUMMARY = "Vte3 Terminal emulator in ruby.".freeze
22
+ COMMENTS =
23
+ "Terminal Emulator based on the ruby bindings of Gtk3 and Vte3".freeze
24
+ COPYRIGHT = "Copyright (C) 2015-2018 Cedric Le Moigne".freeze
25
+ LICENSE = "GPL-3.0".freeze
26
+ LICENSE_COMMENTS =
27
+ "This program is licenced under the licence GPL-3.0 and later.".freeze
28
+ LOGO_ICON_NAME = "utilities-terminal-symbolic".freeze
29
+ PROGRAM_NAME = "topinambour".freeze
30
+ VERSION = Version::STRING
31
+ WEBSITE = "https://github.com/cedlemo/topinambour".freeze
32
+ WEBSITE_LABEL = "Topinambour github repository".freeze
33
+
34
+ def self.dialog(parent)
35
+ Gtk::AboutDialog.show(parent,
36
+ "authors" => AUTHORS,
37
+ "comments" => COMMENTS,
38
+ "copyright" => COPYRIGHT,
39
+ "license" => LICENSE,
40
+ "logo_icon_name" => LOGO_ICON_NAME,
41
+ "program_name" => PROGRAM_NAME,
42
+ "version" => VERSION,
43
+ "website" => WEBSITE,
44
+ "website_label" => WEBSITE_LABEL)
45
+ end
46
+ end
data/lib/actions.rb CHANGED
@@ -14,6 +14,8 @@
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
+ # Those are all the actions that can be called via the interface with
18
+ # the label 'app.my_action' for a method my_action.
17
19
  module TopinambourActions
18
20
  def self.generate_action(name)
19
21
  action = Gio::SimpleAction.new(name)
data/lib/application.rb CHANGED
@@ -14,41 +14,51 @@
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
- require "optparse"
17
+ require 'optparse'
18
+ require 'fileutils'
18
19
 
20
+ ## Gtk::Application class for topinambour
21
+ #
19
22
  class TopinambourApplication < Gtk::Application
20
23
  attr_accessor :settings
21
24
  def initialize
22
25
  @options = {}
23
26
  @exit_status = 0
27
+ @app_id = 'com.github.cedlemo.topinambour'
28
+ @app_path = '/com/github/cedlemo/topinambour'
24
29
 
25
- super("com.github.cedlemo.topinambour", [:non_unique,:handles_command_line])
30
+ super(@app_id, %i[non_unique handles_command_line])
26
31
 
27
- signal_connect "startup" do |application|
28
- ENV["GSETTINGS_SCHEMA_DIR"] = DATA_PATH
29
- @settings = Gio::Settings.new("com.github.cedlemo.topinambour")
30
- initialize_css_provider
31
- load_css_config
32
+ signal_connect 'startup' do |application|
33
+ GLib.set_application_name('topinambout')
34
+ GLib.set_prgname('topinambour')
35
+ parent_schema = Gio::SettingsSchemaSource.default
36
+ schema_source =
37
+ Gio::SettingsSchemaSource.new(DATA_PATH, parent_schema, true)
38
+ schema = schema_source.lookup(@app_id, true)
39
+ @settings = Gio::Settings.new(schema: schema,
40
+ path: @app_path + '/preferences/')
32
41
 
33
42
  TopinambourActions.add_actions_to(application)
34
- load_menu_ui_in(application)
43
+ initialize_css_provider
44
+ create_xdg_dirs
45
+ load_css_config
46
+ load_menu_ui(application)
35
47
  end
36
48
 
37
- signal_connect "activate" do |application|
38
-
49
+ signal_connect 'activate' do |application|
39
50
  window = TopinambourWindow.new(application)
40
- window.present
41
51
 
42
52
  if @options[:execute]
43
53
  window.add_terminal(@options[:execute])
44
54
  else
45
55
  window.add_terminal
46
56
  end
47
- window.terminal.grab_focus
57
+ window.show_all
58
+ window.present
48
59
  end
49
60
 
50
-
51
- signal_connect "command-line" do |_application, command_line|
61
+ signal_connect 'command-line' do |_application, command_line|
52
62
  begin
53
63
  parse_command_line(command_line.arguments)
54
64
  rescue SystemExit => error
@@ -68,42 +78,41 @@ class TopinambourApplication < Gtk::Application
68
78
  end
69
79
 
70
80
  def reload_css_config
71
- error_popup = nil
72
81
  bad_css = nil
73
82
  css_file = check_css_file_path
74
- if css_file
75
- @provider.signal_connect "parsing-error" do |css_provider, section, error|
76
- buf = Gtk::TextBuffer.new
77
- buf.text = @css_content
78
- start_i = buf.get_iter_at(:line => section.start_line,
79
- :index => section.start_position)
80
- end_i = buf.get_iter_at(:line => section.start_line + 10,
81
- :index => section.end_position)
82
- bad_css = ""
83
- buf.get_text(start_i, end_i, true).lines.each_with_index do |line, i|
84
- bad_css += "#{section.start_line + 1 + i} #{line}"
85
- end
83
+ return unless css_file
84
+
85
+ @provider.signal_connect 'parsing-error' do |_css_prov, section, _error|
86
+ buf = Gtk::TextBuffer.new
87
+ buf.text = @css_content
88
+ start_i = buf.get_iter_at(line: section.start_line,
89
+ index: section.start_position)
90
+ end_i = buf.get_iter_at(line: section.start_line + 10,
91
+ index: section.end_position)
92
+ bad_css = ''
93
+ buf.get_text(start_i, end_i, true).lines.each_with_index do |line, i|
94
+ bad_css += "#{section.start_line + 1 + i} #{line}"
86
95
  end
96
+ end
87
97
 
88
- begin
89
- load_custom_css(css_file)
90
- rescue => e
91
- self.windows.first.exit_overlay_mode
92
- # TODO : deal with the preferences window which is a transient one
93
- # that keeps the focus even when the popup shows up.
94
- error_popup = TopinambourCssErrorPopup.new(self.windows.first)
95
- error_popup.transient_for = self.windows.first
96
- error_popup.message = e.message + "\n\n" + bad_css
97
- error_popup.show_all
98
- end
98
+ begin
99
+ load_custom_css(css_file)
100
+ rescue => e
101
+ windows.first.exit_overlay_mode
102
+ # TODO : deal with the preferences window which is a transient one
103
+ # that keeps the focus even when the popup shows up.
104
+ error_popup = TopinambourCssErrorPopup.new(windows.first)
105
+ error_popup.transient_for = windows.first
106
+ error_popup.message = e.message + "\n\n" + bad_css
107
+ error_popup.show_all
99
108
  end
100
109
  end
101
110
 
102
111
  def check_css_file_path
103
- css_file = if File.exist?(@settings["css-file"])
104
- @settings["css-file"]
112
+ css_file = if File.exist?(@settings['css-file'])
113
+ @settings['css-file']
105
114
  else
106
- "#{CONFIG_DIR}/#{@settings["css-file"]}"
115
+ "#{CONFIG_DIR}/#{@settings['css-file']}"
107
116
  end
108
117
  File.exist?(css_file) ? css_file : nil
109
118
  end
@@ -112,12 +121,22 @@ class TopinambourApplication < Gtk::Application
112
121
 
113
122
  def parse_command_line(arguments)
114
123
  parser = OptionParser.new
115
- parser.on("-e", "--execute COMMAND", String, "Run a command") do |cmd|
124
+ parser.on('-e', '--execute COMMAND', String, 'Run a command') do |cmd|
116
125
  @options[:execute] = cmd
117
126
  end
118
127
  parser.parse(arguments)
119
128
  end
120
129
 
130
+ def load_menu_ui(application)
131
+ builder = Gtk::Builder.new(resource: @app_path + '/app-menu.ui')
132
+ app_menu = builder['appmenu']
133
+ application.app_menu = app_menu
134
+ end
135
+
136
+ #########################
137
+ # CSS related functions #
138
+ #########################
139
+
121
140
  def initialize_css_provider
122
141
  screen = Gdk::Display.default.default_screen
123
142
  @provider = Gtk::CssProvider.new
@@ -126,61 +145,39 @@ class TopinambourApplication < Gtk::Application
126
145
  Gtk::StyleProvider::PRIORITY_USER)
127
146
  end
128
147
 
129
- def load_menu_ui_in(application)
130
- builder = Gtk::Builder.new(:resource => "/com/github/cedlemo/topinambour/app-menu.ui")
131
- app_menu = builder["appmenu"]
132
- application.app_menu = app_menu
133
- end
134
-
135
- def load_custom_css(file)
136
- if @settings["custom-css"]
137
- @css_content = File.open(file, "r").read
138
- @provider.load(:data => @css_content)
139
- else
140
- @provider.load(:data => "")
141
- end
142
- end
143
-
144
148
  def load_css_config
145
- return unless @settings["custom-css"]
146
- css_file = check_css_file_path
147
- if css_file
149
+ return unless @settings['custom-css']
150
+ if (css_file = check_css_file_path)
148
151
  begin
149
152
  load_custom_css(css_file)
150
153
  rescue => e
151
- puts "Bad css file using default css #{e.message}"
152
- error_popup = TopinambourCssErrorPopup.new(self.windows.first)
154
+ error_popup = TopinambourCssErrorPopup.new(windows.first)
153
155
  error_popup.message = e.message + "\n\nBad css file using default css"
154
156
  error_popup.show_all
155
157
  end
156
158
  else
157
- puts "No custom CSS, using default theme"
159
+ puts 'No custom CSS, using default theme'
158
160
  end
159
161
  end
160
162
 
161
- def check_and_create_if_no_config_dir
162
- Dir.mkdir(CONFIG_DIR) unless Dir.exist?(CONFIG_DIR)
163
- end
164
- end
165
-
166
- class TopinambourCssErrorPopup < Gtk::MessageDialog
167
-
168
- def initialize(parent)
169
- super(:parent => parent, :flags => 0,
170
- :type => Gtk::MessageType::ERROR,
171
- :buttons_type => Gtk::ButtonsType::CLOSE,
172
- :message => "Css Error")
173
-
174
- @message = Gtk::Label.new("")
175
- content_area.add(@message)
176
- signal_connect("response") { |widget| widget.destroy }
163
+ def load_custom_css(file)
164
+ if @settings['custom-css']
165
+ @css_content = File.open(file, 'r').read
166
+ @provider.load(data: @css_content)
167
+ else
168
+ @provider.load(data: '')
169
+ end
177
170
  end
178
171
 
179
- def message=(message)
180
- @message.text = message
172
+ #########################
173
+ # Misc #
174
+ #########################
175
+ def create_xdg_dirs
176
+ create_dir_if_absent(CONFIG_DIR)
177
+ create_dir_if_absent(DATA_HOME_DIR)
181
178
  end
182
179
 
183
- def message
184
- @message.text
180
+ def create_dir_if_absent(path)
181
+ FileUtils.mkdir_p path unless File.exist?(path)
185
182
  end
186
183
  end