mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
Merge branch 'master' of github.com:bbedward/DankMaterialShell
This commit is contained in:
@@ -151,6 +151,12 @@ Item {
|
||||
"text": "Keyboard Layout Name",
|
||||
"description": "Displays the active keyboard layout and allows switching",
|
||||
"icon": "keyboard",
|
||||
}, {
|
||||
"id": "notepadButton",
|
||||
"text": "Notepad",
|
||||
"description": "Quick access to notepad",
|
||||
"icon": "assignment",
|
||||
"enabled": true
|
||||
}]
|
||||
property var defaultLeftWidgets: [{
|
||||
"id": "launcherButton",
|
||||
|
||||
@@ -107,6 +107,12 @@ Item {
|
||||
"description": "Access to notifications and do not disturb",
|
||||
"icon": "notifications",
|
||||
"enabled": true
|
||||
}, {
|
||||
"id": "notepadButton",
|
||||
"text": "Notepad",
|
||||
"description": "Quick access to notepad",
|
||||
"icon": "assignment",
|
||||
"enabled": true
|
||||
}, {
|
||||
"id": "battery",
|
||||
"text": "Battery",
|
||||
@@ -419,9 +425,9 @@ Item {
|
||||
SettingsData.setTopBarCenterWidgets(defaultCenterWidgets)
|
||||
|
||||
if (!SettingsData.topBarRightWidgets)
|
||||
SettingsData.setTopBarRightWidgets(
|
||||
defaultRightWidgets)["left""center""right"].forEach(
|
||||
sectionId => {
|
||||
SettingsData.setTopBarRightWidgets(defaultRightWidgets)
|
||||
|
||||
["left", "center", "right"].forEach(sectionId => {
|
||||
var widgets = []
|
||||
if (sectionId === "left")
|
||||
widgets = SettingsData.topBarLeftWidgets.slice()
|
||||
|
||||
67
Modules/TopBar/NotepadButton.qml
Normal file
67
Modules/TopBar/NotepadButton.qml
Normal file
@@ -0,0 +1,67 @@
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Widgets
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
property bool isActive: false
|
||||
property string section: "right"
|
||||
property var popupTarget: null
|
||||
property var parentScreen: null
|
||||
property real widgetHeight: 30
|
||||
property real barHeight: 48
|
||||
readonly property real horizontalPadding: SettingsData.topBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetHeight / 30))
|
||||
|
||||
signal clicked
|
||||
|
||||
width: notepadIcon.width + horizontalPadding * 2
|
||||
height: widgetHeight
|
||||
radius: SettingsData.topBarNoBackground ? 0 : Theme.cornerRadius
|
||||
color: {
|
||||
if (SettingsData.topBarNoBackground) return "transparent"
|
||||
const baseColor = notepadArea.containsMouse
|
||||
|| root.isActive ? Theme.primaryPressed : Theme.secondaryHover
|
||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
|
||||
baseColor.a * Theme.widgetTransparency)
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
id: notepadIcon
|
||||
anchors.centerIn: parent
|
||||
name: "assignment"
|
||||
size: Theme.iconSize - 6
|
||||
color: notepadArea.containsMouse || root.isActive ? Theme.primary : Theme.surfaceText
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 6
|
||||
height: 6
|
||||
radius: 3
|
||||
color: Theme.primary
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.rightMargin: SettingsData.topBarNoBackground ? 0 : 4
|
||||
anchors.topMargin: SettingsData.topBarNoBackground ? 0 : 4
|
||||
visible: SessionData.notepadContent.length > 0
|
||||
opacity: 0.8
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: notepadArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: {
|
||||
root.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -341,6 +341,8 @@ PanelWindow {
|
||||
return true
|
||||
case "vpn":
|
||||
return true
|
||||
case "notepadButton":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
@@ -394,6 +396,8 @@ PanelWindow {
|
||||
return keyboardLayoutNameComponent
|
||||
case "vpn":
|
||||
return vpnComponent
|
||||
case "notepadButton":
|
||||
return notepadButtonComponent
|
||||
default:
|
||||
return null
|
||||
}
|
||||
@@ -1152,6 +1156,36 @@ PanelWindow {
|
||||
|
||||
KeyboardLayoutName {}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: notepadButtonComponent
|
||||
|
||||
NotepadButton {
|
||||
isActive: notepadModalLoader.item ? notepadModalLoader.item.visible : false
|
||||
widgetHeight: root.widgetHeight
|
||||
barHeight: root.effectiveBarHeight
|
||||
section: {
|
||||
if (parent && parent.parent === leftSection)
|
||||
return "left"
|
||||
if (parent && parent.parent === rightSection)
|
||||
return "right"
|
||||
if (parent && parent.parent === centerSection)
|
||||
return "center"
|
||||
return "right"
|
||||
}
|
||||
popupTarget: {
|
||||
notepadModalLoader.active = true
|
||||
return notepadModalLoader.item
|
||||
}
|
||||
parentScreen: root.screen
|
||||
onClicked: {
|
||||
notepadModalLoader.active = true
|
||||
if (notepadModalLoader.item) {
|
||||
notepadModalLoader.item.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user