mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
Compare commits
3 Commits
f96a2e2325
...
dms-niri
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a038fa3c9 | ||
|
|
841e55d37f | ||
|
|
287dda5675 |
@@ -82,6 +82,7 @@ Singleton {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
detectCompositor()
|
detectCompositor()
|
||||||
|
NiriService.generateNiriLayoutConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterCurrentWorkspace(toplevels, screen) {
|
function filterCurrentWorkspace(toplevels, screen) {
|
||||||
@@ -192,6 +193,7 @@ Singleton {
|
|||||||
root.isHyprland = false
|
root.isHyprland = false
|
||||||
root.compositor = "niri"
|
root.compositor = "niri"
|
||||||
console.log("CompositorService: Detected Niri with socket:", root.niriSocket)
|
console.log("CompositorService: Detected Niri with socket:", root.niriSocket)
|
||||||
|
NiriService.generateNiriBinds()
|
||||||
} else {
|
} else {
|
||||||
root.isHyprland = false
|
root.isHyprland = false
|
||||||
root.isNiri = true
|
root.isNiri = true
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ pragma Singleton
|
|||||||
|
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import QtCore
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
|
import qs.Common
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
@@ -31,6 +33,7 @@ Singleton {
|
|||||||
property bool suppressConfigToast: true
|
property bool suppressConfigToast: true
|
||||||
property bool suppressNextConfigToast: false
|
property bool suppressNextConfigToast: false
|
||||||
property bool matugenSuppression: false
|
property bool matugenSuppression: false
|
||||||
|
property bool configGenerationPending: false
|
||||||
|
|
||||||
readonly property string socketPath: Quickshell.env("NIRI_SOCKET")
|
readonly property string socketPath: Quickshell.env("NIRI_SOCKET")
|
||||||
|
|
||||||
@@ -412,7 +415,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function doScreenTransition() {
|
function doScreenTransition() {
|
||||||
send({
|
return send({
|
||||||
"Action": {
|
"Action": {
|
||||||
"DoScreenTransition": {
|
"DoScreenTransition": {
|
||||||
"delay_ms": 0,
|
"delay_ms": 0,
|
||||||
@@ -652,6 +655,7 @@ Singleton {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: suppressToastTimer
|
id: suppressToastTimer
|
||||||
interval: 3000
|
interval: 3000
|
||||||
@@ -663,4 +667,101 @@ Singleton {
|
|||||||
interval: 2000
|
interval: 2000
|
||||||
onTriggered: root.matugenSuppression = false
|
onTriggered: root.matugenSuppression = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: configGenerationDebounce
|
||||||
|
interval: 100
|
||||||
|
onTriggered: root.doGenerateNiriLayoutConfig()
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateNiriLayoutConfig() {
|
||||||
|
const niriSocket = Quickshell.env("NIRI_SOCKET")
|
||||||
|
if (!niriSocket || niriSocket.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configGenerationPending) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
configGenerationPending = true
|
||||||
|
configGenerationDebounce.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
function doGenerateNiriLayoutConfig() {
|
||||||
|
console.log("NiriService: Generating layout config...")
|
||||||
|
|
||||||
|
const cornerRadius = typeof SettingsData !== "undefined" ? SettingsData.cornerRadius : 12
|
||||||
|
const gaps = typeof SettingsData !== "undefined" ? Math.max(4, SettingsData.dankBarSpacing) : 4
|
||||||
|
|
||||||
|
const configContent = `layout {
|
||||||
|
gaps ${gaps}
|
||||||
|
|
||||||
|
border {
|
||||||
|
width 2
|
||||||
|
}
|
||||||
|
|
||||||
|
focus-ring {
|
||||||
|
width 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window-rule {
|
||||||
|
geometry-corner-radius ${cornerRadius}
|
||||||
|
clip-to-geometry true
|
||||||
|
tiled-state true
|
||||||
|
draw-border-with-background false
|
||||||
|
}`
|
||||||
|
|
||||||
|
const configDir = Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation))
|
||||||
|
const niriDmsDir = configDir + "/niri/dms"
|
||||||
|
const configPath = niriDmsDir + "/layout.kdl"
|
||||||
|
|
||||||
|
writeConfigProcess.configContent = configContent
|
||||||
|
writeConfigProcess.configPath = configPath
|
||||||
|
writeConfigProcess.command = ["sh", "-c", `mkdir -p "${niriDmsDir}" && cat > "${configPath}" << 'EOF'\n${configContent}\nEOF`]
|
||||||
|
writeConfigProcess.running = true
|
||||||
|
configGenerationPending = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateNiriBinds() {
|
||||||
|
console.log("NiriService: Generating binds config...")
|
||||||
|
|
||||||
|
const configDir = Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation))
|
||||||
|
const niriDmsDir = configDir + "/niri/dms"
|
||||||
|
const bindsPath = niriDmsDir + "/binds.kdl"
|
||||||
|
const sourceBindsPath = Paths.strip(Qt.resolvedUrl("niri-binds.kdl"))
|
||||||
|
|
||||||
|
writeBindsProcess.bindsPath = bindsPath
|
||||||
|
writeBindsProcess.command = ["sh", "-c", `mkdir -p "${niriDmsDir}" && cp "${sourceBindsPath}" "${bindsPath}"`]
|
||||||
|
writeBindsProcess.running = true
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: writeConfigProcess
|
||||||
|
property string configContent: ""
|
||||||
|
property string configPath: ""
|
||||||
|
|
||||||
|
onExited: exitCode => {
|
||||||
|
if (exitCode === 0) {
|
||||||
|
console.log("NiriService: Generated layout config at", configPath)
|
||||||
|
} else {
|
||||||
|
console.warn("NiriService: Failed to write layout config, exit code:", exitCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: writeBindsProcess
|
||||||
|
property string bindsPath: ""
|
||||||
|
|
||||||
|
onExited: exitCode => {
|
||||||
|
if (exitCode === 0) {
|
||||||
|
console.log("NiriService: Generated binds config at", bindsPath)
|
||||||
|
} else {
|
||||||
|
console.warn("NiriService: Failed to write binds config, exit code:", exitCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
55
Services/niri-binds.kdl
Normal file
55
Services/niri-binds.kdl
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
binds {
|
||||||
|
Mod+Space hotkey-overlay-title="Application Launcher" {
|
||||||
|
spawn "dms" "ipc" "call" "spotlight" "toggle";
|
||||||
|
}
|
||||||
|
|
||||||
|
Mod+V hotkey-overlay-title="Clipboard Manager" {
|
||||||
|
spawn "dms" "ipc" "call" "clipboard" "toggle";
|
||||||
|
}
|
||||||
|
|
||||||
|
Mod+M hotkey-overlay-title="Task Manager" {
|
||||||
|
spawn "dms" "ipc" "call" "processlist" "toggle";
|
||||||
|
}
|
||||||
|
|
||||||
|
Mod+Comma hotkey-overlay-title="Settings" {
|
||||||
|
spawn "dms" "ipc" "call" "settings" "toggle";
|
||||||
|
}
|
||||||
|
|
||||||
|
Mod+N hotkey-overlay-title="Notification Center" {
|
||||||
|
spawn "dms" "ipc" "call" "notifications" "toggle";
|
||||||
|
}
|
||||||
|
|
||||||
|
Mod+Shift+N hotkey-overlay-title="Notepad" {
|
||||||
|
spawn "dms" "ipc" "call" "notepad" "toggle";
|
||||||
|
}
|
||||||
|
|
||||||
|
Mod+Alt+L hotkey-overlay-title="Lock Screen" {
|
||||||
|
spawn "dms" "ipc" "call" "lock" "lock";
|
||||||
|
}
|
||||||
|
|
||||||
|
Ctrl+Alt+Delete hotkey-overlay-title="Task Manager" {
|
||||||
|
spawn "dms" "ipc" "call" "processlist" "toggle";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Audio
|
||||||
|
XF86AudioRaiseVolume allow-when-locked=true {
|
||||||
|
spawn "dms" "ipc" "call" "audio" "increment" "3";
|
||||||
|
}
|
||||||
|
XF86AudioLowerVolume allow-when-locked=true {
|
||||||
|
spawn "dms" "ipc" "call" "audio" "decrement" "3";
|
||||||
|
}
|
||||||
|
XF86AudioMute allow-when-locked=true {
|
||||||
|
spawn "dms" "ipc" "call" "audio" "mute";
|
||||||
|
}
|
||||||
|
XF86AudioMicMute allow-when-locked=true {
|
||||||
|
spawn "dms" "ipc" "call" "audio" "micmute";
|
||||||
|
}
|
||||||
|
|
||||||
|
// BL
|
||||||
|
XF86MonBrightnessUp allow-when-locked=true {
|
||||||
|
spawn "dms" "ipc" "call" "brightness" "increment" "5" "";
|
||||||
|
}
|
||||||
|
XF86MonBrightnessDown allow-when-locked=true {
|
||||||
|
spawn "dms" "ipc" "call" "brightness" "decrement" "5" "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
[templates.niri]
|
[templates.niri]
|
||||||
input_path = './matugen/templates/niri-colors.kdl'
|
input_path = './matugen/templates/niri-colors.kdl'
|
||||||
output_path = '~/.config/niri/dankshell-colors.kdl'
|
output_path = '~/.config/niri/dms/colors.kdl'
|
||||||
Reference in New Issue
Block a user