add anti-flashbang with shader

This commit is contained in:
end-4
2026-03-19 12:40:05 +01:00
parent 7cf704d450
commit be1838e40d
4 changed files with 109 additions and 6 deletions
@@ -8,10 +8,10 @@ QuickToggleModel {
name: Translation.tr("Anti-flashbang")
tooltipText: Translation.tr("Anti-flashbang")
icon: "flash_off"
toggled: Config.options.light.antiFlashbang.enable
toggled: HyprlandAntiFlashbangShader.enabled
mainAction: () => {
Config.options.light.antiFlashbang.enable = !Config.options.light.antiFlashbang.enable;
HyprlandAntiFlashbangShader.toggle()
}
hasMenu: true
}
@@ -42,7 +42,7 @@ WindowDialog {
right: parent.right
}
iconSize: Appearance.font.pixelSize.larger
buttonIcon: "lightbulb"
buttonIcon: "check"
text: Translation.tr("Enable now")
checked: Hyprsunset.active
onCheckedChanged: {
@@ -102,14 +102,32 @@ WindowDialog {
right: parent.right
}
iconSize: Appearance.font.pixelSize.larger
buttonIcon: "flash_off"
text: Translation.tr("Enable")
buttonIcon: "filter"
text: Translation.tr("Content adjustment")
checked: HyprlandAntiFlashbangShader.enabled
onCheckedChanged: {
if (checked) HyprlandAntiFlashbangShader.enable()
else HyprlandAntiFlashbangShader.disable()
}
StyledToolTip {
text: Translation.tr("<b>Dims screen content</b> as needed.<br><br>Pros: Immediately responsive<br>Cons: Expensive and can hurt color accuracy<br><br><i>Uses a Hyprland screen shader</i>")
}
}
ConfigSwitch {
anchors {
left: parent.left
right: parent.right
}
iconSize: Appearance.font.pixelSize.larger
buttonIcon: "light_mode"
text: Translation.tr("Brightness adjustment")
checked: Config.options.light.antiFlashbang.enable
onCheckedChanged: {
Config.options.light.antiFlashbang.enable = checked;
}
StyledToolTip {
text: Translation.tr("Example use case: eroge on one workspace, dark Discord window on another")
text: Translation.tr("Adapts the <b>display (physical screen) brightness</b><br><br>Pros: Less expensive, retains colors<br>Cons: Not immediately responsive<br><br><i>Adjusts display brightness after each Hyprland IPC event</i>")
}
}
}