From 0f11296ee1d538a42332119ae90af0dd89cdf50f Mon Sep 17 00:00:00 2001
From: end-4 <97237370+end-4@users.noreply.github.com>
Date: Sat, 22 Nov 2025 23:33:26 +0100
Subject: [PATCH] wactioncenter: night light page
---
.../ii/assets/icons/fluent/auto-filled.svg | 41 +++++
.../ii/assets/icons/fluent/auto.svg | 41 +++++
.../icons/fluent/temperature-filled.svg | 1 +
.../ii/assets/icons/fluent/temperature.svg | 1 +
.../modules/ii/overlay/recorder/Recorder.qml | 2 +-
.../waffle/actionCenter/ToggleItem.qml | 94 +++++++++++
.../bluetooth/BluetoothControl.qml | 4 +-
.../bluetooth/BluetoothDeviceItem.qml | 6 +-
.../nightLight/NightLightControl.qml | 157 ++++++++++++++++++
.../ActionCenterTogglesDelegateChooser.qml | 7 +
.../volumeControl/VolumeControl.qml | 10 +-
.../waffle/actionCenter/wifi/WifiControl.qml | 4 +-
.../waffle/bar/tasks/TaskAppButton.qml | 4 +-
.../ii/modules/waffle/bar/tray/Tray.qml | 2 +-
.../ii/modules/waffle/looks/WSwitch.qml | 3 -
15 files changed, 356 insertions(+), 21 deletions(-)
create mode 100644 dots/.config/quickshell/ii/assets/icons/fluent/auto-filled.svg
create mode 100644 dots/.config/quickshell/ii/assets/icons/fluent/auto.svg
create mode 100644 dots/.config/quickshell/ii/assets/icons/fluent/temperature-filled.svg
create mode 100644 dots/.config/quickshell/ii/assets/icons/fluent/temperature.svg
create mode 100644 dots/.config/quickshell/ii/modules/waffle/actionCenter/ToggleItem.qml
create mode 100644 dots/.config/quickshell/ii/modules/waffle/actionCenter/nightLight/NightLightControl.qml
diff --git a/dots/.config/quickshell/ii/assets/icons/fluent/auto-filled.svg b/dots/.config/quickshell/ii/assets/icons/fluent/auto-filled.svg
new file mode 100644
index 000000000..5731bee79
--- /dev/null
+++ b/dots/.config/quickshell/ii/assets/icons/fluent/auto-filled.svg
@@ -0,0 +1,41 @@
+
+
diff --git a/dots/.config/quickshell/ii/assets/icons/fluent/auto.svg b/dots/.config/quickshell/ii/assets/icons/fluent/auto.svg
new file mode 100644
index 000000000..d81b45544
--- /dev/null
+++ b/dots/.config/quickshell/ii/assets/icons/fluent/auto.svg
@@ -0,0 +1,41 @@
+
+
diff --git a/dots/.config/quickshell/ii/assets/icons/fluent/temperature-filled.svg b/dots/.config/quickshell/ii/assets/icons/fluent/temperature-filled.svg
new file mode 100644
index 000000000..5c63cf5d2
--- /dev/null
+++ b/dots/.config/quickshell/ii/assets/icons/fluent/temperature-filled.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/dots/.config/quickshell/ii/assets/icons/fluent/temperature.svg b/dots/.config/quickshell/ii/assets/icons/fluent/temperature.svg
new file mode 100644
index 000000000..bc24e92cc
--- /dev/null
+++ b/dots/.config/quickshell/ii/assets/icons/fluent/temperature.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/dots/.config/quickshell/ii/modules/ii/overlay/recorder/Recorder.qml b/dots/.config/quickshell/ii/modules/ii/overlay/recorder/Recorder.qml
index 2c70b312e..9efa37e60 100644
--- a/dots/.config/quickshell/ii/modules/ii/overlay/recorder/Recorder.qml
+++ b/dots/.config/quickshell/ii/modules/ii/overlay/recorder/Recorder.qml
@@ -83,7 +83,7 @@ StyledOverlayWidget {
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
- text: qsTr("Open recordings folder")
+ text: Translation.tr("Open recordings folder")
}
}
}
diff --git a/dots/.config/quickshell/ii/modules/waffle/actionCenter/ToggleItem.qml b/dots/.config/quickshell/ii/modules/waffle/actionCenter/ToggleItem.qml
new file mode 100644
index 000000000..68ecfdcf6
--- /dev/null
+++ b/dots/.config/quickshell/ii/modules/waffle/actionCenter/ToggleItem.qml
@@ -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
+ }
+ }
+ }
+}
diff --git a/dots/.config/quickshell/ii/modules/waffle/actionCenter/bluetooth/BluetoothControl.qml b/dots/.config/quickshell/ii/modules/waffle/actionCenter/bluetooth/BluetoothControl.qml
index e3d62cd99..c8d3a036a 100644
--- a/dots/.config/quickshell/ii/modules/waffle/actionCenter/bluetooth/BluetoothControl.qml
+++ b/dots/.config/quickshell/ii/modules/waffle/actionCenter/bluetooth/BluetoothControl.qml
@@ -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]);
diff --git a/dots/.config/quickshell/ii/modules/waffle/actionCenter/bluetooth/BluetoothDeviceItem.qml b/dots/.config/quickshell/ii/modules/waffle/actionCenter/bluetooth/BluetoothDeviceItem.qml
index ff672dde9..73d7bee83 100644
--- a/dots/.config/quickshell/ii/modules/waffle/actionCenter/bluetooth/BluetoothDeviceItem.qml
+++ b/dots/.config/quickshell/ii/modules/waffle/actionCenter/bluetooth/BluetoothDeviceItem.qml
@@ -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
diff --git a/dots/.config/quickshell/ii/modules/waffle/actionCenter/nightLight/NightLightControl.qml b/dots/.config/quickshell/ii/modules/waffle/actionCenter/nightLight/NightLightControl.qml
new file mode 100644
index 000000000..45ba6bba2
--- /dev/null
+++ b/dots/.config/quickshell/ii/modules/waffle/actionCenter/nightLight/NightLightControl.qml
@@ -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)
+ }
+ }
+ }
+}
diff --git a/dots/.config/quickshell/ii/modules/waffle/actionCenter/toggles/ActionCenterTogglesDelegateChooser.qml b/dots/.config/quickshell/ii/modules/waffle/actionCenter/toggles/ActionCenterTogglesDelegateChooser.qml
index a27c8bf84..d02006998 100644
--- a/dots/.config/quickshell/ii/modules/waffle/actionCenter/toggles/ActionCenterTogglesDelegateChooser.qml
+++ b/dots/.config/quickshell/ii/modules/waffle/actionCenter/toggles/ActionCenterTogglesDelegateChooser.qml
@@ -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 {
diff --git a/dots/.config/quickshell/ii/modules/waffle/actionCenter/volumeControl/VolumeControl.qml b/dots/.config/quickshell/ii/modules/waffle/actionCenter/volumeControl/VolumeControl.qml
index 5658a4f26..b3e97a78e 100644
--- a/dots/.config/quickshell/ii/modules/waffle/actionCenter/volumeControl/VolumeControl.qml
+++ b/dots/.config/quickshell/ii/modules/waffle/actionCenter/volumeControl/VolumeControl.qml
@@ -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 {
diff --git a/dots/.config/quickshell/ii/modules/waffle/actionCenter/wifi/WifiControl.qml b/dots/.config/quickshell/ii/modules/waffle/actionCenter/wifi/WifiControl.qml
index 705e03f6d..6f07462be 100644
--- a/dots/.config/quickshell/ii/modules/waffle/actionCenter/wifi/WifiControl.qml
+++ b/dots/.config/quickshell/ii/modules/waffle/actionCenter/wifi/WifiControl.qml
@@ -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]);
diff --git a/dots/.config/quickshell/ii/modules/waffle/bar/tasks/TaskAppButton.qml b/dots/.config/quickshell/ii/modules/waffle/bar/tasks/TaskAppButton.qml
index 9f3610fb3..51e6b61a1 100644
--- a/dots/.config/quickshell/ii/modules/waffle/bar/tasks/TaskAppButton.qml
+++ b/dots/.config/quickshell/ii/modules/waffle/bar/tasks/TaskAppButton.qml
@@ -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();
diff --git a/dots/.config/quickshell/ii/modules/waffle/bar/tray/Tray.qml b/dots/.config/quickshell/ii/modules/waffle/bar/tray/Tray.qml
index db021b032..cb13720dc 100644
--- a/dots/.config/quickshell/ii/modules/waffle/bar/tray/Tray.qml
+++ b/dots/.config/quickshell/ii/modules/waffle/bar/tray/Tray.qml
@@ -44,7 +44,7 @@ RowLayout {
BarToolTip {
extraVisibleCondition: overflowButton.shouldShowTooltip
- text: qsTr("Show hidden icons")
+ text: Translation.tr("Show hidden icons")
}
DropArea {
diff --git a/dots/.config/quickshell/ii/modules/waffle/looks/WSwitch.qml b/dots/.config/quickshell/ii/modules/waffle/looks/WSwitch.qml
index 369ae5f12..005f2cc45 100644
--- a/dots/.config/quickshell/ii/modules/waffle/looks/WSwitch.qml
+++ b/dots/.config/quickshell/ii/modules/waffle/looks/WSwitch.qml
@@ -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