mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
use wlsunset for night light
This commit is contained in:
@@ -68,24 +68,32 @@ export const HyprToggleIcon = (icon, name, hyprlandConfigValue, props = {}) => W
|
|||||||
...props,
|
...props,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const ModuleNightLight = (props = {}) => Widget.Button({
|
export const ModuleNightLight = (props = {}) => Widget.Button({ // TODO: Make this work
|
||||||
|
properties: [
|
||||||
|
['enabled', false],
|
||||||
|
['yellowlight', undefined],
|
||||||
|
],
|
||||||
className: 'txt-small sidebar-iconbutton',
|
className: 'txt-small sidebar-iconbutton',
|
||||||
tooltipText: 'Night Light',
|
tooltipText: 'Night Light',
|
||||||
onClicked: (button) => {
|
onClicked: (self) => {
|
||||||
const shaderPath = JSON.parse(exec('hyprctl -j getoption decoration:screen_shader')).str;
|
self._enabled = !self._enabled;
|
||||||
if (shaderPath != "[[EMPTY]]" && shaderPath != "") {
|
self.toggleClassName('sidebar-button-active', self._enabled);
|
||||||
execAsync(['bash', '-c', `hyprctl keyword decoration:screen_shader ''`]).catch(print);
|
if (self._enabled) {
|
||||||
button.toggleClassName('sidebar-button-active', false);
|
self._inhibitor = Utils.subprocess(
|
||||||
|
['wlsunset'],
|
||||||
|
(output) => print(output),
|
||||||
|
(err) => logError(err),
|
||||||
|
self,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
execAsync(['bash', '-c', `hyprctl keyword decoration:screen_shader ~/.config/hypr/shaders/extradark.frag`]).catch(print);
|
self._inhibitor.force_exit();
|
||||||
button.toggleClassName('sidebar-button-active', true);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: MaterialIcon('nightlight', 'norm'),
|
child: MaterialIcon('nightlight', 'norm'),
|
||||||
setup: setupCursorHover,
|
setup: setupCursorHover,
|
||||||
...props,
|
...props,
|
||||||
})
|
});
|
||||||
|
|
||||||
export const ModuleInvertColors = (props = {}) => Widget.Button({
|
export const ModuleInvertColors = (props = {}) => Widget.Button({
|
||||||
className: 'txt-small sidebar-iconbutton',
|
className: 'txt-small sidebar-iconbutton',
|
||||||
|
|||||||
Reference in New Issue
Block a user