Skip to content

Commit

Permalink
Get username using KCoreAddons
Browse files Browse the repository at this point in the history
  • Loading branch information
luisbocanegra committed Mar 27, 2024
1 parent 6b0bc1d commit 05d60bc
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/plasmoid/package/contents/ui/FullRepresentation.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import QtQuick.Controls
import QtQuick.Layouts

import "components" as Components
import org.kde.coreaddons 1.0 as KCoreAddons
import org.kde.kirigami as Kirigami
import org.kde.kquickcontrols
import org.kde.plasma.components as PlasmaComponents3
Expand All @@ -27,7 +28,7 @@ ColumnLayout {
property bool backendRunning: true
property string homeDir: StandardPaths.writableLocation(
StandardPaths.HomeLocation).toString().substring(7)
property string username: ""
property string username: kuser.loginName

property string execName: 'kde-material-you-colors'
property string execPath: ""
Expand Down Expand Up @@ -62,6 +63,10 @@ ColumnLayout {

property Item parentMain

KCoreAddons.KUser {
id: kuser
}

Connections {
target: parentMain
function onTogglePauseMode() {
Expand Down Expand Up @@ -124,16 +129,9 @@ ColumnLayout {
execPath = temp

}
function getUsername() {
var parts = homeDir.split('/');
if (parts.length > 2 && parts[1] === "home") {
username = parts[2];
}
}

Component.onCompleted: {
findExecutablePath()
getUsername()
}

P5Support.DataSource {
Expand Down

0 comments on commit 05d60bc

Please sign in to comment.