Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Begin working on opaque fullscreen window... #640

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions resources/ui/applications.ui
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,21 @@ To get the best results possible, although with reduced performances, you can ch
</object>
</child>

<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Opaque fullscreen window</property>
<property name="subtitle" translatable="yes">Makes fullscreen windows opaque, helping with legibility.</property>
<property name="activatable-widget">opaque_fullscreen_window</property>
<property name="sensitive" bind-source="blur" bind-property="state" bind-flags="sync-create" />

<child>
<object class="GtkSwitch" id="opaque_fullscreen_window">
<property name="valign">center</property>
</object>
</child>
</object>
</child>

<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Blur on overview</property>
Expand Down
8 changes: 7 additions & 1 deletion schemas/org.gnome.shell.extensions.blur-my-shell.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@
<!-- STYLE COMPONENTS -->
<key type="i" name="style-components">
<default>1</default>
<summary>Enum to select the style of the components in overview (0 not styled, 1 light, 2 dark, 3 transparent)</summary>
<summary>Enum to select the style of the components in overview (0 not styled, 1 light, 2 dark, 3
transparent)</summary>
</key>
</schema>

Expand Down Expand Up @@ -391,6 +392,11 @@
<default>true</default>
<summary>Wether or not to make the focused window opaque</summary>
</key>
<!-- OPAQUE FULLSCREEN WINDOW -->
<key type="b" name="opaque-fullscreen-window">
<default>false</default>
<summary>Wether or not to make fullscreen windows opaque</summary>
</key>
<!-- BLUR ON OVERVIEW -->
<key type="b" name="blur-on-overview">
<default>false</default>
Expand Down
39 changes: 29 additions & 10 deletions src/components/applications.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ export const ApplicationsBlur = class ApplicationsBlur {
_ => this.check_blur(meta_window)
);

// update the blur when wm-class is changed
this.connections.connect(
meta_window, 'notify::fullscreen',
_ => this.update_opacity_for(meta_window, pid)
);

// update the position and size when the window size changes
this.connections.connect(
meta_window, 'size-changed',
Expand Down Expand Up @@ -310,7 +316,7 @@ export const ApplicationsBlur = class ApplicationsBlur {
// if we remove the focus and have blur, show it and make the window transparent
else if (blur_actor) {
blur_actor.show();
this.set_window_opacity(window_actor, this.settings.applications.OPACITY);
this.set_window_opacity(window_actor, this.get_opacity_for_window(meta_window));
}
}

Expand Down Expand Up @@ -346,16 +352,29 @@ export const ApplicationsBlur = class ApplicationsBlur {
});
}

/// Update the opacity of all window actors.
set_opacity() {
let opacity = this.settings.applications.OPACITY;
/// Get the opacity for a given meta window; taking into account whether or it is fullscreen
/// and needs to be opaque.
get_opacity_for_window(meta_window) {
if (this.settings.applications.OPAQUE_FULLSCREEN_WINDOW && meta_window.fullscreen)
return 255;
else
return this.settings.applications.OPACITY;
}

this.meta_window_map.forEach(((meta_window, pid) => {
if (pid != this.focused_window_pid && meta_window.blur_actor) {
let window_actor = meta_window.get_compositor_private();
this.set_window_opacity(window_actor, opacity);
}
}));
/// Update the opacity of a given window actor.
update_opacity_for(meta_window, pid) {
if (pid != this.focused_window_pid && meta_window.blur_actor) {
let window_actor = meta_window.get_compositor_private();
let opacity = this.get_opacity_for_window(meta_window);
this.set_window_opacity(window_actor, opacity);
}
}

/// Update the opacity of all window actors.
update_opacity() {
this.meta_window_map.forEach(
(meta_window, pid) => this.update_opacity_for(meta_window, pid)
);
}

/// Compute the size and position for a blur actor.
Expand Down
1 change: 1 addition & 0 deletions src/conveniences/keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const KEYS = [
{ type: Type.D, name: "brightness" },
{ type: Type.I, name: "opacity" },
{ type: Type.B, name: "dynamic-opacity" },
{ type: Type.B, name: "opaque-fullscreen-window" },
{ type: Type.B, name: "blur-on-overview" },
{ type: Type.B, name: "enable-all" },
{ type: Type.AS, name: "whitelist" },
Expand Down
10 changes: 7 additions & 3 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,7 @@ export default class BlurMyShell extends Extension {
// application opacity changed
this._settings.applications.OPACITY_changed(() => {
if (this._settings.applications.BLUR)
this._applications_blur.set_opacity(
this._settings.applications.OPACITY
);
this._applications_blur.update_opacity();
});

// application dynamic-opacity changed
Expand All @@ -477,6 +475,12 @@ export default class BlurMyShell extends Extension {
this._applications_blur.init_dynamic_opacity();
});

// application opaque-fullscreen-window changed
this._settings.applications.OPAQUE_FULLSCREEN_WINDOW_changed(() => {
if (this._settings.applications.BLUR)
this._applications_blur.init_dynamic_opacity();
});

// application blur-on-overview changed
this._settings.applications.BLUR_ON_OVERVIEW_changed(() => {
if (this._settings.applications.BLUR)
Expand Down
5 changes: 5 additions & 0 deletions src/preferences/applications.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const Applications = GObject.registerClass({
'brightness',
'opacity',
'dynamic_opacity',
'opaque_fullscreen_window',
'blur_on_overview',
'enable_all',
'whitelist',
Expand All @@ -60,6 +61,10 @@ export const Applications = GObject.registerClass({
'dynamic-opacity', this._dynamic_opacity, 'active',
Gio.SettingsBindFlags.DEFAULT
);
this.preferences.applications.settings.bind(
'opaque-fullscreen-window', this._opaque_fullscreen_window, 'active',
Gio.SettingsBindFlags.DEFAULT
);
this.preferences.applications.settings.bind(
'blur-on-overview', this._blur_on_overview, 'active',
Gio.SettingsBindFlags.DEFAULT
Expand Down