Skip to content

Commit 40d63ef

Browse files
committed
feat: add Commands & Shortcuts section to settings page displaying CLI and Niri configuration commands
1 parent ddd43c8 commit 40d63ef

2 files changed

Lines changed: 119 additions & 0 deletions

File tree

CopyBox.qml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import QtQuick
2+
import qs.Common
3+
import qs.Widgets
4+
import qs.Services
5+
6+
Column {
7+
id: root
8+
width: parent.width
9+
spacing: 4
10+
11+
property string label: ""
12+
property string text: ""
13+
14+
StyledText {
15+
width: parent.width
16+
text: root.label
17+
font.pixelSize: Theme.fontSizeSmall
18+
font.bold: true
19+
color: Theme.surfaceVariantText
20+
visible: text !== ""
21+
}
22+
23+
Rectangle {
24+
width: parent.width
25+
height: Math.max(40, cmdRow.implicitHeight + 16)
26+
color: Theme.surfaceContainer
27+
radius: 4
28+
29+
Row {
30+
id: cmdRow
31+
width: parent.width - 16
32+
anchors.centerIn: parent
33+
spacing: 8
34+
35+
StyledText {
36+
width: parent.width - 32
37+
text: root.text
38+
font.family: "Monospace"
39+
font.pixelSize: Theme.fontSizeSmall
40+
color: Theme.secondary
41+
wrapMode: Text.Wrap
42+
}
43+
44+
DankButton {
45+
width: 24; height: 24
46+
iconName: "content_copy"
47+
backgroundColor: "transparent"
48+
textColor: Theme.primary
49+
anchors.verticalCenter: parent.verticalCenter
50+
onClicked: {
51+
Proc.runCommand("copy-ipc", ["wl-copy", "--", root.text], function() {
52+
ToastService.showInfo("Copied to clipboard");
53+
});
54+
}
55+
}
56+
}
57+
}
58+
}

Settings.qml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,5 +519,66 @@ PluginSettings {
519519
}
520520
}
521521
}
522+
523+
// --- Commands & Shortcuts ---
524+
Rectangle {
525+
width: parent.width
526+
height: commandsGroup.implicitHeight + Theme.spacingM * 2
527+
color: Theme.surfaceContainer
528+
radius: Theme.cornerRadius
529+
border.color: Theme.outline
530+
border.width: 1
531+
opacity: 0.8
532+
533+
Column {
534+
id: commandsGroup
535+
anchors.fill: parent
536+
anchors.margins: Theme.spacingM
537+
spacing: Theme.spacingM
538+
539+
Row {
540+
width: parent.width; spacing: Theme.spacingM
541+
DankIcon { name: "terminal"; size: 22; anchors.verticalCenter: parent.verticalCenter; opacity: 0.8 }
542+
StyledText { text: "Commands & Shortcuts"; font.pixelSize: Theme.fontSizeMedium; font.weight: Font.Medium; color: Theme.surfaceText; anchors.verticalCenter: parent.verticalCenter }
543+
}
544+
545+
StyledText {
546+
width: parent.width
547+
text: "You can open, close, or toggle the screen capture toolbar using the dms CLI:"
548+
font.pixelSize: Theme.fontSizeSmall
549+
color: Theme.surfaceVariantText
550+
wrapMode: Text.WordWrap
551+
}
552+
553+
CopyBox {
554+
label: "Toggle Toolbar Command"
555+
text: "dms ipc call screenCaptureToolbar toggle"
556+
}
557+
558+
CopyBox {
559+
label: "Open Toolbar Command"
560+
text: "dms ipc call screenCaptureToolbar open"
561+
}
562+
563+
CopyBox {
564+
label: "Close Toolbar Command"
565+
text: "dms ipc call screenCaptureToolbar close"
566+
}
567+
568+
StyledText {
569+
width: parent.width
570+
text: "To trigger the screen capture toolbar using Print Screen, add this spawn command to your Niri configuration binds:"
571+
font.pixelSize: Theme.fontSizeSmall
572+
color: Theme.primary
573+
font.italic: true
574+
wrapMode: Text.WordWrap
575+
}
576+
577+
CopyBox {
578+
label: "Niri Bind Configuration"
579+
text: "Print { spawn \"dms\" \"ipc\" \"call\" \"screenCaptureToolbar\" \"toggle\"; }"
580+
}
581+
}
582+
}
522583
}
523584
}

0 commit comments

Comments
 (0)