diff --git a/.config/ags/modules/sideright/quicktoggles.js b/.config/ags/modules/sideright/quicktoggles.js index 300e5236b..39b08c908 100644 --- a/.config/ags/modules/sideright/quicktoggles.js +++ b/.config/ags/modules/sideright/quicktoggles.js @@ -88,7 +88,19 @@ export const ModuleNightLight = (props = {}) => Widget.Button({ self.attribute.enabled = !self.attribute.enabled; self.toggleClassName('sidebar-button-active', self.attribute.enabled); 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'), setup: (self) => {