Merge branch 'main' of https://github.com/noctalia-dev/noctalia-shell
This commit is contained in:
commit
b59c56170e
28 changed files with 120 additions and 163 deletions
|
|
@ -21,5 +21,5 @@ NIconButton {
|
||||||
|
|
||||||
icon: Settings.data.network.bluetoothEnabled ? "bluetooth" : "bluetooth-off"
|
icon: Settings.data.network.bluetoothEnabled ? "bluetooth" : "bluetooth-off"
|
||||||
tooltipText: "Bluetooth devices."
|
tooltipText: "Bluetooth devices."
|
||||||
onClicked: PanelService.getPanel("bluetoothPanel")?.toggle(screen, this)
|
onClicked: PanelService.getPanel("bluetoothPanel")?.toggle(this)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ Item {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var settingsPanel = PanelService.getPanel("settingsPanel")
|
var settingsPanel = PanelService.getPanel("settingsPanel")
|
||||||
settingsPanel.requestedTab = SettingsPanel.Tab.Brightness
|
settingsPanel.requestedTab = SettingsPanel.Tab.Brightness
|
||||||
settingsPanel.open(screen)
|
settingsPanel.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
tooltip.hide()
|
tooltip.hide()
|
||||||
PanelService.getPanel("calendarPanel")?.toggle(screen, this)
|
PanelService.getPanel("calendarPanel")?.toggle(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ NIconButton {
|
||||||
// No script was defined, open settings
|
// No script was defined, open settings
|
||||||
var settingsPanel = PanelService.getPanel("settingsPanel")
|
var settingsPanel = PanelService.getPanel("settingsPanel")
|
||||||
settingsPanel.requestedTab = SettingsPanel.Tab.Bar
|
settingsPanel.requestedTab = SettingsPanel.Tab.Bar
|
||||||
settingsPanel.open(screen)
|
settingsPanel.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ Item {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var settingsPanel = PanelService.getPanel("settingsPanel")
|
var settingsPanel = PanelService.getPanel("settingsPanel")
|
||||||
settingsPanel.requestedTab = SettingsPanel.Tab.Audio
|
settingsPanel.requestedTab = SettingsPanel.Tab.Audio
|
||||||
settingsPanel.open(screen)
|
settingsPanel.open()
|
||||||
}
|
}
|
||||||
onRightClicked: {
|
onRightClicked: {
|
||||||
AudioService.setInputMuted(!AudioService.inputMuted)
|
AudioService.setInputMuted(!AudioService.inputMuted)
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,6 @@ NIconButton {
|
||||||
onRightClicked: {
|
onRightClicked: {
|
||||||
var settingsPanel = PanelService.getPanel("settingsPanel")
|
var settingsPanel = PanelService.getPanel("settingsPanel")
|
||||||
settingsPanel.requestedTab = SettingsPanel.Tab.Brightness
|
settingsPanel.requestedTab = SettingsPanel.Tab.Brightness
|
||||||
settingsPanel.open(screen)
|
settingsPanel.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ NIconButton {
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var panel = PanelService.getPanel("notificationHistoryPanel")
|
var panel = PanelService.getPanel("notificationHistoryPanel")
|
||||||
panel?.toggle(screen, this)
|
panel?.toggle(this)
|
||||||
Settings.data.notifications.lastSeenTs = Time.timestamp * 1000
|
Settings.data.notifications.lastSeenTs = Time.timestamp * 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,6 @@ import qs.Widgets
|
||||||
NIconButton {
|
NIconButton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property ShellScreen screen
|
|
||||||
property real scaling: 1.0
|
|
||||||
|
|
||||||
sizeRatio: 0.8
|
sizeRatio: 0.8
|
||||||
|
|
||||||
icon: "power"
|
icon: "power"
|
||||||
|
|
@ -19,5 +16,5 @@ NIconButton {
|
||||||
colorFg: Color.mError
|
colorFg: Color.mError
|
||||||
colorBorder: Color.transparent
|
colorBorder: Color.transparent
|
||||||
colorBorderHover: Color.transparent
|
colorBorderHover: Color.transparent
|
||||||
onClicked: PanelService.getPanel("powerPanel")?.toggle(screen)
|
onClicked: PanelService.getPanel("powerPanel")?.toggle()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ NIconButton {
|
||||||
colorBorderHover: Color.transparent
|
colorBorderHover: Color.transparent
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
onClicked: PanelService.getPanel("sidePanel")?.toggle(screen, this)
|
onClicked: PanelService.getPanel("sidePanel")?.toggle(this)
|
||||||
onRightClicked: PanelService.getPanel("settingsPanel")?.toggle(screen)
|
onRightClicked: PanelService.getPanel("settingsPanel")?.toggle()
|
||||||
|
|
||||||
IconImage {
|
IconImage {
|
||||||
id: logo
|
id: logo
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ Item {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var settingsPanel = PanelService.getPanel("settingsPanel")
|
var settingsPanel = PanelService.getPanel("settingsPanel")
|
||||||
settingsPanel.requestedTab = SettingsPanel.Tab.Audio
|
settingsPanel.requestedTab = SettingsPanel.Tab.Audio
|
||||||
settingsPanel.open(screen)
|
settingsPanel.open()
|
||||||
}
|
}
|
||||||
onRightClicked: {
|
onRightClicked: {
|
||||||
AudioService.setMuted(!AudioService.muted)
|
AudioService.setMuted(!AudioService.muted)
|
||||||
|
|
|
||||||
|
|
@ -41,5 +41,5 @@ NIconButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tooltipText: "Manage Wi-Fi."
|
tooltipText: "Manage Wi-Fi."
|
||||||
onClicked: PanelService.getPanel("wifiPanel")?.toggle(screen, this)
|
onClicked: PanelService.getPanel("wifiPanel")?.toggle(this)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ import qs.Widgets
|
||||||
NPanel {
|
NPanel {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
panelWidth: 380 * scaling
|
preferredWidth: 380
|
||||||
panelHeight: 500 * scaling
|
preferredHeight: 500
|
||||||
|
|
||||||
panelContent: Rectangle {
|
panelContent: Rectangle {
|
||||||
color: Color.transparent
|
color: Color.transparent
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ import qs.Widgets
|
||||||
NPanel {
|
NPanel {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
panelWidth: 340 * scaling
|
preferredWidth: 340
|
||||||
panelHeight: 320 * scaling
|
preferredHeight: 320
|
||||||
panelAnchorRight: true
|
panelAnchorRight: true
|
||||||
|
|
||||||
// Main Column
|
// Main Column
|
||||||
|
|
|
||||||
|
|
@ -8,17 +8,6 @@ import qs.Services
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// Using Wayland protocols to get focused window then determine which screen it's on.
|
|
||||||
function getActiveScreen() {
|
|
||||||
const activeWindow = ToplevelManager.activeToplevel
|
|
||||||
if (activeWindow && activeWindow.screens.length > 0) {
|
|
||||||
return activeWindow.screens[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fall back to the primary screen
|
|
||||||
return Quickshell.screens[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "screenRecorder"
|
target: "screenRecorder"
|
||||||
function toggle() {
|
function toggle() {
|
||||||
|
|
@ -31,14 +20,14 @@ Item {
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "settings"
|
target: "settings"
|
||||||
function toggle() {
|
function toggle() {
|
||||||
settingsPanel.toggle(getActiveScreen())
|
settingsPanel.toggle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "notifications"
|
target: "notifications"
|
||||||
function toggleHistory() {
|
function toggleHistory() {
|
||||||
notificationHistoryPanel.toggle(getActiveScreen())
|
notificationHistoryPanel.toggle()
|
||||||
}
|
}
|
||||||
function toggleDND() {
|
function toggleDND() {
|
||||||
Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
|
Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
|
||||||
|
|
@ -55,15 +44,15 @@ Item {
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "launcher"
|
target: "launcher"
|
||||||
function toggle() {
|
function toggle() {
|
||||||
launcherPanel.toggle(getActiveScreen())
|
launcherPanel.toggle()
|
||||||
}
|
}
|
||||||
function clipboard() {
|
function clipboard() {
|
||||||
launcherPanel.setSearchText(">clip ")
|
launcherPanel.setSearchText(">clip ")
|
||||||
launcherPanel.toggle(getActiveScreen())
|
launcherPanel.toggle()
|
||||||
}
|
}
|
||||||
function calculator() {
|
function calculator() {
|
||||||
launcherPanel.setSearchText(">calc ")
|
launcherPanel.setSearchText(">calc ")
|
||||||
launcherPanel.toggle(getActiveScreen())
|
launcherPanel.toggle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,14 +111,14 @@ Item {
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "powerPanel"
|
target: "powerPanel"
|
||||||
function toggle() {
|
function toggle() {
|
||||||
powerPanel.toggle(getActiveScreen())
|
powerPanel.toggle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "sidePanel"
|
target: "sidePanel"
|
||||||
function toggle() {
|
function toggle() {
|
||||||
sidePanel.toggle(getActiveScreen())
|
sidePanel.toggle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,10 @@ NPanel {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// Panel configuration
|
// Panel configuration
|
||||||
panelWidth: {
|
preferredWidth: 500
|
||||||
var w = Math.round(Math.max(screen?.width * 0.3, 500) * scaling)
|
preferredWidthRatio: 0.3
|
||||||
w = Math.min(w, screen?.width - Style.marginL * 2)
|
preferredHeight: 600
|
||||||
return w
|
preferredHeightRatio: 0.5
|
||||||
}
|
|
||||||
panelHeight: {
|
|
||||||
var h = Math.round(Math.max(screen?.height * 0.5, 600) * scaling)
|
|
||||||
h = Math.min(h, screen?.height - Style.barHeight * scaling - Style.marginL * 2)
|
|
||||||
return h
|
|
||||||
}
|
|
||||||
|
|
||||||
panelKeyboardFocus: true
|
panelKeyboardFocus: true
|
||||||
panelBackgroundColor: Qt.alpha(Color.mSurface, Settings.data.appLauncher.backgroundOpacity)
|
panelBackgroundColor: Qt.alpha(Color.mSurface, Settings.data.appLauncher.backgroundOpacity)
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ import qs.Widgets
|
||||||
NPanel {
|
NPanel {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
panelWidth: 380 * scaling
|
preferredWidth: 380
|
||||||
panelHeight: 500 * scaling
|
preferredHeight: 500
|
||||||
panelAnchorRight: true
|
panelAnchorRight: true
|
||||||
|
|
||||||
panelContent: Rectangle {
|
panelContent: Rectangle {
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ import qs.Widgets
|
||||||
NPanel {
|
NPanel {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
panelWidth: 440 * scaling
|
preferredWidth: 440
|
||||||
panelHeight: 380 * scaling
|
preferredHeight: 380
|
||||||
panelAnchorHorizontalCenter: true
|
panelAnchorHorizontalCenter: true
|
||||||
panelAnchorVerticalCenter: true
|
panelAnchorVerticalCenter: true
|
||||||
panelKeyboardFocus: true
|
panelKeyboardFocus: true
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,8 @@ NBox {
|
||||||
signal reorderWidget(string section, int fromIndex, int toIndex)
|
signal reorderWidget(string section, int fromIndex, int toIndex)
|
||||||
signal updateWidgetSettings(string section, int index, var settings)
|
signal updateWidgetSettings(string section, int index, var settings)
|
||||||
signal dragPotentialStarted
|
signal dragPotentialStarted
|
||||||
// Emitted when a widget is pressed (potential drag start)
|
|
||||||
signal dragPotentialEnded
|
signal dragPotentialEnded
|
||||||
|
|
||||||
// Emitted when interaction ends (drag or click)
|
|
||||||
color: Color.mSurface
|
color: Color.mSurface
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.minimumHeight: {
|
Layout.minimumHeight: {
|
||||||
|
|
@ -147,12 +145,12 @@ NBox {
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 150
|
duration: Style.animationFast
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 150
|
duration: Style.animationFast
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,18 +48,16 @@ ColumnLayout {
|
||||||
Popup {
|
Popup {
|
||||||
id: iconPicker
|
id: iconPicker
|
||||||
modal: true
|
modal: true
|
||||||
property real panelWidth: {
|
width: {
|
||||||
var w = Math.round(Math.max(Screen.width * 0.35, 900) * scaling)
|
var w = Math.round(Math.max(Screen.width * 0.35, 900) * scaling)
|
||||||
w = Math.min(w, Screen.width - Style.marginL * 2)
|
w = Math.min(w, Screen.width - Style.marginL * 2)
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
property real panelHeight: {
|
height: {
|
||||||
var h = Math.round(Math.max(Screen.height * 0.65, 700) * scaling)
|
var h = Math.round(Math.max(Screen.height * 0.65, 700) * scaling)
|
||||||
h = Math.min(h, Screen.height - Style.barHeight * scaling - Style.marginL * 2)
|
h = Math.min(h, Screen.height - Style.barHeight * scaling - Style.marginL * 2)
|
||||||
return h
|
return h
|
||||||
}
|
}
|
||||||
width: panelWidth
|
|
||||||
height: panelHeight
|
|
||||||
anchors.centerIn: Overlay.overlay
|
anchors.centerIn: Overlay.overlay
|
||||||
padding: Style.marginXL * scaling
|
padding: Style.marginXL * scaling
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,11 @@ import qs.Widgets
|
||||||
NPanel {
|
NPanel {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
panelWidth: {
|
preferredWidth: 1000
|
||||||
var w = Math.round(Math.max(screen?.width * 0.4, 1000) * scaling)
|
preferredHeight: 1000
|
||||||
w = Math.min(w, screen?.width - Style.marginL * 2)
|
preferredWidthRatio: 0.4
|
||||||
return w
|
preferredHeightRatio: 0.75
|
||||||
}
|
|
||||||
panelHeight: {
|
|
||||||
var h = Math.round(Math.max(screen?.height * 0.75, 800) * scaling)
|
|
||||||
h = Math.min(h, screen?.height - Style.barHeight * scaling - Style.marginL * 2)
|
|
||||||
return h
|
|
||||||
}
|
|
||||||
panelAnchorHorizontalCenter: true
|
panelAnchorHorizontalCenter: true
|
||||||
panelAnchorVerticalCenter: true
|
panelAnchorVerticalCenter: true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,11 @@ ColumnLayout {
|
||||||
model: Quickshell.screens || []
|
model: Quickshell.screens || []
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.minimumWidth: 550 * scaling
|
implicitHeight: contentCol.implicitHeight + Style.marginXL * 2 * scaling
|
||||||
radius: Style.radiusM * scaling
|
radius: Style.radiusM * scaling
|
||||||
color: Color.mSurface
|
color: Color.mSurface
|
||||||
border.color: Color.mOutline
|
border.color: Color.mOutline
|
||||||
border.width: Math.max(1, Style.borderS * scaling)
|
border.width: Math.max(1, Style.borderS * scaling)
|
||||||
implicitHeight: contentCol.implicitHeight + Style.marginXL * 2 * scaling
|
|
||||||
|
|
||||||
property real localScaling: ScalingService.getScreenScale(modelData)
|
property real localScaling: ScalingService.getScreenScale(modelData)
|
||||||
Connections {
|
Connections {
|
||||||
|
|
@ -177,7 +176,6 @@ ColumnLayout {
|
||||||
value: localScaling
|
value: localScaling
|
||||||
onPressedChanged: ScalingService.setScreenScale(modelData, value)
|
onPressedChanged: ScalingService.setScreenScale(modelData, value)
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.minimumWidth: 150 * scaling
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NIconButton {
|
NIconButton {
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,8 @@ import qs.Widgets
|
||||||
NBox {
|
NBox {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Layout.fillHeight: true
|
|
||||||
anchors.margins: Style.marginL * scaling
|
anchors.margins: Style.marginL * scaling
|
||||||
|
|
||||||
// No media player detected
|
// No media player detected
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ NBox {
|
||||||
tooltipText: "Open settings."
|
tooltipText: "Open settings."
|
||||||
onClicked: {
|
onClicked: {
|
||||||
settingsPanel.requestedTab = SettingsPanel.Tab.General
|
settingsPanel.requestedTab = SettingsPanel.Tab.General
|
||||||
settingsPanel.open(screen)
|
settingsPanel.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ NBox {
|
||||||
icon: "power"
|
icon: "power"
|
||||||
tooltipText: "Power menu."
|
tooltipText: "Power menu."
|
||||||
onClicked: {
|
onClicked: {
|
||||||
powerPanel.open(screen)
|
powerPanel.open()
|
||||||
sidePanel.close()
|
sidePanel.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ NBox {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
Layout.preferredWidth: Style.baseWidgetSize * 2.625 * scaling
|
Layout.preferredWidth: Style.baseWidgetSize * 2.625 * scaling
|
||||||
implicitHeight: content.implicitHeight + Style.marginXS * 2 * scaling
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: content
|
id: content
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ NBox {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var settingsPanel = PanelService.getPanel("settingsPanel")
|
var settingsPanel = PanelService.getPanel("settingsPanel")
|
||||||
settingsPanel.requestedTab = SettingsPanel.Tab.WallpaperSelector
|
settingsPanel.requestedTab = SettingsPanel.Tab.WallpaperSelector
|
||||||
settingsPanel.open(screen)
|
settingsPanel.open()
|
||||||
}
|
}
|
||||||
onRightClicked: {
|
onRightClicked: {
|
||||||
WallpaperService.setRandomWallpaper()
|
WallpaperService.setRandomWallpaper()
|
||||||
|
|
|
||||||
|
|
@ -10,32 +10,14 @@ import qs.Widgets
|
||||||
NPanel {
|
NPanel {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
panelWidth: 460 * scaling
|
preferredWidth: 460
|
||||||
panelHeight: contentHeight
|
preferredHeight: 730
|
||||||
|
|
||||||
// Default height, will be modified via binding when the content is fully loaded
|
|
||||||
property real contentHeight: 720 * scaling
|
|
||||||
|
|
||||||
panelContent: Item {
|
panelContent: Item {
|
||||||
id: content
|
id: content
|
||||||
|
|
||||||
property real cardSpacing: Style.marginL * scaling
|
property real cardSpacing: Style.marginL * scaling
|
||||||
|
|
||||||
width: root.panelWidth
|
|
||||||
implicitHeight: layout.implicitHeight + (2 * cardSpacing)
|
|
||||||
height: implicitHeight
|
|
||||||
|
|
||||||
// Update parent's contentHeight whenever our height changes
|
|
||||||
onHeightChanged: {
|
|
||||||
root.contentHeight = height
|
|
||||||
}
|
|
||||||
|
|
||||||
onImplicitHeightChanged: {
|
|
||||||
if (implicitHeight > 0) {
|
|
||||||
root.contentHeight = implicitHeight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Layout content
|
// Layout content
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: layout
|
id: layout
|
||||||
|
|
@ -46,55 +28,45 @@ NPanel {
|
||||||
|
|
||||||
// Cards (consistent inter-card spacing via ColumnLayout spacing)
|
// Cards (consistent inter-card spacing via ColumnLayout spacing)
|
||||||
ProfileCard {
|
ProfileCard {
|
||||||
id: profileCard
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
WeatherCard {
|
WeatherCard {
|
||||||
id: weatherCard
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Middle section: media + stats column
|
// Middle section: media + stats column
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: middleRow
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.minimumHeight: 280 * scaling
|
Layout.preferredHeight: Math.max(310 * scaling)
|
||||||
Layout.preferredHeight: Math.max(280 * scaling, statsCard.implicitHeight)
|
|
||||||
spacing: content.cardSpacing
|
spacing: content.cardSpacing
|
||||||
|
|
||||||
// Media card
|
// Media card
|
||||||
MediaCard {
|
MediaCard {
|
||||||
id: mediaCard
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
}
|
}
|
||||||
|
|
||||||
// System monitors combined in one card
|
// System monitors combined in one card
|
||||||
SystemMonitorCard {
|
SystemMonitorCard {
|
||||||
id: statsCard
|
Layout.fillHeight: true
|
||||||
Layout.alignment: Qt.AlignTop
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bottom actions (two grouped rows of round buttons)
|
// Bottom actions (two grouped rows of round buttons)
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: bottomRow
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.minimumHeight: 60 * scaling
|
Layout.preferredHeight: Math.max(60 * scaling)
|
||||||
Layout.preferredHeight: Math.max(60 * scaling, powerProfilesCard.implicitHeight, utilitiesCard.implicitHeight)
|
|
||||||
spacing: content.cardSpacing
|
spacing: content.cardSpacing
|
||||||
|
|
||||||
// Power Profiles switcher
|
// Power Profiles switcher
|
||||||
PowerProfilesCard {
|
PowerProfilesCard {
|
||||||
id: powerProfilesCard
|
|
||||||
spacing: content.cardSpacing
|
spacing: content.cardSpacing
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utilities buttons
|
// Utilities buttons
|
||||||
UtilitiesCard {
|
UtilitiesCard {
|
||||||
id: utilitiesCard
|
|
||||||
spacing: content.cardSpacing
|
spacing: content.cardSpacing
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ import qs.Widgets
|
||||||
NPanel {
|
NPanel {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
panelWidth: 400 * scaling
|
preferredWidth: 400
|
||||||
panelHeight: 500 * scaling
|
preferredHeight: 500
|
||||||
panelKeyboardFocus: true
|
panelKeyboardFocus: true
|
||||||
|
|
||||||
property string passwordSsid: ""
|
property string passwordSsid: ""
|
||||||
|
|
|
||||||
|
|
@ -7,24 +7,14 @@ import qs.Services
|
||||||
Loader {
|
Loader {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
active: false
|
property ShellScreen screen: undefined
|
||||||
asynchronous: true
|
property real scaling: 1.0
|
||||||
|
|
||||||
property ShellScreen screen
|
|
||||||
property real scaling: ScalingService.getScreenScale(screen)
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: ScalingService
|
|
||||||
function onScaleChanged(screenName, scale) {
|
|
||||||
if ((screen !== null) && (screenName === screen.name)) {
|
|
||||||
scaling = scale
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
property Component panelContent: null
|
property Component panelContent: null
|
||||||
property int panelWidth: 1500
|
property real preferredWidth: 700
|
||||||
property int panelHeight: 400
|
property real preferredHeight: 900
|
||||||
|
property real preferredWidthRatio: undefined
|
||||||
|
property real preferredHeightRatio: undefined
|
||||||
property color panelBackgroundColor: Color.mSurface
|
property color panelBackgroundColor: Color.mSurface
|
||||||
|
|
||||||
property bool panelAnchorHorizontalCenter: false
|
property bool panelAnchorHorizontalCenter: false
|
||||||
|
|
@ -50,14 +40,13 @@ Loader {
|
||||||
property real opacityValue: originalOpacity
|
property real opacityValue: originalOpacity
|
||||||
|
|
||||||
property alias isClosing: hideTimer.running
|
property alias isClosing: hideTimer.running
|
||||||
readonly property real barHeight: Math.round(Style.barHeight * scaling)
|
|
||||||
readonly property bool barAtBottom: Settings.data.bar.position === "bottom"
|
|
||||||
readonly property bool barIsVisible: (screen !== null) && (Settings.data.bar.monitors.includes(screen.name)
|
|
||||||
|| (Settings.data.bar.monitors.length === 0))
|
|
||||||
|
|
||||||
signal opened
|
signal opened
|
||||||
signal closed
|
signal closed
|
||||||
|
|
||||||
|
active: false
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
PanelService.registerPanel(root)
|
PanelService.registerPanel(root)
|
||||||
}
|
}
|
||||||
|
|
@ -81,32 +70,16 @@ Loader {
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
function toggle(aScreen, buttonItem) {
|
function toggle(buttonItem) {
|
||||||
// Don't toggle if screen is null or invalid
|
|
||||||
if (!aScreen || !aScreen.name) {
|
|
||||||
Logger.warn("NPanel", "Cannot toggle panel: invalid screen object")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!active || isClosing) {
|
if (!active || isClosing) {
|
||||||
open(aScreen, buttonItem)
|
open(buttonItem)
|
||||||
} else {
|
} else {
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
function open(aScreen, buttonItem) {
|
function open(buttonItem) {
|
||||||
// Don't open if screen is null or invalid
|
|
||||||
if (!aScreen || !aScreen.name) {
|
|
||||||
Logger.warn("NPanel", "Cannot open panel: invalid screen object")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aScreen !== null) {
|
|
||||||
screen = aScreen
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the button position if provided
|
// Get the button position if provided
|
||||||
if (buttonItem !== undefined && buttonItem !== null) {
|
if (buttonItem !== undefined && buttonItem !== null) {
|
||||||
useButtonPosition = true
|
useButtonPosition = true
|
||||||
|
|
@ -165,6 +138,34 @@ Loader {
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: panelWindow
|
id: panelWindow
|
||||||
|
|
||||||
|
// PanelWindow has its own screen property inherited of QsWindow
|
||||||
|
property real scaling: ScalingService.getScreenScale(screen)
|
||||||
|
readonly property real barHeight: Math.round(Style.barHeight * scaling)
|
||||||
|
readonly property bool barAtBottom: Settings.data.bar.position === "bottom"
|
||||||
|
readonly property bool barIsVisible: (screen !== null) && (Settings.data.bar.monitors.includes(screen.name)
|
||||||
|
|| (Settings.data.bar.monitors.length === 0))
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: ScalingService
|
||||||
|
function onScaleChanged(screenName, scale) {
|
||||||
|
if ((screen !== null) && (screenName === screen.name)) {
|
||||||
|
root.scaling = scale
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: panelWindow
|
||||||
|
function onScreenChanged() {
|
||||||
|
root.screen = screen
|
||||||
|
root.scaling = ScalingService.getScreenScale(screen)
|
||||||
|
|
||||||
|
// It's mandatory to force refresh the subloader to ensure the scaling is properly dispatched
|
||||||
|
panelContentLoader.active = false
|
||||||
|
panelContentLoader.active = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
visible: true
|
visible: true
|
||||||
|
|
||||||
// Dim desktop if required
|
// Dim desktop if required
|
||||||
|
|
@ -209,8 +210,27 @@ Loader {
|
||||||
radius: Style.radiusL * scaling
|
radius: Style.radiusL * scaling
|
||||||
border.color: Color.mOutline
|
border.color: Color.mOutline
|
||||||
border.width: Math.max(1, Style.borderS * scaling)
|
border.width: Math.max(1, Style.borderS * scaling)
|
||||||
width: panelWidth
|
width: {
|
||||||
height: panelHeight
|
var w
|
||||||
|
if (preferredWidthRatio !== undefined) {
|
||||||
|
w = Math.round(Math.max(screen?.width * preferredWidthRatio, preferredWidth) * scaling)
|
||||||
|
} else {
|
||||||
|
w = preferredWidth * scaling
|
||||||
|
}
|
||||||
|
// Clamp width so it is never bigger than the screen
|
||||||
|
return Math.min(w, screen?.width - Style.marginL * 2)
|
||||||
|
}
|
||||||
|
height: {
|
||||||
|
var h
|
||||||
|
if (preferredHeightRatio !== undefined) {
|
||||||
|
h = Math.round(Math.max(screen?.height * preferredHeightRatio, preferredHeight) * scaling)
|
||||||
|
} else {
|
||||||
|
h = preferredHeight * scaling
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clamp width so it is never bigger than the screen
|
||||||
|
return Math.min(h, screen?.height - Style.barHeight * scaling - Style.marginL * 2)
|
||||||
|
}
|
||||||
|
|
||||||
scale: root.scaleValue
|
scale: root.scaleValue
|
||||||
opacity: root.opacityValue
|
opacity: root.opacityValue
|
||||||
|
|
@ -221,27 +241,27 @@ Loader {
|
||||||
property int calculatedX: {
|
property int calculatedX: {
|
||||||
if (root.useButtonPosition) {
|
if (root.useButtonPosition) {
|
||||||
// Position panel relative to button
|
// Position panel relative to button
|
||||||
var targetX = root.buttonPosition.x + (root.buttonWidth / 2) - (panelWidth / 2)
|
var targetX = root.buttonPosition.x + (root.buttonWidth / 2) - (preferredWidth / 2)
|
||||||
|
|
||||||
// Keep panel within screen bounds
|
// Keep panel within screen bounds
|
||||||
var maxX = panelWindow.width - panelWidth - (Style.marginS * scaling)
|
var maxX = panelWindow.width - panelBackground.width - (Style.marginS * scaling)
|
||||||
var minX = Style.marginS * scaling
|
var minX = Style.marginS * scaling
|
||||||
|
|
||||||
return Math.round(Math.max(minX, Math.min(targetX, maxX)))
|
return Math.round(Math.max(minX, Math.min(targetX, maxX)))
|
||||||
} else if (!panelAnchorHorizontalCenter && panelAnchorLeft) {
|
} else if (!panelAnchorHorizontalCenter && panelAnchorLeft) {
|
||||||
return Math.round(Style.marginS * scaling)
|
return Math.round(Style.marginS * scaling)
|
||||||
} else if (!panelAnchorHorizontalCenter && panelAnchorRight) {
|
} else if (!panelAnchorHorizontalCenter && panelAnchorRight) {
|
||||||
return Math.round(panelWindow.width - panelWidth - (Style.marginS * scaling))
|
return Math.round(panelWindow.width - panelBackground.width - (Style.marginS * scaling))
|
||||||
} else {
|
} else {
|
||||||
return Math.round((panelWindow.width - panelWidth) / 2)
|
return Math.round((panelWindow.width - panelBackground.width) / 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property int calculatedY: {
|
property int calculatedY: {
|
||||||
if (panelAnchorVerticalCenter) {
|
if (panelAnchorVerticalCenter) {
|
||||||
return Math.round((panelWindow.height - panelHeight) / 2)
|
return Math.round((panelWindow.height - panelBackground.height) / 2)
|
||||||
} else if (panelAnchorBottom) {
|
} else if (panelAnchorBottom) {
|
||||||
return Math.round(panelWindow.height - panelHeight - (Style.marginS * scaling))
|
return Math.round(panelWindow.height - panelBackground.height - (Style.marginS * scaling))
|
||||||
} else if (panelAnchorTop) {
|
} else if (panelAnchorTop) {
|
||||||
return Math.round(Style.marginS * scaling)
|
return Math.round(Style.marginS * scaling)
|
||||||
} else if (!barAtBottom) {
|
} else if (!barAtBottom) {
|
||||||
|
|
@ -249,7 +269,7 @@ Loader {
|
||||||
return Math.round(Style.marginS * scaling)
|
return Math.round(Style.marginS * scaling)
|
||||||
} else {
|
} else {
|
||||||
// Above the bottom bar
|
// Above the bottom bar
|
||||||
return Math.round(panelWindow.height - panelHeight - (Style.marginS * scaling))
|
return Math.round(panelWindow.height - panelBackground.height - (Style.marginS * scaling))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -280,6 +300,7 @@ Loader {
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
id: panelContentLoader
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceComponent: root.panelContent
|
sourceComponent: root.panelContent
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue