1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

Compare commits

...

3 Commits

Author SHA1 Message Date
bbedward
c12eafa1db Merge branch 'master' of github.com:bbedward/DankMaterialShell 2025-10-08 23:18:07 -04:00
bbedward
9e26d8755c Add os keyboard to greeter 2025-10-08 23:17:52 -04:00
Lukas Krejci
90bd30e351 add support for system updates on fedora (#353) 2025-10-08 22:19:40 -04:00
3 changed files with 94 additions and 18 deletions

View File

@@ -11,6 +11,7 @@ import Quickshell.Services.Mpris
import qs.Common
import qs.Services
import qs.Widgets
import qs.Modules.Lock
Item {
id: root
@@ -322,6 +323,8 @@ Item {
TextInput {
id: inputField
property bool syncingFromState: false
anchors.fill: parent
anchors.leftMargin: lockIcon.width + Theme.spacingM * 2
anchors.rightMargin: {
@@ -329,6 +332,9 @@ Item {
if (GreeterState.showPasswordInput && revealButton.visible) {
margin += revealButton.width
}
if (virtualKeyboardButton.visible) {
margin += virtualKeyboardButton.width
}
if (enterButton.visible) {
margin += enterButton.width + 2
}
@@ -338,6 +344,7 @@ Item {
focus: true
echoMode: GreeterState.showPasswordInput ? (parent.showPassword ? TextInput.Normal : TextInput.Password) : TextInput.Normal
onTextChanged: {
if (syncingFromState) return
if (GreeterState.showPasswordInput) {
GreeterState.passwordBuffer = text
} else {
@@ -355,13 +362,17 @@ Item {
GreeterState.showPasswordInput = true
PortalService.getGreeterUserProfileImage(GreeterState.username)
GreeterState.passwordBuffer = ""
inputField.text = ""
syncingFromState = true
text = ""
syncingFromState = false
}
}
}
Component.onCompleted: {
syncingFromState = true
text = GreeterState.showPasswordInput ? GreeterState.passwordBuffer : GreeterState.usernameInput
syncingFromState = false
if (isPrimaryScreen)
forceActiveFocus()
}
@@ -371,12 +382,18 @@ Item {
}
}
KeyboardController {
id: keyboard_controller
target: inputField
rootObject: root
}
StyledText {
id: placeholder
anchors.left: lockIcon.right
anchors.leftMargin: Theme.spacingM
anchors.right: (GreeterState.showPasswordInput && revealButton.visible ? revealButton.left : (enterButton.visible ? enterButton.left : parent.right))
anchors.right: (GreeterState.showPasswordInput && revealButton.visible ? revealButton.left : (virtualKeyboardButton.visible ? virtualKeyboardButton.left : (enterButton.visible ? enterButton.left : parent.right)))
anchors.rightMargin: 2
anchors.verticalCenter: parent.verticalCenter
text: {
@@ -413,7 +430,7 @@ Item {
StyledText {
anchors.left: lockIcon.right
anchors.leftMargin: Theme.spacingM
anchors.right: (GreeterState.showPasswordInput && revealButton.visible ? revealButton.left : (enterButton.visible ? enterButton.left : parent.right))
anchors.right: (GreeterState.showPasswordInput && revealButton.visible ? revealButton.left : (virtualKeyboardButton.visible ? virtualKeyboardButton.left : (enterButton.visible ? enterButton.left : parent.right)))
anchors.rightMargin: 2
anchors.verticalCenter: parent.verticalCenter
text: {
@@ -441,8 +458,8 @@ Item {
DankActionButton {
id: revealButton
anchors.right: enterButton.visible ? enterButton.left : parent.right
anchors.rightMargin: enterButton.visible ? 0 : Theme.spacingS
anchors.right: virtualKeyboardButton.visible ? virtualKeyboardButton.left : (enterButton.visible ? enterButton.left : parent.right)
anchors.rightMargin: 0
anchors.verticalCenter: parent.verticalCenter
iconName: parent.showPassword ? "visibility_off" : "visibility"
buttonSize: 32
@@ -450,6 +467,24 @@ Item {
enabled: visible
onClicked: parent.showPassword = !parent.showPassword
}
DankActionButton {
id: virtualKeyboardButton
anchors.right: enterButton.visible ? enterButton.left : parent.right
anchors.rightMargin: enterButton.visible ? 0 : Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
iconName: "keyboard"
buttonSize: 32
visible: Greetd.state === GreetdState.Inactive && !GreeterState.unlocking
enabled: visible
onClicked: {
if (keyboard_controller.isKeyboardActive) {
keyboard_controller.hide()
} else {
keyboard_controller.show()
}
}
}
DankActionButton {
id: enterButton

View File

@@ -171,7 +171,7 @@ DankPopout {
return "Failed to check for updates:\n" + SystemUpdateService.errorMessage;
}
if (!SystemUpdateService.helperAvailable) {
return "No package manager found. Please install 'paru' or 'yay' to check for updates.";
return "No package manager found. Please install 'paru' or 'yay' on Arch-based systems to check for updates.";
}
if (SystemUpdateService.isChecking) {
return "Checking for updates...";

View File

@@ -19,7 +19,48 @@ Singleton {
property bool distributionSupported: false
property string shellVersion: ""
readonly property list<string> supportedDistributions: ["arch", "cachyos", "manjaro", "endeavouros"]
readonly property var archBasedSettings: {
"listUpdatesParams": ["-Qu"],
"upgradeSettings": {
"params": ["-Syu"],
"requiresSudo": false
},
"parserSettings": {
"lineRegex": /^(\S+)\s+([^\s]+)\s+->\s+([^\s]+)$/,
"entryProducer": function (match) {
return {
"name": match[1],
"currentVersion": match[2],
"newVersion": match[3],
"description": `${match[1]} ${match[2]} ${match[3]}`
}
}
}
}
readonly property var packageManagerParams: {
"yay": archBasedSettings,
"paru": archBasedSettings,
"dnf": {
"listUpdatesParams": ["list", "--upgrades", "--quiet", "--color=never"],
"upgradeSettings": {
"params": ["upgrade"],
"requiresSudo": true
},
"parserSettings": {
"lineRegex": /^([^\s]+)\s+([^\s]+)\s+.*$/,
"entryProducer": function (match) {
return {
"name": match[1],
"currentVersion": "",
"newVersion": match[2],
"description": `${match[1]} ${match[2]}`
}
}
}
}
}
readonly property list<string> supportedDistributions: ["arch", "cachyos", "manjaro", "endeavouros", "fedora"]
readonly property int updateCount: availableUpdates.length
readonly property bool helperAvailable: pkgManager !== "" && distributionSupported
@@ -63,7 +104,7 @@ Singleton {
Process {
id: helperDetection
command: ["sh", "-c", "which paru || which yay"]
command: ["sh", "-c", "which paru || which yay || which dnf"]
onExited: (exitCode) => {
if (exitCode === 0) {
@@ -110,7 +151,7 @@ Singleton {
isChecking = true
hasError = false
updateChecker.command = [pkgManager, "-Qu"]
updateChecker.command = [pkgManager].concat(packageManagerParams[pkgManager].listUpdatesParams)
updateChecker.running = true
}
@@ -118,15 +159,13 @@ Singleton {
const lines = output.trim().split('\n').filter(line => line.trim())
const updates = []
const regex = packageManagerParams[pkgManager].parserSettings.lineRegex
const entryProducer = packageManagerParams[pkgManager].parserSettings.entryProducer
for (const line of lines) {
const match = line.match(/^(\S+)\s+([^\s]+)\s+->\s+([^\s]+)$/)
const match = line.match(regex)
if (match) {
updates.push({
name: match[1],
currentVersion: match[2],
newVersion: match[3],
description: `${match[1]} ${match[2]} ${match[3]}`
})
updates.push(entryProducer(match))
}
}
@@ -137,7 +176,9 @@ Singleton {
if (!distributionSupported || !pkgManager || updateCount === 0) return
const terminal = Quickshell.env("TERMINAL") || "xterm"
const updateCommand = `${pkgManager} -Syu && echo "Updates complete! Press Enter to close..." && read`
const params = packageManagerParams[pkgManager].upgradeSettings.params.join(" ")
const sudo = packageManagerParams[pkgManager].upgradeSettings.requiresSudo ? "sudo" : ""
const updateCommand = `${sudo} ${pkgManager} ${params} && echo "Updates complete! Press Enter to close..." && read`
updater.command = [terminal, "-e", "sh", "-c", updateCommand]
updater.running = true
@@ -149,4 +190,4 @@ Singleton {
running: distributionSupported && pkgManager
onTriggered: checkForUpdates()
}
}
}