Skip to content

Commit

Permalink
Don't show brightness OSD if screen dimming is occurring
Browse files Browse the repository at this point in the history
  • Loading branch information
fossfreedom committed Feb 11, 2025
1 parent 3b7282a commit 6d41934
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/daemon/osdkeys.vala
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@

GLib.VariantDict dict = new GLib.VariantDict(parameters.get_child_value(1));
GLib.Variant? brightness = dict.lookup_value("Brightness", GLib.VariantType.INT32);
if (brightness == null) {
if (brightness == null || Screenlock.is_dimming) {
return;
}

Expand Down
8 changes: 8 additions & 0 deletions src/daemon/screenlock.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace Budgie {
PowerScreenRemote? powerscreen_proxy = null;
bool isdimmable = false;
int32 current_brightness = 0;
public static bool is_dimming { get; private set; default = false; }

// connections to various schemas used in screenlocking
private GLib.Settings power;
Expand Down Expand Up @@ -246,6 +247,8 @@ namespace Budgie {
return;
}

is_dimming = true;

current_brightness = powerscreen_proxy.Brightness;
int32 idle_brightness = power.get_int("idle-brightness");

Expand All @@ -260,6 +263,11 @@ namespace Budgie {
}

powerscreen_proxy.Brightness = current_brightness;

Timeout.add(200, ()=> {
is_dimming = false;
return false;
});
}

void on_bus_acquired(DBusConnection conn) {
Expand Down

0 comments on commit 6d41934

Please sign in to comment.