mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
fix problem with Airplane Mode toggle visibility & add some default values for the Color Scheme settings
This commit is contained in:
@@ -122,10 +122,11 @@ ColumnLayout {
|
|||||||
label: I18n.tr("panels.color-scheme.sync-gsettings-label")
|
label: I18n.tr("panels.color-scheme.sync-gsettings-label")
|
||||||
description: I18n.tr("panels.color-scheme.sync-gsettings-description")
|
description: I18n.tr("panels.color-scheme.sync-gsettings-description")
|
||||||
checked: Settings.data.colorSchemes.syncGsettings
|
checked: Settings.data.colorSchemes.syncGsettings
|
||||||
|
defaultValue: Settings.getDefaultValue("colorSchemes.syncGsettings")
|
||||||
onToggled: checked => {
|
onToggled: checked => {
|
||||||
Settings.data.colorSchemes.syncGsettings = checked;
|
Settings.data.colorSchemes.syncGsettings = checked;
|
||||||
if (checked)
|
if (checked)
|
||||||
ColorSchemeService.pushSystemColorScheme();
|
ColorSchemeService.pushSystemColorScheme(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,6 +150,7 @@ ColumnLayout {
|
|||||||
]
|
]
|
||||||
|
|
||||||
currentKey: Settings.data.colorSchemes.schedulingMode
|
currentKey: Settings.data.colorSchemes.schedulingMode
|
||||||
|
defaultValue: Settings.getDefaultValue("colorSchemes.schedulingMode")
|
||||||
|
|
||||||
onSelected: key => {
|
onSelected: key => {
|
||||||
Settings.data.colorSchemes.schedulingMode = key;
|
Settings.data.colorSchemes.schedulingMode = key;
|
||||||
@@ -211,6 +213,7 @@ ColumnLayout {
|
|||||||
label: I18n.tr("panels.color-scheme.color-source-use-wallpaper-colors-label")
|
label: I18n.tr("panels.color-scheme.color-source-use-wallpaper-colors-label")
|
||||||
description: I18n.tr("panels.color-scheme.color-source-use-wallpaper-colors-description")
|
description: I18n.tr("panels.color-scheme.color-source-use-wallpaper-colors-description")
|
||||||
checked: Settings.data.colorSchemes.useWallpaperColors
|
checked: Settings.data.colorSchemes.useWallpaperColors
|
||||||
|
defaultValue: Settings.getDefaultValue("colorSchemes.useWallpaperColors")
|
||||||
onToggled: checked => {
|
onToggled: checked => {
|
||||||
Settings.data.colorSchemes.useWallpaperColors = checked;
|
Settings.data.colorSchemes.useWallpaperColors = checked;
|
||||||
if (checked) {
|
if (checked) {
|
||||||
@@ -249,7 +252,6 @@ ColumnLayout {
|
|||||||
Settings.data.colorSchemes.monitorForColors = key;
|
Settings.data.colorSchemes.monitorForColors = key;
|
||||||
AppThemeService.generate();
|
AppThemeService.generate();
|
||||||
}
|
}
|
||||||
defaultValue: ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NComboBox {
|
NComboBox {
|
||||||
|
|||||||
@@ -148,8 +148,8 @@ Item {
|
|||||||
label: I18n.tr("common.wifi")
|
label: I18n.tr("common.wifi")
|
||||||
icon: NetworkService.wifiEnabled ? "wifi" : "wifi-off"
|
icon: NetworkService.wifiEnabled ? "wifi" : "wifi-off"
|
||||||
checked: NetworkService.wifiEnabled
|
checked: NetworkService.wifiEnabled
|
||||||
onToggled: checked => NetworkService.setWifiEnabled(checked)
|
|
||||||
enabled: !NetworkService.airplaneModeEnabled && NetworkService.wifiAvailable
|
enabled: !NetworkService.airplaneModeEnabled && NetworkService.wifiAvailable
|
||||||
|
onToggled: checked => NetworkService.setWifiEnabled(checked)
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,7 +324,7 @@ Item {
|
|||||||
// Airplane Mode
|
// Airplane Mode
|
||||||
NBox {
|
NBox {
|
||||||
id: miscSettingsBox
|
id: miscSettingsBox
|
||||||
visible: !root.showOnlyLists && miscSettingsCol.visibleChildren.length > 0
|
visible: !root.showOnlyLists && NetworkService.wifiAvailable && BluetoothService.bluetoothAvailable
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: miscSettingsCol.implicitHeight + Style.margin2XL
|
Layout.preferredHeight: miscSettingsCol.implicitHeight + Style.margin2XL
|
||||||
color: Color.mSurface
|
color: Color.mSurface
|
||||||
|
|||||||
@@ -298,8 +298,8 @@ SmartPanel {
|
|||||||
|
|
||||||
NIconButton {
|
NIconButton {
|
||||||
visible: Settings.data.wallpaper.enabled
|
visible: Settings.data.wallpaper.enabled
|
||||||
icon: "sun"
|
icon: "dark-mode"
|
||||||
tooltipText: Settings.data.wallpaper.linkLightAndDarkWallpapers ? I18n.tr("wallpaper.panel.header-sun-linked-tooltip") : I18n.tr("wallpaper.panel.header-sun-separate-tooltip")
|
tooltipText: Settings.data.wallpaper.linkLightAndDarkWallpapers ? I18n.tr("wallpaper.panel.header-separate-light-dark-tooltip") : I18n.tr("wallpaper.panel.header-link-light-dark-tooltip")
|
||||||
baseSize: Style.baseWidgetSize * 0.8
|
baseSize: Style.baseWidgetSize * 0.8
|
||||||
colorBg: !Settings.data.wallpaper.linkLightAndDarkWallpapers ? Color.mPrimary : Color.smartAlpha(Color.mSurfaceVariant)
|
colorBg: !Settings.data.wallpaper.linkLightAndDarkWallpapers ? Color.mPrimary : Color.smartAlpha(Color.mSurfaceVariant)
|
||||||
colorFg: !Settings.data.wallpaper.linkLightAndDarkWallpapers ? Color.mOnPrimary : Color.mPrimary
|
colorFg: !Settings.data.wallpaper.linkLightAndDarkWallpapers ? Color.mOnPrimary : Color.mPrimary
|
||||||
|
|||||||
@@ -71,11 +71,10 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle system wakeup to force-poll and ensure state is up-to-date
|
// Handle potential case where Quickshell doesnt't properly update adapter after system wakeup
|
||||||
Connections {
|
Connections {
|
||||||
target: Time
|
target: Time
|
||||||
function onResumed() {
|
function onResumed() {
|
||||||
Logger.i("Bluetooth", "System resumed - forcing state poll");
|
|
||||||
ctlPollTimer.restart();
|
ctlPollTimer.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,7 +89,7 @@ Singleton {
|
|||||||
checkAirplaneMode();
|
checkAirplaneMode();
|
||||||
}
|
}
|
||||||
function onEnabledChanged() {
|
function onEnabledChanged() {
|
||||||
if (adapter && adapter.enabled && Settings.data.network.bluetoothAutoConnect) {
|
if (adapter?.enabled && Settings.data.network.bluetoothAutoConnect) {
|
||||||
autoConnectTimer.restart();
|
autoConnectTimer.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,7 +98,7 @@ Singleton {
|
|||||||
Connections {
|
Connections {
|
||||||
target: Settings.data.network
|
target: Settings.data.network
|
||||||
function onBluetoothAutoConnectChanged() {
|
function onBluetoothAutoConnectChanged() {
|
||||||
if (Settings.data.network.bluetoothAutoConnect && adapter && adapter.enabled) {
|
if (Settings.data.network.bluetoothAutoConnect && adapter?.enabled) {
|
||||||
autoConnectTimer.restart();
|
autoConnectTimer.restart();
|
||||||
} else {
|
} else {
|
||||||
autoConnectTimer.stop();
|
autoConnectTimer.stop();
|
||||||
@@ -137,7 +136,7 @@ Singleton {
|
|||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: ctlPollTimer
|
id: ctlPollTimer
|
||||||
interval: 250
|
interval: 2000
|
||||||
running: false
|
running: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (!adapter || !ProgramCheckerService.bluetoothctlAvailable) {
|
if (!adapter || !ProgramCheckerService.bluetoothctlAvailable) {
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ Singleton {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
Logger.i("Network", "Service started");
|
Logger.i("Network", "Service started");
|
||||||
wifiInitTimer.running = true;
|
wifiInitTimer.restart();
|
||||||
|
|
||||||
// Ensure initial detection if nmcli is already available at startup
|
// Ensure initial detection if nmcli is already available at startup
|
||||||
if (ProgramCheckerService.nmcliAvailable) {
|
if (ProgramCheckerService.nmcliAvailable) {
|
||||||
@@ -155,23 +155,6 @@ Singleton {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var isAirplaneModeActive = !root.wifiEnabled && BluetoothService.blocked;
|
|
||||||
// Extra check for Airplane Mode if Bluetooth has been blocked before Wi-Fi
|
|
||||||
if (isAirplaneModeActive && !root.airplaneModeEnabled) {
|
|
||||||
root.airplaneModeEnabled = true;
|
|
||||||
ToastService.showNotice(I18n.tr("toast.airplane-mode.title"), I18n.tr("common.enabled"), "plane");
|
|
||||||
Logger.i("AirplaneMode", "Enabled");
|
|
||||||
root.networks = ({});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Extra check for Airplane Mode if Wi-Fi has been unblocked before Bluetooth
|
|
||||||
if (!isAirplaneModeActive && root.airplaneModeEnabled) {
|
|
||||||
root.airplaneModeEnabled = false;
|
|
||||||
ToastService.showNotice(I18n.tr("toast.airplane-mode.title"), I18n.tr("common.disabled"), "plane-off");
|
|
||||||
Logger.i("AirplaneMode", "Disabled");
|
|
||||||
scan();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (root.wifiEnabled) {
|
if (root.wifiEnabled) {
|
||||||
ToastService.showNotice(I18n.tr("common.wifi"), I18n.tr("common.enabled"), "wifi");
|
ToastService.showNotice(I18n.tr("common.wifi"), I18n.tr("common.enabled"), "wifi");
|
||||||
scan();
|
scan();
|
||||||
|
|||||||
Reference in New Issue
Block a user