wactioncenter: night light page

This commit is contained in:
end-4
2025-11-22 23:33:26 +01:00
parent 9a113c24ca
commit 0f11296ee1
15 changed files with 356 additions and 21 deletions
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="24"
height="24"
fill="none"
viewBox="0 0 24 24"
version="1.1"
id="svg1"
sodipodi:docname="local-language-filled.svg"
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="10.960155"
inkscape:cx="14.187755"
inkscape:cy="14.005276"
inkscape:window-width="1732"
inkscape:window-height="785"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg1" />
<path
d="m 13.32921,3.2052869 0.07034,0.146958 6.665865,16.3349501 c 0.597934,1.463734 -1.501548,2.465708 -2.263405,1.080204 l -0.0628,-0.131886 -1.734607,-4.247966 H 8.1090597 L 6.237543,20.666915 c -0.2557499,0.58358 -0.907936,0.883219 -1.5173101,0.697108 L 4.5820672,21.313781 C 3.9979955,21.058486 3.6977604,20.406177 3.8837026,19.796471 L 3.9339447,19.658305 11.087158,3.3246118 C 11.509191,2.3574521 12.838094,2.3260509 13.330466,3.2065429 Z M 12.194996,7.0513164 9.2081047,13.875444 h 5.7715573 z"
fill="#212121"
id="path1"
sodipodi:nodetypes="ccccccccccccccccccc"
style="stroke-width:1.25605" />
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="24"
height="24"
fill="none"
viewBox="0 0 24 24"
version="1.1"
id="svg1"
sodipodi:docname="local-language.svg"
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="10.960155"
inkscape:cx="10.811891"
inkscape:cy="17.791719"
inkscape:window-width="1472"
inkscape:window-height="618"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg1" />
<path
d="m 13.03806,2.5424973 0.06199,0.1301862 6.893673,17.9781035 c 0.18389,0.475477 -0.0465,1.01068 -0.518262,1.203913 -0.426384,0.16782 -0.910921,-0.0095 -1.128281,-0.412876 l -0.05331,-0.114068 -1.776733,-4.633392 H 7.7314203 l -0.1165477,-0.0074 -1.9168378,4.661908 C 5.509706,21.819931 4.9710435,22.044234 4.5040408,21.84606 4.0807398,21.661297 3.8558061,21.1951 3.9746166,20.748776 L 4.0155326,20.629748 11.410113,2.6516447 C 11.691767,1.9454102 12.665957,1.8801443 13.0393,2.5424973 Z M 12.38093,5.4884265 8.4629432,14.834561 H 16.038544 L 12.38093,5.4871866 Z"
fill="#212121"
id="path1"
style="stroke-width:1.23987"
sodipodi:nodetypes="ccccccccccccccccccccc" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

@@ -0,0 +1 @@
<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 2a4 4 0 0 1 3.995 3.8L16 6l.001 6.728.055.058a5.482 5.482 0 0 1 1.416 3.16l.021.276.007.278a5.5 5.5 0 1 1-9.734-3.511l.179-.205.054-.057L8 6a4 4 0 0 1 3.597-3.98l.203-.015L12 2Zm0 2a2 2 0 0 0-1.995 1.85L10 6v7.593l-.333.298a3.5 3.5 0 1 0 4.82.146l-.153-.145-.333-.298L14 6a2 2 0 0 0-2-2Zm0 4a1 1 0 0 1 1 1v5.208a2.5 2.5 0 1 1-2 0V9a1 1 0 0 1 1-1Z" fill="#212121"/></svg>

After

Width:  |  Height:  |  Size: 478 B

@@ -0,0 +1 @@
<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 2a3.25 3.25 0 0 1 3.245 3.065l.005.185.001 7.952.08.069a4.99 4.99 0 0 1 1.644 3.223l.019.252L17 17a5 5 0 1 1-8.51-3.56l.18-.17.079-.068.001-7.952a3.25 3.25 0 0 1 2.884-3.23l.182-.015L12 2Zm0 1.5a1.75 1.75 0 0 0-1.744 1.607l-.006.143v8.694l-.309.225a3.5 3.5 0 1 0 4.283.128l-.165-.127-.307-.225-.002-8.695A1.75 1.75 0 0 0 12 3.5ZM12 8a.75.75 0 0 1 .75.75v5.865a2.501 2.501 0 1 1-1.5 0V8.75A.75.75 0 0 1 12 8Z" fill="#212121"/></svg>

After

Width:  |  Height:  |  Size: 539 B

@@ -83,7 +83,7 @@ StyledOverlayWidget {
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: qsTr("Open recordings folder")
text: Translation.tr("Open recordings folder")
}
}
}
@@ -0,0 +1,94 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import Quickshell.Services.Pipewire
import qs
import qs.services
import qs.modules.common
import qs.modules.common.functions
import qs.modules.common.widgets
import qs.modules.waffle.looks
import qs.modules.waffle.actionCenter
RowLayout {
id: root
required property string name
property alias description: descriptionText.text
property alias iconName: iconWidget.icon
property alias checked: switchWidget.checked
spacing: 10
FluentIcon {
id: iconWidget
visible: !!root.iconName
Layout.leftMargin: 12
Layout.topMargin: 4
Layout.bottomMargin: 4
Layout.alignment: Qt.AlignTop
icon: root.iconName
implicitSize: 18
}
ColumnLayout {
Layout.topMargin: 4
Layout.bottomMargin: 4
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
spacing: 1
// Name
WText {
Layout.fillWidth: true
elide: Text.ElideRight
font.pixelSize: Looks.font.pixelSize.large
text: root.name
}
// Description
WText {
id: descriptionText
Layout.fillWidth: true
wrapMode: Text.Wrap
color: Looks.colors.subfg
}
}
MouseArea {
Layout.rightMargin: 12
implicitWidth: switchRow.implicitWidth
implicitHeight: switchRow.implicitHeight
onPressed: switchWidget.down = true
onReleased: switchWidget.down = false
onClicked: switchWidget.checked = !switchWidget.checked
Row {
id: switchRow
spacing: 12
Item {
implicitWidth: onOffTextMetrics.width
implicitHeight: onOffTextMetrics.height
TextMetrics {
id: onOffTextMetrics
text: "Off" // The larger one
font {
family: Looks.font.family.ui
pixelSize: Looks.font.pixelSize.large
weight: Looks.font.weight.regular
}
}
WText {
anchors.centerIn: parent
text: switchWidget.checked ? Translation.tr("On") : Translation.tr("Off")
font.pixelSize: Looks.font.pixelSize.large
}
}
WSwitch {
id: switchWidget
Layout.alignment: Qt.AlignVCenter
}
}
}
}
@@ -45,7 +45,7 @@ Item {
HeaderRow {
id: headerRow
Layout.fillWidth: true
title: qsTr("Bluetooth")
title: Translation.tr("Bluetooth")
}
WSwitch {
id: toggleSwitch
@@ -104,7 +104,7 @@ Item {
verticalCenter: parent.verticalCenter
left: parent.left
}
text: qsTr("More Bluetooth settings")
text: Translation.tr("More Bluetooth settings")
onClicked: {
Quickshell.execDetached(["qs", "-p", Quickshell.shellPath(""), "ipc", "call", "sidebarLeft", "toggle"]);
Quickshell.execDetached(["bash", "-c", Config.options.apps.bluetooth]);
@@ -33,11 +33,7 @@ ExpandableChoiceButton {
Layout.bottomMargin: 4
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
spacing: 1
Behavior on Layout.topMargin {
animation: Looks.transition.move.createObject(this)
}
spacing: 0
WText {
// Network name
@@ -0,0 +1,157 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import Quickshell
import Quickshell.Bluetooth
import qs
import qs.services
import qs.services.network
import qs.modules.common
import qs.modules.common.functions
import qs.modules.common.widgets
import qs.modules.waffle.looks
import qs.modules.waffle.actionCenter
Item {
id: root
Component.onCompleted: {
if (Bluetooth.defaultAdapter.enabled)
Bluetooth.defaultAdapter.discovering = true;
}
Component.onDestruction: {
Bluetooth.defaultAdapter.discovering = false;
}
PageColumn {
anchors.fill: parent
BodyRectangle {
implicitHeight: 400
implicitWidth: 50
ColumnLayout {
anchors.fill: parent
anchors.margins: 4
spacing: 4
HeaderRow {
id: headerRow
Layout.fillWidth: true
title: Translation.tr("Eye protection")
}
StyledFlickable {
id: flickable
Layout.fillHeight: true
Layout.fillWidth: true
contentHeight: contentLayout.implicitHeight
contentWidth: width
clip: true
bottomMargin: 12
NightLightOptions {
id: contentLayout
width: flickable.width
}
}
}
}
Separator {}
FooterRectangle {}
}
component NightLightOptions: ColumnLayout {
spacing: 10
SectionText {
text: Translation.tr("Night Light")
}
ToggleItem {
name: Translation.tr("Automatic")
description: Translation.tr("Turn on from sunset to sunrise")
iconName: "auto"
checked: Config.options.light.night.automatic
onCheckedChanged: {
Config.options.light.night.automatic = checked;
}
}
ToggleItem {
name: Translation.tr("Enable")
description: Translation.tr("More comfortable viewing at night")
iconName: WIcons.nightLightIcon
checked: Hyprsunset.active
onCheckedChanged: {
Hyprsunset.toggle(checked);
}
}
IntensityEntry {
Layout.fillWidth: true
}
SectionText {
text: Translation.tr("Anti-flashbang (experimental)")
}
ToggleItem {
name: Translation.tr("Enable")
description: Translation.tr("Balance brightness based on content")
iconName: "flash-off"
checked: Config.options.light.antiFlashbang.enable
onCheckedChanged: {
Config.options.light.antiFlashbang.enable = checked;
}
}
}
component IntensityEntry: RowLayout {
spacing: 10
FluentIcon {
id: iconWidget
Layout.leftMargin: 12
Layout.topMargin: 4
Layout.bottomMargin: 4
Layout.alignment: Qt.AlignTop
icon: "temperature"
implicitSize: 18
}
ColumnLayout {
Layout.fillWidth: true
// Layout.leftMargin: 40
Layout.rightMargin: 12
spacing: 4
ColumnLayout {
Layout.fillWidth: true
spacing: 0
WText {
Layout.fillWidth: true
text: Translation.tr("Intensity")
font.pixelSize: Looks.font.pixelSize.large
}
WText {
Layout.fillWidth: true
text: Translation.tr("Adjust the color temperature")
color: Looks.colors.subfg
}
}
WSlider {
Layout.fillWidth: true
from: 6500
to: 1200
value: Config.options.light.night.colorTemperature
onMoved: Config.options.light.night.colorTemperature = value
tooltipContent: Math.round((value - from) / (to - from) * 100)
}
}
}
}
@@ -10,6 +10,7 @@ import qs.modules.common.models.quickToggles
import qs.modules.common.widgets
import qs.modules.waffle.looks
import qs.modules.waffle.actionCenter.bluetooth
import qs.modules.waffle.actionCenter.nightLight
import qs.modules.waffle.actionCenter.volumeControl
import qs.modules.waffle.actionCenter.wifi
@@ -23,6 +24,9 @@ DelegateChooser {
ActionCenterToggleButton {
toggleModel: AntiFlashbangToggle {}
icon: "flash-off"
menu: Component {
NightLightControl {}
}
}
}
DelegateChoice {
@@ -113,6 +117,9 @@ DelegateChooser {
ActionCenterToggleButton {
toggleModel: NightLightToggle {}
icon: WIcons.nightLightIcon
menu: Component {
NightLightControl {}
}
}
}
DelegateChoice {
@@ -28,7 +28,7 @@ Item {
HeaderRow {
Layout.fillWidth: true
title: root.output ? qsTr("Sound output") : qsTr("Sound input")
title: root.output ? Translation.tr("Sound output") : Translation.tr("Sound input")
}
StyledFlickable {
@@ -72,7 +72,7 @@ Item {
WText {
id: buttonText
anchors.centerIn: parent
text: qsTr("More volume settings")
text: Translation.tr("More volume settings")
color: moreSettingsButton.pressed ? Looks.colors.fg : Looks.colors.fg1
}
}
@@ -84,7 +84,7 @@ Item {
spacing: 4
SectionText {
text: root.output ? qsTr("Output device") : qsTr("Input device")
text: root.output ? Translation.tr("Output device") : Translation.tr("Input device")
}
Repeater {
@@ -112,7 +112,7 @@ Item {
SectionText {
visible: EasyEffects.available && root.output
text: qsTr("Sound effects")
text: Translation.tr("Sound effects")
}
WChoiceButton {
@@ -137,7 +137,7 @@ Item {
SectionText {
visible: EasyEffects.available
text: qsTr("Volume mixer")
text: Translation.tr("Volume mixer")
}
VolumeEntry {
@@ -41,7 +41,7 @@ Item {
HeaderRow {
id: headerRow
Layout.fillWidth: true
title: qsTr("Wi-Fi")
title: Translation.tr("Wi-Fi")
}
WSwitch {
id: toggleSwitch
@@ -94,7 +94,7 @@ Item {
verticalCenter: parent.verticalCenter
left: parent.left
}
text: qsTr("More Internet settings")
text: Translation.tr("More Internet settings")
onClicked: {
Quickshell.execDetached(["qs", "-p", Quickshell.shellPath(""), "ipc", "call", "sidebarLeft", "toggle"]);
Quickshell.execDetached(["bash", "-c", Config.options.apps.network]);
@@ -107,14 +107,14 @@ AppButton {
},
{
iconName: root.appEntry.pinned ? "pin-off" : "pin",
text: root.appEntry.pinned ? qsTr("Unpin from taskbar") : qsTr("Pin to taskbar"),
text: root.appEntry.pinned ? Translation.tr("Unpin from taskbar") : Translation.tr("Pin to taskbar"),
action: () => {
TaskbarApps.togglePin(root.appEntry.appId);
}
},
...(root.appEntry.toplevels.length > 0 ? [{
iconName: "dismiss",
text: root.multiple ? qsTr("Close all windows") : qsTr("Close window"),
text: root.multiple ? Translation.tr("Close all windows") : Translation.tr("Close window"),
action: () => {
for (let toplevel of root.appEntry.toplevels) {
toplevel.close();
@@ -44,7 +44,7 @@ RowLayout {
BarToolTip {
extraVisibleCondition: overflowButton.shouldShowTooltip
text: qsTr("Show hidden icons")
text: Translation.tr("Show hidden icons")
}
DropArea {
@@ -2,13 +2,10 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import qs.modules.common
import qs.modules.common.widgets
import qs.modules.waffle.looks
Switch {
id: root
PointingHandInteraction {}
implicitWidth: 40
implicitHeight: 20