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")
|
||||
description: I18n.tr("panels.color-scheme.sync-gsettings-description")
|
||||
checked: Settings.data.colorSchemes.syncGsettings
|
||||
defaultValue: Settings.getDefaultValue("colorSchemes.syncGsettings")
|
||||
onToggled: checked => {
|
||||
Settings.data.colorSchemes.syncGsettings = checked;
|
||||
if (checked)
|
||||
ColorSchemeService.pushSystemColorScheme();
|
||||
ColorSchemeService.pushSystemColorScheme(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +150,7 @@ ColumnLayout {
|
||||
]
|
||||
|
||||
currentKey: Settings.data.colorSchemes.schedulingMode
|
||||
defaultValue: Settings.getDefaultValue("colorSchemes.schedulingMode")
|
||||
|
||||
onSelected: key => {
|
||||
Settings.data.colorSchemes.schedulingMode = key;
|
||||
@@ -211,6 +213,7 @@ ColumnLayout {
|
||||
label: I18n.tr("panels.color-scheme.color-source-use-wallpaper-colors-label")
|
||||
description: I18n.tr("panels.color-scheme.color-source-use-wallpaper-colors-description")
|
||||
checked: Settings.data.colorSchemes.useWallpaperColors
|
||||
defaultValue: Settings.getDefaultValue("colorSchemes.useWallpaperColors")
|
||||
onToggled: checked => {
|
||||
Settings.data.colorSchemes.useWallpaperColors = checked;
|
||||
if (checked) {
|
||||
@@ -249,7 +252,6 @@ ColumnLayout {
|
||||
Settings.data.colorSchemes.monitorForColors = key;
|
||||
AppThemeService.generate();
|
||||
}
|
||||
defaultValue: ""
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
|
||||
@@ -148,8 +148,8 @@ Item {
|
||||
label: I18n.tr("common.wifi")
|
||||
icon: NetworkService.wifiEnabled ? "wifi" : "wifi-off"
|
||||
checked: NetworkService.wifiEnabled
|
||||
onToggled: checked => NetworkService.setWifiEnabled(checked)
|
||||
enabled: !NetworkService.airplaneModeEnabled && NetworkService.wifiAvailable
|
||||
onToggled: checked => NetworkService.setWifiEnabled(checked)
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
}
|
||||
@@ -324,7 +324,7 @@ Item {
|
||||
// Airplane Mode
|
||||
NBox {
|
||||
id: miscSettingsBox
|
||||
visible: !root.showOnlyLists && miscSettingsCol.visibleChildren.length > 0
|
||||
visible: !root.showOnlyLists && NetworkService.wifiAvailable && BluetoothService.bluetoothAvailable
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: miscSettingsCol.implicitHeight + Style.margin2XL
|
||||
color: Color.mSurface
|
||||
|
||||
@@ -298,8 +298,8 @@ SmartPanel {
|
||||
|
||||
NIconButton {
|
||||
visible: Settings.data.wallpaper.enabled
|
||||
icon: "sun"
|
||||
tooltipText: Settings.data.wallpaper.linkLightAndDarkWallpapers ? I18n.tr("wallpaper.panel.header-sun-linked-tooltip") : I18n.tr("wallpaper.panel.header-sun-separate-tooltip")
|
||||
icon: "dark-mode"
|
||||
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
|
||||
colorBg: !Settings.data.wallpaper.linkLightAndDarkWallpapers ? Color.mPrimary : Color.smartAlpha(Color.mSurfaceVariant)
|
||||
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 {
|
||||
target: Time
|
||||
function onResumed() {
|
||||
Logger.i("Bluetooth", "System resumed - forcing state poll");
|
||||
ctlPollTimer.restart();
|
||||
}
|
||||
}
|
||||
@@ -90,7 +89,7 @@ Singleton {
|
||||
checkAirplaneMode();
|
||||
}
|
||||
function onEnabledChanged() {
|
||||
if (adapter && adapter.enabled && Settings.data.network.bluetoothAutoConnect) {
|
||||
if (adapter?.enabled && Settings.data.network.bluetoothAutoConnect) {
|
||||
autoConnectTimer.restart();
|
||||
}
|
||||
}
|
||||
@@ -99,7 +98,7 @@ Singleton {
|
||||
Connections {
|
||||
target: Settings.data.network
|
||||
function onBluetoothAutoConnectChanged() {
|
||||
if (Settings.data.network.bluetoothAutoConnect && adapter && adapter.enabled) {
|
||||
if (Settings.data.network.bluetoothAutoConnect && adapter?.enabled) {
|
||||
autoConnectTimer.restart();
|
||||
} else {
|
||||
autoConnectTimer.stop();
|
||||
@@ -137,7 +136,7 @@ Singleton {
|
||||
|
||||
Timer {
|
||||
id: ctlPollTimer
|
||||
interval: 250
|
||||
interval: 2000
|
||||
running: false
|
||||
onTriggered: {
|
||||
if (!adapter || !ProgramCheckerService.bluetoothctlAvailable) {
|
||||
|
||||
@@ -114,7 +114,7 @@ Singleton {
|
||||
|
||||
Component.onCompleted: {
|
||||
Logger.i("Network", "Service started");
|
||||
wifiInitTimer.running = true;
|
||||
wifiInitTimer.restart();
|
||||
|
||||
// Ensure initial detection if nmcli is already available at startup
|
||||
if (ProgramCheckerService.nmcliAvailable) {
|
||||
@@ -155,23 +155,6 @@ Singleton {
|
||||
}
|
||||
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) {
|
||||
ToastService.showNotice(I18n.tr("common.wifi"), I18n.tr("common.enabled"), "wifi");
|
||||
scan();
|
||||
|
||||
Reference in New Issue
Block a user