forked from Shinonome/dots-hyprland
wactioncenter: night light page
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -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]);
|
||||
|
||||
+1
-5
@@ -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
|
||||
|
||||
+157
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -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 {
|
||||
|
||||
+5
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user