replace wlsunset with gammastep

wlsunset doesn't work w/o manually passing the latitude and longitude.
gammastep can retrieve geolocation from geoclue so it works out of the
box for everyone.
This commit is contained in:
MoetaYuko
2024-05-01 22:59:20 +08:00
parent cba0a45c6e
commit 2fc464123f
3 changed files with 6 additions and 10 deletions
@@ -78,7 +78,7 @@ export const HyprToggleIcon = async (icon, name, hyprlandConfigValue, props = {}
}
}
export const ModuleNightLight = (props = {}) => Widget.Button({ // TODO: Make this work
export const ModuleNightLight = (props = {}) => Widget.Button({
attribute: {
enabled: false,
},
@@ -87,13 +87,13 @@ export const ModuleNightLight = (props = {}) => Widget.Button({ // TODO: Make th
onClicked: (self) => {
self.attribute.enabled = !self.attribute.enabled;
self.toggleClassName('sidebar-button-active', self.attribute.enabled);
if (self.attribute.enabled) Utils.execAsync(['wlsunset', '-t', '4500']).catch(print)
else Utils.execAsync('pkill wlsunset').catch(print);
if (self.attribute.enabled) Utils.execAsync('gammastep').catch(print)
else Utils.execAsync('pkill gammastep').catch(print);
},
child: MaterialIcon('nightlight', 'norm'),
setup: (self) => {
setupCursorHover(self);
self.attribute.enabled = !!exec('pidof wlsunset');
self.attribute.enabled = !!exec('pidof gammastep');
self.toggleClassName('sidebar-button-active', self.attribute.enabled);
},
...props,
@@ -235,6 +235,3 @@ export const ModulePowerIcon = (props = {}) => Widget.Button({
setupCursorHover(button);
}
})