@@ -56,28 +56,30 @@ function SmartPanelExt(metadata, orientation, panel_height, instanceId) {
56
56
SmartPanelExt . prototype = {
57
57
_init : function ( metadata , orientation , panel_height , instanceId ) {
58
58
59
- Settings . BindingDirection . BI = Settings . BindingDirection . BIDIRECTIONAL
60
59
this . settings = new Settings . ExtensionSettings ( this , "smart-panel@mohammad-sn" ) ;
61
- this . settings . bindProperty ( Settings . BindingDirection . BI , "scroll-action" , "scrl_action" , this . _onScrollActionChanged , null ) ;
62
- this . settings . bindProperty ( Settings . BindingDirection . BI , "sep-scroll-action" , "sep_acts" , this . _onScrollSettingsChanged , null ) ;
63
- this . settings . bindProperty ( Settings . BindingDirection . IN , "scroll-action-up" , "scrl_up_action" , null , null ) ;
64
- this . settings . bindProperty ( Settings . BindingDirection . IN , "scroll-action-down" , "scrl_down_action" , null , null ) ;
65
- this . settings . bindProperty ( Settings . BindingDirection . IN , "dblclck-action" , "dblclck_action" , null , null ) ;
66
- this . settings . bindProperty ( Settings . BindingDirection . IN , "mdlclck-action" , "mdlclck_action" , null , null ) ;
67
- this . settings . bindProperty ( Settings . BindingDirection . IN , "use-gestures" , "use_gestures" , null , null ) ;
68
- this . settings . bindProperty ( Settings . BindingDirection . IN , "to-left-action" , "to_left" , null , null ) ;
69
- this . settings . bindProperty ( Settings . BindingDirection . IN , "to-right-action" , "to_right" , null , null ) ;
70
- this . settings . bindProperty ( Settings . BindingDirection . IN , "vert-out-action" , "vert_out" , null , null ) ;
71
- this . settings . bindProperty ( Settings . BindingDirection . IN , "cc1-action" , "cc1" , null , null ) ;
72
- this . settings . bindProperty ( Settings . BindingDirection . IN , "cc2-action" , "cc2" , null , null ) ;
73
- this . settings . bindProperty ( Settings . BindingDirection . IN , "cc3-action" , "cc3" , null , null ) ;
74
- this . settings . bindProperty ( Settings . BindingDirection . IN , "prev-fast-scroll" , "no_fast_scroll" , null , null ) ;
75
- this . settings . bindProperty ( Settings . BindingDirection . IN , "topleft-osd" , "topleft_osd" , null , null ) ;
76
- this . settings . bindProperty ( Settings . BindingDirection . IN , "scroll-delay" , "scroll_delay" , null , null ) ;
77
- this . settings . bindProperty ( Settings . BindingDirection . IN , "appswitcher-style" , "switcher_style" , null , null ) ;
78
- this . settings . bindProperty ( Settings . BindingDirection . IN , "appswitcher-scope" , "switcher_scope" , null , null ) ;
79
- this . settings . bindProperty ( Settings . BindingDirection . IN , "scope-modified" , "switcher_modified" , null , null ) ;
80
- this . settings . bindProperty ( Settings . BindingDirection . IN , "appswitcher-modifier" , "switcher_modifier" , null , null ) ;
60
+ this . settings . bind ( "scroll-action" , "scrl_action" , this . _onScrollActionChanged ) ;
61
+ this . settings . bind ( "sep-scroll-action" , "sep_acts" , this . _onScrollSettingsChanged ) ;
62
+ this . settings . bind ( "scroll-action-up" , "scrl_up_action" , null ) ;
63
+ this . settings . bind ( "scroll-action-down" , "scrl_down_action" , null ) ;
64
+ this . settings . bind ( "dblclck-action" , "dblclck_action" , null ) ;
65
+ this . settings . bind ( "mdlclck-action" , "mdlclck_action" , null ) ;
66
+ this . settings . bind ( "use-gestures" , "use_gestures" , null ) ;
67
+ this . settings . bind ( "to-left-action" , "to_left" , null ) ;
68
+ this . settings . bind ( "to-right-action" , "to_right" , null ) ;
69
+ this . settings . bind ( "vert-out-action" , "vert_out" , null ) ;
70
+ this . settings . bind ( "cc1-action" , "cc1" , null ) ;
71
+ this . settings . bind ( "cc2-action" , "cc2" , null ) ;
72
+ this . settings . bind ( "cc3-action" , "cc3" , null ) ;
73
+ this . settings . bind ( "prev-fast-scroll" , "no_fast_scroll" , null ) ;
74
+ this . settings . setValue ( "show-osd" , global . settings . get_boolean ( 'workspace-osd-visible' ) ) ;
75
+ this . settings . bind ( "show-osd" , "show_osd" , this . _onShowOSDChanged , null ) ;
76
+ this . settings . bind ( "scroll-delay" , "scroll_delay" , null ) ;
77
+ this . settings . bind ( "appswitcher-style" , "switcher_style" , null ) ;
78
+ this . settings . bind ( "appswitcher-scope" , "switcher_scope" , null ) ;
79
+ this . settings . bind ( "scope-modified" , "switcher_modified" , null ) ;
80
+ this . settings . bind ( "appswitcher-modifier" , "switcher_modifier" , null ) ;
81
+ this . _onShowOSDChanged ( ) ;
82
+ global . settings . connect ( "changed::workspace-osd-visible" , ( ) => { this . show_osd = global . settings . get_boolean ( 'workspace-osd-visible' ) } ) ;
81
83
82
84
this . cwm_settings = new Gio . Settings ( { schema : "org.cinnamon.desktop.wm.preferences" } ) ;
83
85
@@ -101,6 +103,10 @@ SmartPanelExt.prototype = {
101
103
this . dblb_T = this . mos_settings . get_int ( 'double-click' ) ;
102
104
} ,
103
105
106
+ _onShowOSDChanged : function ( ) {
107
+ global . settings . set_boolean ( 'workspace-osd-visible' , this . show_osd ) ;
108
+ } ,
109
+
104
110
_onScrollActionChanged : function ( ) {
105
111
if ( this . scrl_action != "none" ) this . sep_acts = false ;
106
112
} ,
@@ -284,7 +290,6 @@ SmartPanelExt.prototype = {
284
290
this . workspaceSwitcherExt . ExtSwitchToWorkspace ( reqWs ) ;
285
291
} else {
286
292
reqWs . activate ( global . get_current_time ( ) ) ;
287
- this . showWorkspaceOSD ( ) ;
288
293
}
289
294
}
290
295
}
@@ -401,88 +406,10 @@ SmartPanelExt.prototype = {
401
406
this . workspaceSwitcherExt . ExtSwitchToWorkspace ( reqWs ) ;
402
407
} else {
403
408
reqWs . activate ( global . get_current_time ( ) ) ;
404
- this . showWorkspaceOSD ( ) ;
405
409
}
406
410
}
407
411
} ,
408
412
409
- showWorkspaceOSD : function ( ) {
410
- this . _hideWorkspaceOSD ( ) ;
411
- if (
412
- global . settings . get_boolean ( 'workspace-osd-visible' ) &&
413
- this . topleft_osd
414
- ) {
415
- let current_workspace_index =
416
- global . screen . get_active_workspace_index ( ) ;
417
- let monitor = Main . layoutManager . primaryMonitor ;
418
- if ( this . _workspace_osd == null )
419
- this . _workspace_osd = new St . Label ( {
420
- style_class : 'workspace-osd' ,
421
- } ) ;
422
- this . _workspace_osd . set_text (
423
- Main . getWorkspaceName ( current_workspace_index )
424
- ) ;
425
- //this._workspace_osd.set_opacity = 0;
426
- this . _workspace_osd . set_opacity ( 0 ) ;
427
- Main . layoutManager . addChrome ( this . _workspace_osd , {
428
- visibleInFullscreen : false ,
429
- affectsInputRegion : false ,
430
- } ) ;
431
- let workspace_osd_x = global . settings . get_int ( 'workspace-osd-x' ) ;
432
- let workspace_osd_y = global . settings . get_int ( 'workspace-osd-y' ) ;
433
- /*
434
- * This aligns the osd edges to the minimum/maximum values from gsettings,
435
-
436
- * if those are selected to be used. For values in between minimum/maximum,
437
- * it shifts the osd by half of the percentage used of the overall space available
438
- * for display (100% - (left and right 'padding')).
439
- * The horizontal minimum/maximum values are 5% and 95%, resulting in 90% available for positioning
440
- * If the user choses 50% as osd position, these calculations result the osd being centered onscreen
441
- */
442
- let [ minX , maxX , minY , maxY ] = [ 5 , 95 , 5 , 95 ] ;
443
- let delta = ( workspace_osd_x - minX ) / ( maxX - minX ) ;
444
- let x = Math . round (
445
- ( monitor . width * workspace_osd_x ) / 100 -
446
- this . _workspace_osd . width * delta
447
- ) ;
448
- delta = ( workspace_osd_y - minY ) / ( maxY - minY ) ;
449
- let y = Math . round (
450
- ( monitor . height * workspace_osd_y ) / 100 -
451
- this . _workspace_osd . height * delta
452
- ) ;
453
- this . _workspace_osd . set_position ( x , y ) ;
454
- let duration =
455
- global . settings . get_int ( 'workspace-osd-duration' ) / 1000 ;
456
- Tweener . addTween ( this . _workspace_osd , {
457
- opacity : 255 ,
458
- time : duration ,
459
- transition : 'linear' ,
460
- onComplete : this . _fadeWorkspaceOSD ,
461
- onCompleteScope : this ,
462
- } ) ;
463
- }
464
- } ,
465
-
466
- _fadeWorkspaceOSD : function ( ) {
467
- if ( this . _workspace_osd != null ) {
468
- let duration = global . settings . get_int ( "workspace-osd-duration" ) / 2000 ;
469
- Tweener . addTween ( this . _workspace_osd , { opacity : 0 ,
470
- time : duration ,
471
- transition : 'easeOutExpo' ,
472
- onComplete : this . _hideWorkspaceOSD ,
473
- onCompleteScope : this } ) ;
474
- }
475
- } ,
476
-
477
- _hideWorkspaceOSD : function ( ) {
478
- if ( this . _workspace_osd != null ) {
479
- this . _workspace_osd . hide ( ) ;
480
- Main . layoutManager . removeChrome ( this . _workspace_osd ) ;
481
- this . _workspace_osd . destroy ( ) ;
482
- this . _workspace_osd = null ;
483
- }
484
- } ,
485
-
486
413
_updateWorkspaceSwitcherExt : function ( ) {
487
414
// Check if one of the workspace switcher extensions are installed or if the state has changed since we last checked
488
415
if ( ExtensionSystem . runningExtensions . indexOf ( 'DesktopCube@yare' ) > - 1 ) {
0 commit comments