33 lines
1.2 KiB
Diff
33 lines
1.2 KiB
Diff
|
diff --git a/src/proximity.c b/src/proximity.c
|
||
|
index 0beca69..8e93b21 100644
|
||
|
--- a/src/proximity.c
|
||
|
+++ b/src/proximity.c
|
||
|
@@ -148,8 +155,9 @@ on_proximity_near_changed (PhoshProximity *self,
|
||
|
PhoshSensorProxyManager *sensor)
|
||
|
{
|
||
|
gboolean near;
|
||
|
- int ps_mode;
|
||
|
+ int ps_mode;
|
||
|
PhoshShell *shell = phosh_shell_get_default ();
|
||
|
+ PhoshWayland *wl = phosh_wayland_get_default ();
|
||
|
PhoshMonitor *monitor = phosh_shell_get_builtin_monitor (shell);
|
||
|
|
||
|
near = phosh_dbus_sensor_proxy_get_proximity_near (
|
||
|
@@ -157,8 +165,15 @@ on_proximity_near_changed (PhoshProximity *self,
|
||
|
|
||
|
g_debug ("Proximity near changed: %d", near);
|
||
|
if (near) {
|
||
|
- ps_mode = PHOSH_MONITOR_POWER_SAVE_MODE_OFF;
|
||
|
+ if (!self->fader) {
|
||
|
+ self->fader = phosh_fader_new (phosh_wayland_get_zwlr_layer_shell_v1 (wl),
|
||
|
+ monitor->wl_output);
|
||
|
+ gtk_widget_show (GTK_WIDGET (self->fader));
|
||
|
+ }
|
||
|
+ g_timeout_add_seconds (5, continue, self);
|
||
|
+ ps_mode = PHOSH_MONITOR_POWER_SAVE_MODE_OFF;
|
||
|
} else {
|
||
|
+ g_clear_pointer (&self->fader, phosh_cp_widget_destroy);
|
||
|
ps_mode = PHOSH_MONITOR_POWER_SAVE_MODE_ON;
|
||
|
}
|
||
|
phosh_monitor_set_power_save_mode (monitor, ps_mode);
|