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

Blur onscreen keyboard #164

Draft
wants to merge 71 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
fcdf961
add gjs mappings and .idea config for Intellij Webstorm
CorvetteCole Apr 22, 2021
7675575
Refactor signal handling so each class has a separate connection buff…
CorvetteCole Apr 22, 2021
27e8dca
update .idea config
CorvetteCole Apr 22, 2021
4763285
dash to panel mostly works
CorvetteCole Apr 22, 2021
4727d63
dash to panel enable detection
CorvetteCole Apr 21, 2021
94f97bf
Added timout
aunetx Apr 21, 2021
9db9f0c
Refactor signal handling so each class has a separate connection buff…
CorvetteCole Apr 22, 2021
27750fd
disabled dash to panel connection while work continues on solving the…
CorvetteCole Apr 22, 2021
657e993
remove duplicate thing
CorvetteCole Apr 22, 2021
50e7b1a
removed extraneous logging in init()
CorvetteCole Apr 23, 2021
684823f
Merge pull request #41 from CorvetteCole/dash-to-panel
CorvetteCole Apr 23, 2021
4b4659c
moved overview connection to proper location
CorvetteCole Apr 23, 2021
b2108e3
Added types supports in vscode
aunetx Apr 25, 2021
62b05f2
Fixed crash on #51?
aunetx Apr 25, 2021
171a17d
Prettied
aunetx Apr 25, 2021
fbf772d
Added paint effect
aunetx Apr 25, 2021
015d352
Apparent Screenshots in README.md file. (#61)
saadulkh Apr 29, 2021
e0e7357
Updated README.md
saadulkh Apr 29, 2021
da2f96a
Merge pull request #62 from saaditory/master
CorvetteCole Apr 29, 2021
077e06c
Fix #59
aunetx May 4, 2021
82b5b07
Fix #55
aunetx May 4, 2021
62e651e
Fix #66?
aunetx May 4, 2021
d6d7793
Fix #71
aunetx May 11, 2021
f38498c
Changed license to GPL
aunetx May 11, 2021
b41bc7d
Added gnome 40.1 support
May 12, 2021
d7324dc
Merge pull request #72 from FedShat/master
aunetx May 12, 2021
7c26b42
Revert "Added gnome 40.1 support"
CorvetteCole May 14, 2021
4c27f4f
Merge pull request #76 from aunetx/revert-72-master
CorvetteCole May 14, 2021
dc24a55
Fix #47?
aunetx May 16, 2021
e2af9e0
Merge branch 'master' of github.com:aunetx/blur-my-shell
aunetx May 16, 2021
4183273
Merge branch 'master' of github.com:aunetx/blur-my-shell into emit-pa…
aunetx May 16, 2021
2abdcd9
Added PaintSignals class to keep track of everything
aunetx May 16, 2021
66c079c
Typo with #{~^#] copy-paste
aunetx May 16, 2021
f27f6eb
Removed lockscreen blur zoom with dpi
aunetx May 16, 2021
8686a10
Changed prefs label
aunetx May 26, 2021
8df15f5
Change the offset of the clipping rectangle of the background actor t…
mbrla0 May 26, 2021
2c831b8
Merge pull request #82 from DarkRyu550/master
aunetx May 26, 2021
5a197c1
Merge pull request #52 from aunetx/emit-paint-signal
aunetx May 26, 2021
d5e3f39
Delete todo.md
aunetx May 26, 2021
4954e38
Update README.md
aunetx May 26, 2021
bd4d5f2
remove background_panel first to avoid duplicates
shemgp Jun 5, 2021
ad13ac2
Set dash to dock blurred background position depending on position on…
shemgp Jun 6, 2021
453e746
Merge pull request #87 from shemgp/fix_dash_to_dock_background_position
aunetx Jun 6, 2021
c2598ee
Merge pull request #86 from shemgp/master
aunetx Jun 6, 2021
866af90
Removed unuseful files from git tracking
aunetx Jun 6, 2021
7b29cb4
Removed non-tracked files
aunetx Jun 6, 2021
f75d19e
Updated .gitignore
aunetx Jun 6, 2021
d59c2d6
Update README.md
aunetx Jun 6, 2021
90a58aa
Fix #91
aunetx Jun 16, 2021
c34b547
Merge branch 'master' of github.com:aunetx/blur-my-shell
aunetx Jun 16, 2021
61f7c1d
Fix #96
aunetx Jun 27, 2021
6caf764
Add support for static blur for dash to panel
aunetx Jun 28, 2021
cc89046
Fix #98 and #97
aunetx Jun 29, 2021
8fe49f2
Update README.md
aunetx Jul 1, 2021
ab0058a
Create `Prefs` object in `enable()`
aunetx Jul 1, 2021
d09a06f
Merge branch 'master' of github.com:aunetx/blur-my-shell
aunetx Jul 1, 2021
76f0940
Add a debug switch to prevent unusefull logging
aunetx Jul 1, 2021
cac14de
Sigma can now go up to 150
aunetx Jul 2, 2021
b7389da
Add appfolders blur
aunetx Jul 2, 2021
c565553
Add appfolders class, add animation and finalize look
aunetx Jul 21, 2021
f938e1b
Fixed appfolders disable behaviour
aunetx Jul 21, 2021
5aa9481
Added a switch for appfolder blur
aunetx Jul 21, 2021
3bfa618
Added artifact hacks, removed edit button's grey background-color
aunetx Jul 21, 2021
a62c68b
Merge pull request #106 from aunetx/blur-appfolder
aunetx Jul 21, 2021
776cf71
Fix #74
aunetx Jul 21, 2021
2a39c0b
Merge branch 'master' of github.com:aunetx/blur-my-shell
aunetx Jul 21, 2021
f19b873
Fix #107
aunetx Jul 23, 2021
fe9c04a
Fixed the fix for #107
aunetx Jul 23, 2021
1aec583
fixed #109
aunetx Jul 25, 2021
98a7efe
blurred onscreen keyboard
aunetx Jul 28, 2021
ac3cf34
Tried to make first time blurring work
aunetx Jul 30, 2021
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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/build/
/pkg/
*~
*~
.idea/
.ts-for-gir.js
.vscode/
jsconfig.json
@types/
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

695 changes: 674 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

A GNOME Shell extension that adds a blur look to different parts of the GNOME Shell, including the top panel, dash and overview.

![Capture d’écran de 2021-04-21 23-59-06](https://user-images.githubusercontent.com/31563930/115626495-dc37c480-a2fd-11eb-8066-002dee4b5159.png)
*blurred top panel*
![Capture d’écran de 2021-04-21 23-59-11](https://user-images.githubusercontent.com/31563930/115626626-10ab8080-a2fe-11eb-89a5-7392cbe7c2f8.png)
*blurred overview*

[<img src="https://github.com/aunetx/files_utils/raw/master/get_it_on_gnome_extensions.png" height="100">](https://extensions.gnome.org/extension/3193/blur-my-shell/)

## Screenshots

*Blurred Overview:*
![Blurred Overview](https://user-images.githubusercontent.com/38633812/116588850-779beb80-a935-11eb-8f2f-81bcd46fe694.png)
*Blurred Top Panel:*
![Blurred Top Panel](https://user-images.githubusercontent.com/38633812/116588885-81bdea00-a935-11eb-9c80-c97716369b7c.png)

## Known bugs

### Note
Expand All @@ -17,16 +19,16 @@ This extension can be buggy, as the gnome-shell's blur implementation is quite f

To entirely remove artifacts from the top panel, you can use static blur with the appropriate switch, **use static blur**.

Moreover, selecting *no artifacts* in the settings allows the blur to regenerate itself a lot better, at the expense of CPU time (adds ~3% CPU usage for the gnome-shell process in my old Thinkpad).\
**note: in Gnome 40, selecting this option is not possible for the moment**
Moreover, if you don't use static blur, selecting *no artifacts* in the settings allows the blur to regenerate itself a lot better, at the expense of CPU time (but cannot currently tell the difference, less than 0.5% CPU on my middle-range i5)

Selecting another profile might be enought (especially if you have disabled animations), feel free to test!
Selecting another profile might be enough (especially if you have disabled animations and/or windows borders), feel free to test!

### List of bugs

- artifacts on blurred parts [gnome shell bug](https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2857)
- some apps may become transparent, a weird issue...
- cannot create rounded blur
- cannot create rounded blur (so no rounded dash-to-dock, or panel corners, ...)
- overview blur is transparent on second monitor when using Wayland, sometimes :(
- etc (see in *issues*)

If you find other bugs, please report them!
Expand All @@ -45,16 +47,21 @@ make install

And restart GNOME Shell if needed.

### Force overview blur update

In case you have problems with your dynamic timed wallpaper not being updated due to using third-party process to change the wallpaper, you can force the overview blur to be updated with the command:\
`gsettings set org.gnome.desktop.background picture-opacity 99 && gsettings set org.gnome.desktop.background picture-opacity 100`

### Versions support

The current extension supports those GNOME Shell versions:
The current extension supports these GNOME Shell versions:

- 40

Older GNOME versions are supported up to Blur my Shell version 6:
Older GNOME Shell versions are supported up to Blur my Shell version 6, and by version 17:

- 3.36
- 3.38
- 3.36

## License

Expand Down
229 changes: 229 additions & 0 deletions src/appfolders.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
'use strict';

const { Shell, GLib, Clutter } = imports.gi;
const Main = imports.ui.main;

const Me = imports.misc.extensionUtils.getCurrentExtension();
const Settings = Me.imports.settings;
const Utils = Me.imports.utilities;
const PaintSignals = Me.imports.paint_signals;

const default_sigma = 30;
const default_brightness = 0.6;
const transparent = Clutter.Color.from_pixel(0x00000000);
const FOLDER_DIALOG_ANIMATION_TIME = 200;
const FRAME_UPDATE_PERIOD = 16;

let original_zoomAndFadeIn = null;
let original_zoomAndFadeOut = null;
let sigma = default_sigma;
let brightness = default_brightness;

let _zoomAndFadeIn = function () {
let [sourceX, sourceY] =
this._source.get_transformed_position();
let [dialogX, dialogY] =
this.child.get_transformed_position();

this.child.set({
translation_x: sourceX - dialogX,
translation_y: sourceY - dialogY,
scale_x: this._source.width / this.child.width,
scale_y: this._source.height / this.child.height,
opacity: 0,
});

this.set_background_color(transparent);

let effect = this.get_effect("appfolder-blur");

effect.sigma = 0;
Utils.ease_property(effect, 'sigma', 0, sigma, FOLDER_DIALOG_ANIMATION_TIME, FRAME_UPDATE_PERIOD);

effect.brightness = 1.0;
Utils.ease_property(effect, 'brightness', 1.0, brightness, FOLDER_DIALOG_ANIMATION_TIME, FRAME_UPDATE_PERIOD);

this.child.ease({
translation_x: 0,
translation_y: 0,
scale_x: 1,
scale_y: 1,
opacity: 255,
duration: FOLDER_DIALOG_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
});

this._needsZoomAndFade = false;

if (this._sourceMappedId === 0) {
this._sourceMappedId = this._source.connect(
'notify::mapped', this._zoomAndFadeOut.bind(this));
}
}

let _zoomAndFadeOut = function () {
if (!this._isOpen)
return;

if (!this._source.mapped) {
this.hide();
return;
}

let [sourceX, sourceY] =
this._source.get_transformed_position();
let [dialogX, dialogY] =
this.child.get_transformed_position();

this.set_background_color(transparent);

let effect = this.get_effect("appfolder-blur");

Utils.ease_property(effect, 'sigma', effect.sigma, 0, FOLDER_DIALOG_ANIMATION_TIME, FRAME_UPDATE_PERIOD);

Utils.ease_property(effect, 'brightness', effect.brightness, 1.0, FOLDER_DIALOG_ANIMATION_TIME, FRAME_UPDATE_PERIOD);

this.child.ease({
translation_x: sourceX - dialogX,
translation_y: sourceY - dialogY,
scale_x: this._source.width / this.child.width,
scale_y: this._source.height / this.child.height,
opacity: 0,
duration: FOLDER_DIALOG_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => {
this.child.set({
translation_x: 0,
translation_y: 0,
scale_x: 1,
scale_y: 1,
opacity: 255,
});
this.hide();

this._popdownCallbacks.forEach(func => func());
this._popdownCallbacks = [];
},
});

this._needsZoomAndFade = false;
}


var AppFoldersBlur = class AppFoldersBlur {
constructor(connections, prefs) {
this.connections = connections;
this.paint_signals = new PaintSignals.PaintSignals(connections);
this.prefs = prefs;
}

enable() {
this._log("blurring appfolders");

if (Main.overview._overview.controls._appDisplay._folderIcons.length > 0) {
this.blur_appfolders();
}
this.connections.connect(Main.overview._overview.controls._appDisplay, 'view-loaded', () => {
this.blur_appfolders();
})
}

blur_appfolders() {
Main.overview._overview.controls._appDisplay._folderIcons.forEach(icon => {
icon._ensureFolderDialog();

if (original_zoomAndFadeIn == null) {
original_zoomAndFadeIn = icon._dialog._zoomAndFadeIn;
}
if (original_zoomAndFadeOut == null) {
original_zoomAndFadeOut = icon._dialog._zoomAndFadeOut;
}

let effect = new Shell.BlurEffect({
name: "appfolder-blur",
sigma: sigma,
brightness: brightness,
mode: 1
});
icon._dialog.remove_effect_by_name("appfolder-blur");
icon._dialog.add_effect(effect);

// HACK
// ! DIRTY PART: hack because `Shell.BlurEffect` does not repaint when shadows are under it
// ! this does not entirely fix this bug (shadows caused by windows still cause artefacts)
// ! but it prevents the shadows of the panel buttons to cause artefacts on the panel itself
// ! note: issue opened at https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2857

if (this.prefs.HACKS_LEVEL.get() == 1) {
this._log("appfolders hack level 1");
this.paint_signals.disconnect_all();

Utils.setTimeout(() => {
this.paint_signals.connect(Main.overview._overview, effect);
this.paint_signals.connect(icon._dialog, effect);
}, 100);
} else if (this.prefs.HACKS_LEVEL.get() == 2) {
this._log("panel hack level 2");
this.paint_signals.disconnect_all();

Utils.setTimeout(() => {
this.paint_signals.connect(Main.overview._overview, effect);
this.paint_signals.connect(icon._dialog, effect);
}, 100);
} else {
this.paint_signals.disconnect_all();
}

// ! END OF DIRTY PART

icon._dialog._viewBox.add_style_class_name('transparent-app-folder-dialogs');

icon._dialog._zoomAndFadeIn = _zoomAndFadeIn;
icon._dialog._zoomAndFadeOut = _zoomAndFadeOut;
});
}

set_sigma(s) {
sigma = s;
if (this.prefs.BLUR_APPFOLDERS.get())
this.blur_appfolders();
}

set_brightness(b) {
brightness = b;
if (this.prefs.BLUR_APPFOLDERS.get())
this.blur_appfolders();
}

disable() {
this._log("removing blur from appfolders");

if (original_zoomAndFadeIn != null) {
Main.overview._overview.controls._appDisplay._folderIcons.forEach(icon => {
if (icon._dialog)
icon._dialog._zoomAndFadeIn = original_zoomAndFadeIn;
});
}
if (original_zoomAndFadeOut != null) {
Main.overview._overview.controls._appDisplay._folderIcons.forEach(icon => {
if (icon._dialog)
icon._dialog._zoomAndFadeOut = original_zoomAndFadeOut;
});
}
Main.overview._overview.controls._appDisplay._folderIcons.forEach(icon => {
if (icon._dialog) {
icon._dialog.remove_effect_by_name("appfolder-blur")
icon._dialog._viewBox.remove_style_class_name('transparent-app-folder-dialogs');
}
});

this._log(`before: ${this.connections.buffer}`)
this.connections.disconnect_all();
this._log(`after: ${this.connections.buffer}`)
}

_log(str) {
if (this.prefs.DEBUG.get())
log(`[Blur my Shell] ${str}`)
}
}
21 changes: 20 additions & 1 deletion src/connections.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ var Connections = class Connections {

connect(actor, signal, handler) {
let id = actor.connect(signal, handler);

this.process_connection(actor, id);
}

Expand All @@ -40,6 +39,25 @@ var Connections = class Connections {
this.process_connection(actor, id);
}

disconnect_all_for(actor) {
let actor_connections = this.buffer.filter((infos) => {
infos.actor == actor
});

actor_connections.forEach((connection) => {
// disconnect
try {
connection.actor.disconnect(connection.id)
} catch (e) {
this._log(`error removing connection: ${e}; continuing`)
}

// remove from buffer
let index = this.buffer.indexOf(connection);
this.buffer.splice(index, 1);
})
}

disconnect_all() {
this.buffer.forEach((connection) => {
try {
Expand All @@ -51,6 +69,7 @@ var Connections = class Connections {
this.buffer = [];
}

// no need to check if DEBUG here, the log function is only used on error
_log(str) {
log(`[Blur my Shell] ${str}`)
}
Expand Down
13 changes: 8 additions & 5 deletions src/dash.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const Main = imports.ui.main;

const Me = imports.misc.extensionUtils.getCurrentExtension();
const Settings = Me.imports.settings;
let prefs = new Settings.Prefs;

const default_sigma = 30;
const default_brightness = 0.6;

var DashBlur = class DashBlur {
constructor(connections) {
constructor(connections, prefs) {
this.connections = connections;
this.prefs = prefs;
}

enable() {
Expand All @@ -22,7 +22,7 @@ var DashBlur = class DashBlur {

update() {
if (Main.overview.dash.constructor.name == "Dash") {
Main.overview.dash.get_child_at_index(0).style = "background-color:rgba(0,0,0," + prefs.DASH_OPACITY.get() + ")";
Main.overview.dash.get_child_at_index(0).style = "background-color:rgba(0,0,0," + this.prefs.DASH_OPACITY.get() + ")";
}
}

Expand All @@ -38,9 +38,12 @@ var DashBlur = class DashBlur {
}
}
}

this.connections.disconnect_all();
}

_log(str) {
log(`[Blur my Shell] ${str}`)
if (this.prefs.DEBUG.get())
log(`[Blur my Shell] ${str}`)
}
}
}
Loading