replace wlsunset with gammastep (#459)

This commit is contained in:
end-4
2024-05-03 21:36:20 +07:00
committed by GitHub
3 changed files with 18 additions and 10 deletions
+16 -7
View File
@@ -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,25 @@ 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')
.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) => {
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 +247,3 @@ export const ModulePowerIcon = (props = {}) => Widget.Button({
setupCursorHover(button);
}
})
+1 -2
View File
@@ -1,5 +1,6 @@
# Bar, wallpaper
exec-once = swww-daemon --format xrgb
exec-once = /usr/lib/geoclue-2.0/demos/agent
exec-once = ags &
# Input method
@@ -19,5 +20,3 @@ exec-once = wl-paste --type image --watch cliphist store
# Cursor
exec-once = hyprctl setcursor Bibata-Modern-Classic 24
+1 -1
View File
@@ -26,7 +26,7 @@ pavucontrol wireplumber libdbusmenu-gtk3 playerctl swww
webp-pixbuf-loader gtk-layer-shell gtk3 gtksourceview3 gobject-introspection upower yad ydotool
### Gnome
polkit-gnome gnome-keyring gnome-control-center blueberry networkmanager wlsunset gnome-bluetooth-3.0
polkit-gnome gnome-keyring gnome-control-center blueberry networkmanager gammastep gnome-bluetooth-3.0
### Backlight
brightnessctl ddcutil