Skip to content
Open
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
17 changes: 12 additions & 5 deletions src/controlCenter/widgets/backlight/backlightUtil.vala
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,24 @@ namespace SwayNotificationCenter.Widgets {
}

private void connect_monitor () {
if (monitor != null) {
// connect monitor to monitor changes
monitor.changed.connect ((src, dest, event) => {
get_brightness ();
});
if (monitor == null) {
try {
monitor = fd.monitor (FileMonitorFlags.NONE, null);
} catch (Error e) {
critical ("Error %s\n", e.message);
return;
}
}
// connect monitor to monitor changes
monitor.changed.connect ((src, dest, event) => {
get_brightness ();
});
}

public void close () {
if (monitor != null) {
monitor.cancel ();
monitor = null;
}
}

Expand Down
Loading