Merge lp:~sj26/terminator/gtk3-dark-setting into lp:terminator/gtk3

Proposed by Samuel Cochran
Status: Needs review
Proposed branch: lp:~sj26/terminator/gtk3-dark-setting
Merge into: lp:terminator/gtk3
Diff against target: 153 lines (+38/-9)
4 files modified
terminatorlib/config.py (+1/-0)
terminatorlib/preferences.glade (+25/-8)
terminatorlib/prefseditor.py (+8/-0)
terminatorlib/terminator.py (+4/-1)
To merge this branch: bzr merge lp:~sj26/terminator/gtk3-dark-setting
Reviewer Review Type Date Requested Status
Terminator Pending
Review via email: mp+319665@code.launchpad.net

Description of the change

Add dark theme setting for Terminator running under GTK3 similar to GNOME Terminal.

I love the ability to switch GNOME Terminal into the theme's Dark variant mode. Turns out it's just a gtk settings property which can be toggle pretty easily:

https://git.gnome.org/browse/gnome-terminal/tree/src/terminal-app.c#n317

This branch adds a new checkbox to the preference panel under Appearance for "Dark Theme" which defaults to false.

Here are some screenshots:

http://imgur.com/gallery/gbWwW

To post a comment you must log in.

Unmerged revisions

1757. By Samuel Cochran

Dark theme setting

Add a dark theme setting equivalent to GNOME Terminal.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'terminatorlib/config.py'
2--- terminatorlib/config.py 2017-02-01 09:03:29 +0000
3+++ terminatorlib/config.py 2017-03-13 04:58:05 +0000
4@@ -89,6 +89,7 @@
5 'geometry_hinting' : False,
6 'window_state' : 'normal',
7 'borderless' : False,
8+ 'dark_theme' : True,
9 'extra_styling' : True,
10 'tab_position' : 'top',
11 'broadcast_default' : 'group',
12
13=== modified file 'terminatorlib/preferences.glade'
14--- terminatorlib/preferences.glade 2016-12-13 21:08:02 +0000
15+++ terminatorlib/preferences.glade 2017-03-13 04:58:05 +0000
16@@ -818,7 +818,7 @@
17 </object>
18 <packing>
19 <property name="left_attach">0</property>
20- <property name="top_attach">3</property>
21+ <property name="top_attach">4</property>
22 <property name="width">3</property>
23 </packing>
24 </child>
25@@ -831,7 +831,7 @@
26 </object>
27 <packing>
28 <property name="left_attach">0</property>
29- <property name="top_attach">2</property>
30+ <property name="top_attach">3</property>
31 </packing>
32 </child>
33 <child>
34@@ -843,7 +843,7 @@
35 </object>
36 <packing>
37 <property name="left_attach">0</property>
38- <property name="top_attach">1</property>
39+ <property name="top_attach">2</property>
40 </packing>
41 </child>
42 <child>
43@@ -862,7 +862,7 @@
44 </object>
45 <packing>
46 <property name="left_attach">2</property>
47- <property name="top_attach">1</property>
48+ <property name="top_attach">2</property>
49 </packing>
50 </child>
51 <child>
52@@ -881,7 +881,7 @@
53 </object>
54 <packing>
55 <property name="left_attach">2</property>
56- <property name="top_attach">2</property>
57+ <property name="top_attach">3</property>
58 </packing>
59 </child>
60 <child>
61@@ -897,7 +897,7 @@
62 </object>
63 <packing>
64 <property name="left_attach">1</property>
65- <property name="top_attach">1</property>
66+ <property name="top_attach">2</property>
67 </packing>
68 </child>
69 <child>
70@@ -913,7 +913,24 @@
71 </object>
72 <packing>
73 <property name="left_attach">1</property>
74- <property name="top_attach">2</property>
75+ <property name="top_attach">3</property>
76+ </packing>
77+ </child>
78+ <child>
79+ <object class="GtkCheckButton" id="darkthemecheck">
80+ <property name="label" translatable="yes">Dark Theme</property>
81+ <property name="use_action_appearance">False</property>
82+ <property name="visible">True</property>
83+ <property name="can_focus">True</property>
84+ <property name="receives_default">False</property>
85+ <property name="xalign">0</property>
86+ <property name="draw_indicator">True</property>
87+ <signal name="toggled" handler="on_darkthemecheck_toggled" swapped="no"/>
88+ </object>
89+ <packing>
90+ <property name="left_attach">0</property>
91+ <property name="top_attach">0</property>
92+ <property name="width">3</property>
93 </packing>
94 </child>
95 <child>
96@@ -930,7 +947,7 @@
97 </object>
98 <packing>
99 <property name="left_attach">0</property>
100- <property name="top_attach">0</property>
101+ <property name="top_attach">1</property>
102 <property name="width">3</property>
103 </packing>
104 </child>
105
106=== modified file 'terminatorlib/prefseditor.py'
107--- terminatorlib/prefseditor.py 2017-02-19 15:57:36 +0000
108+++ terminatorlib/prefseditor.py 2017-03-13 04:58:05 +0000
109@@ -254,6 +254,9 @@
110 # Window borders
111 widget = guiget('winbordercheck')
112 widget.set_active(not self.config['borderless'])
113+ # Dark theme
114+ widget = guiget('darkthemecheck')
115+ widget.set_active(self.config['dark_theme'])
116 # Extra styling
117 widget = guiget('extrastylingcheck')
118 widget.set_active(self.config['extra_styling'])
119@@ -695,6 +698,11 @@
120 self.config['borderless'] = not widget.get_active()
121 self.config.save()
122
123+ def on_darkthemecheck_toggled(self, widget):
124+ """Dark theme setting changed"""
125+ self.config['dark_theme'] = widget.get_active()
126+ self.config.save()
127+
128 def on_extrastylingcheck_toggled(self, widget):
129 """Extra styling setting changed"""
130 self.config['extra_styling'] = widget.get_active()
131
132=== modified file 'terminatorlib/terminator.py'
133--- terminatorlib/terminator.py 2017-02-28 19:48:11 +0000
134+++ terminatorlib/terminator.py 2017-03-13 04:58:05 +0000
135@@ -101,7 +101,7 @@
136
137 def connect_signals(self):
138 """Connect all the gtk signals"""
139- self.gtk_settings=Gtk.Settings().get_default()
140+ self.gtk_settings = Gtk.Settings().get_default()
141 self.gtk_settings.connect('notify::gtk-theme-name', self.on_gtk_theme_name_notify)
142 self.cur_gtk_theme_name = self.gtk_settings.get_property('gtk-theme-name')
143
144@@ -509,6 +509,9 @@
145 (head, _tail) = os.path.split(borg.__file__)
146 app_theme_dir = os.path.join(head, 'themes')
147
148+ # Respect request for dark theme variant, if possible
149+ self.gtk_settings.set_property('gtk-application-prefer-dark-theme', self.config['dark_theme'])
150+
151 theme_name = self.gtk_settings.get_property('gtk-theme-name')
152
153 theme_part_list = ['terminator.css']

Subscribers

People subscribed via source and target branches

to status/vote changes: