Fade out desktop icons when showing overview
As desktop icons don't have any purpose in the overview (except for distracting the user), fade them out when entering the overview. Unfortunately, the fading effect affects performance, therefore hide icons directly when there are maximized windows on the desktop. https://bugzilla.gnome.org/show_bug.cgi?id=600999
This commit is contained in:
@ -47,8 +47,6 @@ let _errorLogStack = [];
|
||||
let _startDate;
|
||||
|
||||
let background = null;
|
||||
let _windowAddedSignalId = null;
|
||||
let _windowRemovedSignalId = null;
|
||||
|
||||
function start() {
|
||||
// Add a binding for "global" in the global JS namespace; (gjs
|
||||
@ -149,10 +147,8 @@ function start() {
|
||||
});
|
||||
|
||||
background = global.create_root_pixmap_actor();
|
||||
global.screen.connect('workspace-switched', _onWorkspaceSwitched);
|
||||
global.stage.add_actor(background);
|
||||
background.lower_bottom();
|
||||
_onWorkspaceSwitched(global.screen, -1);
|
||||
|
||||
global.connect('screen-size-changed', _relayout);
|
||||
|
||||
@ -214,45 +210,6 @@ function _getAndClearErrorStack() {
|
||||
return errors;
|
||||
}
|
||||
|
||||
function showBackground() {
|
||||
background.show();
|
||||
}
|
||||
|
||||
function hideBackground() {
|
||||
background.hide();
|
||||
}
|
||||
|
||||
function _onWorkspaceSwitched(screen, from) {
|
||||
let workspace = screen.get_active_workspace();
|
||||
|
||||
if (from != -1) {
|
||||
let old_workspace = screen.get_workspace_by_index(from);
|
||||
|
||||
if (_windowAddedSignalId !== null)
|
||||
old_workspace.disconnect(_windowAddedSignalId);
|
||||
if (background.windowRemovedSignalId !== null)
|
||||
old_workspace.disconnect(_windowRemovedSignalId);
|
||||
}
|
||||
|
||||
_windowAddedSignalId = workspace.connect('window-added', function(workspace, win) {
|
||||
if (win.window_type == Meta.WindowType.DESKTOP)
|
||||
hideBackground();
|
||||
});
|
||||
_windowRemovedSignalId = workspace.connect('window-removed', function(workspace, win) {
|
||||
if (win.window_type == Meta.WindowType.DESKTOP)
|
||||
showBackground();
|
||||
});
|
||||
|
||||
function _isDesktop(win) {
|
||||
return win.window_type == Meta.WindowType.DESKTOP;
|
||||
}
|
||||
|
||||
if (workspace.list_windows().some(_isDesktop))
|
||||
hideBackground();
|
||||
else
|
||||
showBackground();
|
||||
}
|
||||
|
||||
function _relayout() {
|
||||
let primary = global.get_primary_monitor();
|
||||
panel.actor.set_position(primary.x, primary.y);
|
||||
|
Reference in New Issue
Block a user