mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 23:42:51 -05:00
Add support for custom launch prefix, launch apps with niri msg action
spawn on niri
This commit is contained in:
@@ -44,6 +44,7 @@ Singleton {
|
|||||||
property int wallpaperCyclingInterval: 300 // seconds (5 minutes)
|
property int wallpaperCyclingInterval: 300 // seconds (5 minutes)
|
||||||
property string wallpaperCyclingTime: "06:00" // HH:mm format
|
property string wallpaperCyclingTime: "06:00" // HH:mm format
|
||||||
property string lastBrightnessDevice: ""
|
property string lastBrightnessDevice: ""
|
||||||
|
property string launchPrefix: ""
|
||||||
|
|
||||||
// Power management settings - AC Power
|
// Power management settings - AC Power
|
||||||
property int acMonitorTimeout: 0 // Never
|
property int acMonitorTimeout: 0 // Never
|
||||||
@@ -110,6 +111,7 @@ Singleton {
|
|||||||
wallpaperCyclingInterval = settings.wallpaperCyclingInterval !== undefined ? settings.wallpaperCyclingInterval : 300
|
wallpaperCyclingInterval = settings.wallpaperCyclingInterval !== undefined ? settings.wallpaperCyclingInterval : 300
|
||||||
wallpaperCyclingTime = settings.wallpaperCyclingTime !== undefined ? settings.wallpaperCyclingTime : "06:00"
|
wallpaperCyclingTime = settings.wallpaperCyclingTime !== undefined ? settings.wallpaperCyclingTime : "06:00"
|
||||||
lastBrightnessDevice = settings.lastBrightnessDevice !== undefined ? settings.lastBrightnessDevice : ""
|
lastBrightnessDevice = settings.lastBrightnessDevice !== undefined ? settings.lastBrightnessDevice : ""
|
||||||
|
launchPrefix = settings.launchPrefix !== undefined ? settings.launchPrefix : ""
|
||||||
|
|
||||||
acMonitorTimeout = settings.acMonitorTimeout !== undefined ? settings.acMonitorTimeout : 0
|
acMonitorTimeout = settings.acMonitorTimeout !== undefined ? settings.acMonitorTimeout : 0
|
||||||
acLockTimeout = settings.acLockTimeout !== undefined ? settings.acLockTimeout : 0
|
acLockTimeout = settings.acLockTimeout !== undefined ? settings.acLockTimeout : 0
|
||||||
@@ -160,6 +162,7 @@ Singleton {
|
|||||||
"wallpaperCyclingInterval": wallpaperCyclingInterval,
|
"wallpaperCyclingInterval": wallpaperCyclingInterval,
|
||||||
"wallpaperCyclingTime": wallpaperCyclingTime,
|
"wallpaperCyclingTime": wallpaperCyclingTime,
|
||||||
"lastBrightnessDevice": lastBrightnessDevice,
|
"lastBrightnessDevice": lastBrightnessDevice,
|
||||||
|
"launchPrefix": launchPrefix,
|
||||||
"acMonitorTimeout": acMonitorTimeout,
|
"acMonitorTimeout": acMonitorTimeout,
|
||||||
"acLockTimeout": acLockTimeout,
|
"acLockTimeout": acLockTimeout,
|
||||||
"acSuspendTimeout": acSuspendTimeout,
|
"acSuspendTimeout": acSuspendTimeout,
|
||||||
@@ -409,6 +412,11 @@ Singleton {
|
|||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setLaunchPrefix(prefix) {
|
||||||
|
launchPrefix = prefix
|
||||||
|
saveSettings()
|
||||||
|
}
|
||||||
|
|
||||||
function setAcMonitorTimeout(timeout) {
|
function setAcMonitorTimeout(timeout) {
|
||||||
acMonitorTimeout = timeout
|
acMonitorTimeout = timeout
|
||||||
saveSettings()
|
saveSettings()
|
||||||
|
|||||||
@@ -115,14 +115,14 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: recentAppsLoader
|
id: launcherLoader
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
active: root.currentIndex === 7
|
active: root.currentIndex === 7
|
||||||
visible: active
|
visible: active
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
|
||||||
sourceComponent: RecentAppsTab {
|
sourceComponent: LauncherTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ Rectangle {
|
|||||||
"text": "Displays",
|
"text": "Displays",
|
||||||
"icon": "monitor"
|
"icon": "monitor"
|
||||||
}, {
|
}, {
|
||||||
"text": "Recent Apps",
|
"text": "Launcher",
|
||||||
"icon": "history"
|
"icon": "apps"
|
||||||
}, {
|
}, {
|
||||||
"text": "Theme & Colors",
|
"text": "Theme & Colors",
|
||||||
"icon": "palette"
|
"icon": "palette"
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ Item {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
suppressUpdatesWhileLaunching = true
|
suppressUpdatesWhileLaunching = true
|
||||||
appData.desktopEntry.execute()
|
SessionService.launchDesktopEntry(appData.desktopEntry)
|
||||||
appLaunched(appData)
|
appLaunched(appData)
|
||||||
AppUsageHistoryData.addAppUsage(appData.desktopEntry)
|
AppUsageHistoryData.addAppUsage(appData.desktopEntry)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ Item {
|
|||||||
"comment": desktopEntry.comment || ""
|
"comment": desktopEntry.comment || ""
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
desktopEntry.execute()
|
SessionService.launchDesktopEntry(desktopEntry)
|
||||||
}
|
}
|
||||||
} else if (appData.type === "window") {
|
} else if (appData.type === "window") {
|
||||||
const toplevel = getToplevelObject()
|
const toplevel = getToplevelObject()
|
||||||
@@ -245,7 +245,7 @@ Item {
|
|||||||
"comment": desktopEntry.comment || ""
|
"comment": desktopEntry.comment || ""
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
desktopEntry.execute()
|
SessionService.launchDesktopEntry(desktopEntry)
|
||||||
}
|
}
|
||||||
} else if (mouse.button === Qt.RightButton) {
|
} else if (mouse.button === Qt.RightButton) {
|
||||||
if (contextMenu) {
|
if (contextMenu) {
|
||||||
|
|||||||
@@ -19,6 +19,62 @@ Item {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Theme.spacingXL
|
spacing: Theme.spacingXL
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
width: parent.width
|
||||||
|
height: launchPrefixSection.implicitHeight + Theme.spacingL * 2
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
|
||||||
|
Theme.surfaceVariant.b, 0.3)
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
|
||||||
|
Theme.outline.b, 0.2)
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: launchPrefixSection
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingL
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "terminal"
|
||||||
|
size: Theme.iconSize
|
||||||
|
color: Theme.primary
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "Launch Prefix"
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
width: parent.width
|
||||||
|
text: "Add a custom prefix to all application launches. This can be used for things like 'uwsm-app', 'systemd-run', or other command wrappers."
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
width: parent.width
|
||||||
|
text: SessionData.launchPrefix
|
||||||
|
placeholderText: "Enter launch prefix (e.g., 'uwsm-app')"
|
||||||
|
onTextEdited: {
|
||||||
|
SessionData.setLaunchPrefix(text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: recentlyUsedSection.implicitHeight + Theme.spacingL * 2
|
height: recentlyUsedSection.implicitHeight + Theme.spacingL * 2
|
||||||
@@ -21,6 +21,7 @@ Singleton {
|
|||||||
detectElogindProcess.running = true
|
detectElogindProcess.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: detectUwsmProcess
|
id: detectUwsmProcess
|
||||||
running: false
|
running: false
|
||||||
@@ -64,6 +65,26 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// * Apps
|
||||||
|
function launchDesktopEntry(desktopEntry) {
|
||||||
|
let cmd = desktopEntry.command
|
||||||
|
if (SessionData.launchPrefix && SessionData.launchPrefix.length > 0) {
|
||||||
|
const launchPrefix = SessionData.launchPrefix.trim().split(" ")
|
||||||
|
cmd = launchPrefix.concat(cmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
// For niri spawn with niri msg action spawn --
|
||||||
|
if (CompositorService.isNiri) {
|
||||||
|
cmd = ["niri", "msg", "action", "spawn", "--"].concat(cmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
Quickshell.execDetached({
|
||||||
|
command: cmd,
|
||||||
|
workingDirectory: desktopEntry.workingDirectory,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// * Session management
|
||||||
function logout() {
|
function logout() {
|
||||||
if (hasUwsm) {
|
if (hasUwsm) {
|
||||||
uwsmLogout.running = true
|
uwsmLogout.running = true
|
||||||
|
|||||||
Reference in New Issue
Block a user