@@ -10,6 +10,7 @@ const { Settings } = imports.gi.Gio;
10
10
11
11
import * as settings from 'settings' ;
12
12
import * as log from 'log' ;
13
+ import * as focus from 'focus' ;
13
14
14
15
interface AppWidgets {
15
16
fullscreen_launcher : any ,
@@ -20,6 +21,8 @@ interface AppWidgets {
20
21
smart_gaps : any ,
21
22
snap_to_grid : any ,
22
23
window_titles : any ,
24
+ mouse_cursor_focus_position : any ,
25
+ log_level : any ,
23
26
}
24
27
25
28
// @ts -ignore
@@ -66,6 +69,12 @@ function settings_dialog_new(): Gtk.Container {
66
69
}
67
70
} ) ;
68
71
72
+ app . log_level . set_active ( ext . log_level ( ) ) ;
73
+ app . log_level . connect ( "changed" , ( ) => {
74
+ let active_id = app . log_level . get_active_id ( ) ;
75
+ ext . set_log_level ( active_id ) ;
76
+ } ) ;
77
+
69
78
app . show_skip_taskbar . set_active ( ext . show_skiptaskbar ( ) ) ;
70
79
app . show_skip_taskbar . connect ( 'state-set' , ( _widget : any , state : boolean ) => {
71
80
ext . set_show_skiptaskbar ( state ) ;
@@ -78,6 +87,12 @@ function settings_dialog_new(): Gtk.Container {
78
87
Settings . sync ( ) ;
79
88
} ) ;
80
89
90
+ app . mouse_cursor_focus_position . set_active ( ext . mouse_cursor_focus_location ( ) ) ;
91
+ app . mouse_cursor_focus_position . connect ( "changed" , ( ) => {
92
+ let active_id = app . mouse_cursor_focus_position . get_active_id ( ) ;
93
+ ext . set_mouse_cursor_focus_location ( active_id ) ;
94
+ } ) ;
95
+
81
96
app . fullscreen_launcher . set_active ( ext . fullscreen_launcher ( ) )
82
97
app . fullscreen_launcher . connect ( 'state-set' , ( _widget : any , state : boolean ) => {
83
98
ext . set_fullscreen_launcher ( state )
@@ -128,7 +143,7 @@ function settings_dialog_view(): [AppWidgets, Gtk.Container] {
128
143
xalign : 0.0
129
144
} )
130
145
131
- const [ inner_gap , outer_gap ] = gaps_section ( grid , 7 ) ;
146
+ const [ inner_gap , outer_gap ] = gaps_section ( grid , 8 ) ;
132
147
133
148
const settings = {
134
149
inner_gap,
@@ -138,7 +153,19 @@ function settings_dialog_view(): [AppWidgets, Gtk.Container] {
138
153
snap_to_grid : new Gtk . Switch ( { halign : Gtk . Align . END } ) ,
139
154
window_titles : new Gtk . Switch ( { halign : Gtk . Align . END } ) ,
140
155
show_skip_taskbar : new Gtk . Switch ( { halign : Gtk . Align . END } ) ,
141
- mouse_cursor_follows_active_window : new Gtk . Switch ( { halign : Gtk . Align . END } )
156
+ mouse_cursor_follows_active_window : new Gtk . Switch ( { halign : Gtk . Align . END } ) ,
157
+ mouse_cursor_focus_position : build_combo (
158
+ grid ,
159
+ 6 ,
160
+ focus . FocusPosition ,
161
+ 'Mouse Cursor Focus Position' ,
162
+ ) ,
163
+ log_level : build_combo (
164
+ grid ,
165
+ 7 ,
166
+ log . LOG_LEVELS ,
167
+ 'Log Level' ,
168
+ )
142
169
}
143
170
144
171
grid . attach ( win_label , 0 , 0 , 1 , 1 )
@@ -159,8 +186,6 @@ function settings_dialog_view(): [AppWidgets, Gtk.Container] {
159
186
grid . attach ( mouse_cursor_follows_active_window_label , 0 , 5 , 1 , 1 )
160
187
grid . attach ( settings . mouse_cursor_follows_active_window , 1 , 5 , 1 , 1 )
161
188
162
- logging_combo ( grid , 6 )
163
-
164
189
return [ settings , grid ]
165
190
}
166
191
@@ -199,35 +224,29 @@ function number_entry(): Gtk.Widget {
199
224
return new Gtk . Entry ( { input_purpose : Gtk . InputPurpose . NUMBER } ) ;
200
225
}
201
226
202
- function logging_combo ( grid : any , top_index : number ) {
203
- let log_label = new Gtk . Label ( {
204
- label : `Log Level` ,
227
+ function build_combo (
228
+ grid : any ,
229
+ top_index : number ,
230
+ iter_enum : any ,
231
+ label : string ,
232
+ ) {
233
+ let label_ = new Gtk . Label ( {
234
+ label : label ,
205
235
halign : Gtk . Align . START
206
236
} ) ;
207
237
208
- grid . attach ( log_label , 0 , top_index , 1 , 1 ) ;
238
+ grid . attach ( label_ , 0 , top_index , 1 , 1 ) ;
209
239
210
- let log_combo = new Gtk . ComboBoxText ( ) ;
240
+ let combo = new Gtk . ComboBoxText ( ) ;
211
241
212
- for ( const key in log . LOG_LEVELS ) {
213
- // since log level loop will contain key and level,
214
- // then cherry-pick the number, key will be the text value
215
- if ( typeof log . LOG_LEVELS [ key ] === 'number' ) {
216
- log_combo . append ( `${ log . LOG_LEVELS [ key ] } ` , key ) ;
242
+ for ( const [ index , key ] of Object . keys ( iter_enum ) . entries ( ) ) {
243
+ if ( typeof iter_enum [ key ] == 'string' ) {
244
+ combo . append ( `${ index } ` , iter_enum [ key ] ) ;
217
245
}
218
246
}
219
247
220
- let current_log_level = log . log_level ( ) ;
221
-
222
- log_combo . set_active_id ( `${ current_log_level } ` ) ;
223
- log_combo . connect ( "changed" , ( ) => {
224
- let activeId = log_combo . get_active_id ( ) ;
225
-
226
- let settings = ExtensionUtils . getSettings ( ) ;
227
- settings . set_uint ( 'log-level' , activeId ) ;
228
- } ) ;
229
-
230
- grid . attach ( log_combo , 1 , top_index , 1 , 1 ) ;
248
+ grid . attach ( combo , 1 , top_index , 1 , 1 ) ;
249
+ return combo
231
250
}
232
251
233
252
// @ts -ignore
0 commit comments