Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/share/sleex/modules/common/Config.qml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ Singleton {
property string avatarPath: "file:///usr/share/sleex/assets/logo/1024px/white.png"
property string userDesc: "Today is a good day to have a good day!"
property bool enableWeather: false
property string dasboardScale: "1"
property string weatherLocation: ""
property string mediaPlayer: ""
property JsonObject calendar: JsonObject {
Expand Down
129 changes: 42 additions & 87 deletions src/share/sleex/modules/dashboard/Dashboard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Effects
import Qt5Compat.GraphicalEffects
import Quickshell.Io
import Quickshell
import Quickshell.Io
import Quickshell.Widgets
import Quickshell.Wayland
import Quickshell.Hyprland
Expand All @@ -19,84 +19,65 @@ import Quickshell.Bluetooth
Scope {
property int dashboardWidth: Appearance.sizes.dashboardWidth
property int dashboardPadding: 15
property real dashboardScale: Config.options.dashboard.dasboardScale

PanelWindow {
id: dashboardRoot
visible: GlobalStates.dashboardOpen

function hide() {
GlobalStates.dashboardOpen = false
}

exclusiveZone: 0
implicitWidth: 1500
implicitHeight: 900
WlrLayershell.namespace: "quickshell:dashboard"
// Hyprland 0.49: Focus is always exclusive and setting this breaks mouse focus grab
// WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
color: "transparent"
WlrLayershell.namespace: "quickshell:dashboard"

function hide(): void {
GlobalStates.dashboardOpen = false
}

HyprlandFocusGrab {
id: grab
windows: [ dashboardRoot ]
windows: [dashboardRoot]
active: GlobalStates.dashboardOpen
onCleared: () => {
if (!active) dashboardRoot.hide()
}
onCleared: if (!active) dashboardRoot.hide()
}


Loader {
id: dashboardContentLoader
active: GlobalStates.dashboardOpen
anchors {
top: parent.top
bottom: parent.bottom
right: parent.right
left: parent.left
topMargin: Appearance.sizes.hyprlandGapsOut
rightMargin: Appearance.sizes.hyprlandGapsOut
bottomMargin: Appearance.sizes.hyprlandGapsOut
leftMargin: Appearance.sizes.elevationMargin
}
width: dashboardWidth - Appearance.sizes.hyprlandGapsOut - Appearance.sizes.elevationMargin
height: parent.height - Appearance.sizes.hyprlandGapsOut * 2

anchors.fill: parent
anchors.margins: Appearance.sizes.hyprlandGapsOut
focus: GlobalStates.dashboardOpen

Keys.onPressed: (event) => {
if (event.key === Qt.Key_Escape) {
dashboardRoot.hide();
}
if (event.key === Qt.Key_Escape)
dashboardRoot.hide()
}

sourceComponent: Item {
implicitHeight: dashboardBackground.implicitHeight
implicitWidth: dashboardBackground.implicitWidth
anchors.centerIn: parent
transformOrigin: Item.Center
scale: dashboardScale

StyledRectangularShadow {
target: dashboardBackground
visible: Config.options.appearance.transparency
}

Rectangle {
id: dashboardBackground

anchors.fill: parent
implicitHeight: parent.height - Appearance.sizes.hyprlandGapsOut * 2
implicitWidth: dashboardWidth - Appearance.sizes.hyprlandGapsOut * 2
color: Appearance.colors.colLayer0
radius: Appearance.rounding.screenRounding - Appearance.sizes.hyprlandGapsOut + 1

ColumnLayout {
spacing: dashboardPadding
anchors.fill: parent
anchors.margins: dashboardPadding
spacing: dashboardPadding

RowLayout {
Layout.fillHeight: false
Layout.fillWidth: true
spacing: 10
Layout.margins: 10
Layout.topMargin: 5
Layout.bottomMargin: 0

Item {
implicitWidth: distroIcon.width
Expand All @@ -120,44 +101,34 @@ Scope {
text: StringUtils.format(qsTr("Uptime: {0}"), DateTime.uptime)
}

Item {
Layout.fillWidth: true
}
Item { Layout.fillWidth: true }

ButtonGroup {
QuickToggleButton {
toggled: false
buttonIcon: "restart_alt"
onClicked: {
Hyprland.dispatch("reload")
Quickshell.reload(true)
}
StyledToolTip {
text: qsTr("Reload Hyprland & Quickshell")
}
StyledToolTip { text: qsTr("Reload Hyprland & Quickshell") }
}

QuickToggleButton {
toggled: false
buttonIcon: "settings"
onClicked: {
Quickshell.execDetached(["qs", "-p", "/usr/share/sleex/settings.qml"])
GlobalStates.dashboardOpen = false
}
StyledToolTip {
text: qsTr("Settings")
dashboardRoot.hide()
}
StyledToolTip { text: qsTr("Settings") }
}

QuickToggleButton {
toggled: false
buttonIcon: "power_settings_new"
onClicked: {
Hyprland.dispatch("global quickshell:sessionOpen")
}
StyledToolTip {
text: qsTr("Session")
}
onClicked: Hyprland.dispatch("global quickshell:sessionOpen")
StyledToolTip { text: qsTr("Session") }
}
}

ButtonGroup {
Layout.alignment: Qt.AlignHCenter
spacing: 5
Expand All @@ -172,75 +143,59 @@ Scope {
NightLight {}
IdleInhibitor {}
}

}


// Center widget group
DashboardTabs {
id: dashboardTabs
Layout.fillWidth: true
Layout.fillHeight: true
Layout.preferredHeight: 600
Layout.preferredWidth: dashboardWidth - dashboardPadding * 2

onCurrentTabChanged: {
if (currentTab === "greetings") {
Notifications.timeoutAll();
}
}
onCurrentTabChanged: if (currentTab === "greetings") Notifications.timeoutAll()
}
}
}
}
}


}

IpcHandler {
target: "dashboard"

function toggle(): void {
GlobalStates.dashboardOpen = !GlobalStates.dashboardOpen;
if(GlobalStates.dashboardOpen) Notifications.timeoutAll();
GlobalStates.dashboardOpen = !GlobalStates.dashboardOpen
if (GlobalStates.dashboardOpen) Notifications.timeoutAll()
}

function close(): void {
GlobalStates.dashboardOpen = false;
GlobalStates.dashboardOpen = false
}

function open(): void {
GlobalStates.dashboardOpen = true;
Notifications.timeoutAll();
GlobalStates.dashboardOpen = true
Notifications.timeoutAll()
}
}

GlobalShortcut {
name: "dashboardToggle"
description: qsTr("Toggles dashboard on press")

onPressed: {
GlobalStates.dashboardOpen = !GlobalStates.dashboardOpen;
if(GlobalStates.dashboardOpen) Notifications.timeoutAll();
GlobalStates.dashboardOpen = !GlobalStates.dashboardOpen
if (GlobalStates.dashboardOpen) Notifications.timeoutAll()
}
}

GlobalShortcut {
name: "dashboardOpen"
description: qsTr("Opens dashboard on press")

onPressed: {
GlobalStates.dashboardOpen = true;
Notifications.timeoutAll();
GlobalStates.dashboardOpen = true
Notifications.timeoutAll()
}
}

GlobalShortcut {
name: "dashboardClose"
description: qsTr("Closes dashboard on press")

onPressed: {
GlobalStates.dashboardOpen = false;
}
onPressed: GlobalStates.dashboardOpen = false
}

}
25 changes: 22 additions & 3 deletions src/share/sleex/modules/settings/Interface.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ ContentPage {
Config.options.appearance.opacity = value;
}
}

}

ContentSection {
Expand Down Expand Up @@ -142,7 +141,7 @@ ContentPage {

ContentSection {
title: "Dashboard"

MaterialTextField {
id: ghUsername
Layout.fillWidth: true
Expand Down Expand Up @@ -197,7 +196,27 @@ ContentPage {
onCheckedChanged: Config.options.dashboard.opt.enableAIAssistant = checked;
}
}

ContentSubsection {
title: "Dashboard Scale"

MaterialTextField {
id: dashboardScale
Layout.fillWidth: true
placeholderText: ""
text: Config.options.dashboard.dasboardScale * 100
wrapMode: TextEdit.Wrap

onEditingFinished: {
let value = parseFloat(text);
if (!isNaN(value)) {
Config.options.dashboard.dasboardScale = value / 100;
}
}
}
}

}

ContentSection {
title: "Dock"
Expand Down Expand Up @@ -361,4 +380,4 @@ ContentPage {
}
}
}
}
}