forked from Shinonome/dots-hyprland
disable night light button until gammastep fully terminated
This commit is contained in:
@@ -88,7 +88,19 @@ export const ModuleNightLight = (props = {}) => Widget.Button({
|
|||||||
self.attribute.enabled = !self.attribute.enabled;
|
self.attribute.enabled = !self.attribute.enabled;
|
||||||
self.toggleClassName('sidebar-button-active', self.attribute.enabled);
|
self.toggleClassName('sidebar-button-active', self.attribute.enabled);
|
||||||
if (self.attribute.enabled) Utils.execAsync('gammastep').catch(print)
|
if (self.attribute.enabled) Utils.execAsync('gammastep').catch(print)
|
||||||
else Utils.execAsync('pkill gammastep').catch(print);
|
else Utils.execAsync('pkill gammastep')
|
||||||
|
.then(() => {
|
||||||
|
// disable the button until fully terminated to avoid race
|
||||||
|
self.sensitive = false;
|
||||||
|
const source = setInterval(() => {
|
||||||
|
Utils.execAsync('pkill -0 gammastep')
|
||||||
|
.catch(() => {
|
||||||
|
self.sensitive = true;
|
||||||
|
source.destroy();
|
||||||
|
});
|
||||||
|
}, 500);
|
||||||
|
})
|
||||||
|
.catch(print);
|
||||||
},
|
},
|
||||||
child: MaterialIcon('nightlight', 'norm'),
|
child: MaterialIcon('nightlight', 'norm'),
|
||||||
setup: (self) => {
|
setup: (self) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user