mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-10 07:42:09 -04:00
displays: add full screen only for hyprland and convert vrr to dropdown
fixes #1649 fixes #1548
This commit is contained in:
@@ -251,7 +251,7 @@ StyledRect {
|
||||
DankToggle {
|
||||
width: parent.width
|
||||
text: I18n.tr("Variable Refresh Rate")
|
||||
visible: root.isConnected && !CompositorService.isDwl && (DisplayConfigState.outputs[root.outputName]?.vrr_supported ?? false)
|
||||
visible: root.isConnected && !CompositorService.isDwl && !CompositorService.isHyprland && !CompositorService.isNiri && (DisplayConfigState.outputs[root.outputName]?.vrr_supported ?? false)
|
||||
checked: {
|
||||
const pendingVrr = DisplayConfigState.getPendingValue(root.outputName, "vrr");
|
||||
if (pendingVrr !== undefined)
|
||||
@@ -261,13 +261,52 @@ StyledRect {
|
||||
onToggled: checked => DisplayConfigState.setPendingChange(root.outputName, "vrr", checked)
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
DankDropdown {
|
||||
width: parent.width
|
||||
text: I18n.tr("VRR On-Demand")
|
||||
description: I18n.tr("VRR activates only when applications request it")
|
||||
text: I18n.tr("Variable Refresh Rate")
|
||||
addHorizontalPadding: true
|
||||
visible: root.isConnected && CompositorService.isHyprland && (DisplayConfigState.outputs[root.outputName]?.vrr_supported ?? false)
|
||||
options: [I18n.tr("Off"), I18n.tr("On"), I18n.tr("Fullscreen Only")]
|
||||
currentValue: {
|
||||
DisplayConfigState.pendingHyprlandChanges;
|
||||
if (DisplayConfigState.getHyprlandSetting(root.outputData, root.outputName, "vrrFullscreenOnly", false))
|
||||
return I18n.tr("Fullscreen Only");
|
||||
const pendingVrr = DisplayConfigState.getPendingValue(root.outputName, "vrr");
|
||||
const vrrEnabled = pendingVrr !== undefined ? pendingVrr : (DisplayConfigState.outputs[root.outputName]?.vrr_enabled ?? false);
|
||||
if (vrrEnabled)
|
||||
return I18n.tr("On");
|
||||
return I18n.tr("Off");
|
||||
}
|
||||
onValueChanged: value => {
|
||||
const off = I18n.tr("Off");
|
||||
const fullscreen = I18n.tr("Fullscreen Only");
|
||||
DisplayConfigState.setPendingChange(root.outputName, "vrr", value !== off);
|
||||
DisplayConfigState.setHyprlandSetting(root.outputData, root.outputName, "vrrFullscreenOnly", value === fullscreen || null);
|
||||
}
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
width: parent.width
|
||||
text: I18n.tr("Variable Refresh Rate")
|
||||
addHorizontalPadding: true
|
||||
visible: root.isConnected && CompositorService.isNiri && (DisplayConfigState.outputs[root.outputName]?.vrr_supported ?? false)
|
||||
checked: DisplayConfigState.getNiriSetting(root.outputData, root.outputName, "vrrOnDemand", false)
|
||||
onToggled: checked => DisplayConfigState.setNiriSetting(root.outputData, root.outputName, "vrrOnDemand", checked)
|
||||
options: [I18n.tr("Off"), I18n.tr("On"), I18n.tr("On-Demand")]
|
||||
currentValue: {
|
||||
DisplayConfigState.pendingNiriChanges;
|
||||
if (DisplayConfigState.getNiriSetting(root.outputData, root.outputName, "vrrOnDemand", false))
|
||||
return I18n.tr("On-Demand");
|
||||
const pendingVrr = DisplayConfigState.getPendingValue(root.outputName, "vrr");
|
||||
const vrrEnabled = pendingVrr !== undefined ? pendingVrr : (DisplayConfigState.outputs[root.outputName]?.vrr_enabled ?? false);
|
||||
if (!vrrEnabled)
|
||||
return I18n.tr("Off");
|
||||
return I18n.tr("On");
|
||||
}
|
||||
onValueChanged: value => {
|
||||
const off = I18n.tr("Off");
|
||||
const onDemand = I18n.tr("On-Demand");
|
||||
DisplayConfigState.setPendingChange(root.outputName, "vrr", value !== off);
|
||||
DisplayConfigState.setNiriSetting(root.outputData, root.outputName, "vrrOnDemand", value === onDemand || null);
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
||||
Reference in New Issue
Block a user