Add .config/DankMaterialShell/firefox.css

Add .config/DankMaterialShell/plugin_settings.json
Add .config/DankMaterialShell/plugins/calculator/CalculatorLauncher.qml
Add .config/DankMaterialShell/plugins/calculator/CalculatorSettings.qml
Add .config/DankMaterialShell/plugins/calculator/README.md
Add .config/DankMaterialShell/plugins/calculator/calculator.js
Add .config/DankMaterialShell/plugins/calculator/.git/HEAD
Add .config/DankMaterialShell/plugins/calculator/.git/config
Add .config/DankMaterialShell/plugins/calculator/.git/index
Add .config/DankMaterialShell/plugins/calculator/.git/objects/info/.keep
Add .config/DankMaterialShell/plugins/calculator/.git/objects/pack/pack-67f644835e660794f65c9273e46788b0c3da57cf.idx
Add .config/DankMaterialShell/plugins/calculator/.git/objects/pack/pack-67f644835e660794f65c9273e46788b0c3da57cf.rev
Add .config/DankMaterialShell/plugins/calculator/.git/objects/pack/pack-67f644835e660794f65c9273e46788b0c3da57cf.pack
Add .config/DankMaterialShell/plugins/calculator/.git/refs/heads/main
Add .config/DankMaterialShell/plugins/calculator/.git/refs/remotes/origin/main
Add .config/DankMaterialShell/plugins/calculator/.git/refs/remotes/origin/qalc
Add .config/DankMaterialShell/plugins/calculator/.git/refs/tags/.keep
Add .config/DankMaterialShell/plugins/calculator/plugin.json
Add .config/DankMaterialShell/plugins/calculator/screenshot.png
Add .config/DankMaterialShell/plugins/calculator/test_precision.js
Add .config/DankMaterialShell/plugins/calculator/test_single.js
Add .config/DankMaterialShell/plugins/commandRunner/CommandRunner.qml
Add .config/DankMaterialShell/plugins/commandRunner/CommandRunnerSettings.qml
Add .config/DankMaterialShell/plugins/commandRunner/LICENSE
Add .config/DankMaterialShell/plugins/commandRunner/README.md
Add .config/DankMaterialShell/plugins/commandRunner/.git/HEAD
Add .config/DankMaterialShell/plugins/commandRunner/.git/config
Add .config/DankMaterialShell/plugins/commandRunner/.git/index
Add .config/DankMaterialShell/plugins/commandRunner/.git/objects/info/.keep
Add .config/DankMaterialShell/plugins/commandRunner/.git/objects/pack/pack-5a720f795fd2994ef506cd867d86ca7df8a25a31.idx
Add .config/DankMaterialShell/plugins/commandRunner/.git/objects/pack/pack-5a720f795fd2994ef506cd867d86ca7df8a25a31.rev
Add .config/DankMaterialShell/plugins/commandRunner/.git/objects/pack/pack-5a720f795fd2994ef506cd867d86ca7df8a25a31.pack
Add .config/DankMaterialShell/plugins/commandRunner/.git/refs/heads/main
Add .config/DankMaterialShell/plugins/commandRunner/.git/refs/remotes/origin/main
Add .config/DankMaterialShell/plugins/commandRunner/.git/refs/tags/.keep
Add .config/DankMaterialShell/plugins/commandRunner/plugin.json
Add .config/DankMaterialShell/plugins/commandRunner/screenshot.png
Add .config/DankMaterialShell/plugins/dankActions.meta
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions/DankActionsSettings.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions/DankActionsWidget.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions/plugin.json
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankBatteryAlerts/DankBatteryAlerts.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankBatteryAlerts/DankBatteryAlertsSettings.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankBatteryAlerts/plugin.json
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/DankHooks.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/DankHooksSettings.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/README.md
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/plugin.json
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankPomodoroTimer/DankPomodoroSettings.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankPomodoroTimer/DankPomodoroWidget.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankPomodoroTimer/plugin.json
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/LICENSE
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/README.md
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/HEAD
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/config
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/index
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/info/.keep
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/pack/pack-3221a15c022ef4a7bb6bf2c47e40068b66b3588b.idx
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/pack/pack-3221a15c022ef4a7bb6bf2c47e40068b66b3588b.rev
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/pack/pack-3221a15c022ef4a7bb6bf2c47e40068b66b3588b.pack
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/refs/heads/master
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/refs/remotes/origin/master
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/refs/tags/.keep
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.gitignore
Add .config/DankMaterialShell/plugins/emojiLauncher/EmojiLauncher.qml
Add .config/DankMaterialShell/plugins/emojiLauncher/EmojiLauncherSettings.qml
Add .config/DankMaterialShell/plugins/emojiLauncher/LICENSE
Add .config/DankMaterialShell/plugins/emojiLauncher/README.md
Add .config/DankMaterialShell/plugins/emojiLauncher/catalog.js
Add .config/DankMaterialShell/plugins/emojiLauncher/data/emojis.txt
Add .config/DankMaterialShell/plugins/emojiLauncher/data/math.txt
Add .config/DankMaterialShell/plugins/emojiLauncher/data/nerdfont.txt
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/HEAD
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/config
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/index
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/info/.keep
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/pack/pack-e04a5b1ea381dc3a792b8bf08cf70e735b195c0d.idx
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/pack/pack-e04a5b1ea381dc3a792b8bf08cf70e735b195c0d.rev
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/pack/pack-e04a5b1ea381dc3a792b8bf08cf70e735b195c0d.pack
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/refs/heads/main
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/refs/remotes/origin/main
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/refs/tags/.keep
Add .config/DankMaterialShell/plugins/emojiLauncher/plugin.json
Add .config/DankMaterialShell/plugins/emojiLauncher/screenshot.png
Add .config/DankMaterialShell/plugins/emojiLauncher/scripts/generate_catalog.py
Add .config/DankMaterialShell/plugins/dankActions
Add .config/DankMaterialShell/plugins/webSearch/LICENSE
Add .config/DankMaterialShell/plugins/webSearch/README.md
Add .config/DankMaterialShell/plugins/webSearch/WebSearch.qml
Add .config/DankMaterialShell/plugins/webSearch/WebSearchSettings.qml
Add .config/DankMaterialShell/plugins/webSearch/.git/HEAD
Add .config/DankMaterialShell/plugins/webSearch/.git/config
Add .config/DankMaterialShell/plugins/webSearch/.git/index
Add .config/DankMaterialShell/plugins/webSearch/.git/objects/info/.keep
Add .config/DankMaterialShell/plugins/webSearch/.git/objects/pack/pack-6a60c736f418e5b4b1f0505f66c1e2a371d46fed.idx
Add .config/DankMaterialShell/plugins/webSearch/.git/objects/pack/pack-6a60c736f418e5b4b1f0505f66c1e2a371d46fed.rev
Add .config/DankMaterialShell/plugins/webSearch/.git/objects/pack/pack-6a60c736f418e5b4b1f0505f66c1e2a371d46fed.pack
Add .config/DankMaterialShell/plugins/webSearch/.git/refs/heads/main
Add .config/DankMaterialShell/plugins/webSearch/.git/refs/remotes/origin/main
Add .config/DankMaterialShell/plugins/webSearch/.git/refs/tags/.keep
Add .config/DankMaterialShell/plugins/webSearch/plugin.json
Add .config/DankMaterialShell/plugins/webSearch/screenshot.png
Add .config/DankMaterialShell/settings.json
This commit is contained in:
Lewis Wynne 2025-12-12 05:12:42 +00:00
parent b22161e0ca
commit 809b12203c
103 changed files with 25020 additions and 0 deletions

View file

@ -0,0 +1,132 @@
@media -moz-pref("userChrome.theme-material") {
:root {
--md-sys-color-primary: #824c76;
--md-sys-color-surface-tint: #824c76;
--md-sys-color-on-primary: #ffffff;
--md-sys-color-primary-container: #ffd7f1;
--md-sys-color-on-primary-container: #35082f;
--md-sys-color-secondary: #6f5867;
--md-sys-color-on-secondary: #ffffff;
--md-sys-color-secondary-container: #f9daed;
--md-sys-color-on-secondary-container: #271623;
--md-sys-color-tertiary: #815342;
--md-sys-color-on-tertiary: #ffffff;
--md-sys-color-tertiary-container: #ffdbcf;
--md-sys-color-on-tertiary-container: #321206;
--md-sys-color-error: #ba1a1a;
--md-sys-color-on-error: #ffffff;
--md-sys-color-error-container: #ffdad6;
--md-sys-color-on-error-container: #410002;
--md-sys-color-background: #fff7f9;
--md-sys-color-on-background: #201a1e;
--md-sys-color-surface: #fff7f9;
--md-sys-color-on-surface: #201a1e;
--md-sys-color-surface-variant: #efdee6;
--md-sys-color-on-surface-variant: #4e444a;
--md-sys-color-outline: #80747b;
--md-sys-color-outline-variant: #d2c2ca;
--md-sys-color-shadow: #000000;
--md-sys-color-scrim: #000000;
--md-sys-color-inverse-surface: #362e33;
--md-sys-color-inverse-on-surface: #fbedf3;
--md-sys-color-inverse-primary: #f4b2e2;
--md-sys-color-primary-fixed: #ffd7f1;
--md-sys-color-on-primary-fixed: #35082f;
--md-sys-color-primary-fixed-dim: #f4b2e2;
--md-sys-color-on-primary-fixed-variant: #67355d;
--md-sys-color-secondary-fixed: #f9daed;
--md-sys-color-on-secondary-fixed: #271623;
--md-sys-color-secondary-fixed-dim: #dcbed1;
--md-sys-color-on-secondary-fixed-variant: #56404f;
--md-sys-color-tertiary-fixed: #ffdbcf;
--md-sys-color-on-tertiary-fixed: #321206;
--md-sys-color-tertiary-fixed-dim: #f5b9a4;
--md-sys-color-on-tertiary-fixed-variant: #663c2c;
--md-sys-color-surface-dim: #e3d7dc;
--md-sys-color-surface-bright: #fff7f9;
--md-sys-color-surface-container-lowest: #ffffff;
--md-sys-color-surface-container-low: #fef0f6;
--md-sys-color-surface-container: #fff7f9;
--md-sys-color-surface-container-high: #fff7f9;
--md-sys-color-surface-container-highest: #fff7f9;
--m3-radius: 12px;
--m3-radius-sm: 10px;
--m3-elev-0: none;
--m3-elev-1: 0 1px 2px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06);
--m3-elev-2: 0 2px 6px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.06);
--tab-height: 34px;
--urlbar-height: 38px;
--state-hover: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
--state-press: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);
--focus-ring: 0 0 0 2px color-mix(in srgb, var(--md-sys-color-primary) 70%, transparent);
}
}
@media (prefers-color-scheme: dark) {
:root {
--md-sys-color-primary: #f4b2e2;
--md-sys-color-surface-tint: #f4b2e2;
--md-sys-color-on-primary: #4e1e45;
--md-sys-color-primary-container: #67355d;
--md-sys-color-on-primary-container: #ffd7f1;
--md-sys-color-secondary: #dcbed1;
--md-sys-color-on-secondary: #3e2a39;
--md-sys-color-secondary-container: #56404f;
--md-sys-color-on-secondary-container: #f9daed;
--md-sys-color-tertiary: #f5b9a4;
--md-sys-color-on-tertiary: #4c2618;
--md-sys-color-tertiary-container: #663c2c;
--md-sys-color-on-tertiary-container: #ffdbcf;
--md-sys-color-error: #ffb4ab;
--md-sys-color-on-error: #690005;
--md-sys-color-error-container: #93000a;
--md-sys-color-on-error-container: #ffdad6;
--md-sys-color-background: #181216;
--md-sys-color-on-background: #ecdfe5;
--md-sys-color-surface: #181216;
--md-sys-color-on-surface: #ecdfe5;
--md-sys-color-surface-variant: #4e444a;
--md-sys-color-on-surface-variant: #d2c2ca;
--md-sys-color-outline: #9b8d95;
--md-sys-color-outline-variant: #4e444a;
--md-sys-color-shadow: #000000;
--md-sys-color-scrim: #000000;
--md-sys-color-inverse-surface: #ecdfe5;
--md-sys-color-inverse-on-surface: #362e33;
--md-sys-color-inverse-primary: #824c76;
--md-sys-color-primary-fixed: #ffd7f1;
--md-sys-color-on-primary-fixed: #35082f;
--md-sys-color-primary-fixed-dim: #f4b2e2;
--md-sys-color-on-primary-fixed-variant: #67355d;
--md-sys-color-secondary-fixed: #f9daed;
--md-sys-color-on-secondary-fixed: #271623;
--md-sys-color-secondary-fixed-dim: #dcbed1;
--md-sys-color-on-secondary-fixed-variant: #56404f;
--md-sys-color-tertiary-fixed: #ffdbcf;
--md-sys-color-on-tertiary-fixed: #321206;
--md-sys-color-tertiary-fixed-dim: #f5b9a4;
--md-sys-color-on-tertiary-fixed-variant: #663c2c;
--md-sys-color-surface-dim: #181216;
--md-sys-color-surface-bright: #3f373c;
--md-sys-color-surface-container-lowest: #120c10;
--md-sys-color-surface-container-low: #201a1e;
--md-sys-color-surface-container: #241e22;
--md-sys-color-surface-container-high: #2f282c;
--md-sys-color-surface-container-highest: #3a3337;
--m3-elev-1: 0 1px 2px rgba(0,0,0,.50), 0 1px 3px rgba(0,0,0,.35);
--m3-elev-2: 0 4px 10px rgba(0,0,0,.55), 0 1px 3px rgba(0,0,0,.35);
--state-hover: color-mix(in srgb, var(--md-sys-color-on-surface) 6%, transparent);
--state-press: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent);
}
}
/* idk if this even works, but the suggestion in the material updated readme bricks symbols no matter how many fallbacks I add */
:root {
font-family: system-ui, "Inter Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important;
}

View file

@ -0,0 +1,51 @@
{
"commandRunner": {
"enabled": true,
"history": [
"fuzzel",
"fish",
"bash",
"trest",
"yay -Qqet",
"wiremix",
"pipewire",
"neofetch",
"fastfetch"
],
"terminal": "alacritty",
"trigger": "!",
"noTrigger": false
},
"grimblast": {
"enabled": false
},
"dankActions": {
"enabled": false,
"variants": [
{
"icon": "terminal",
"displayText": "",
"displayCommand": "",
"clickCommand": "notify-send 'left clicked'",
"middleClickCommand": "",
"rightClickCommand": "alacritty -e wiremix",
"updateInterval": 0,
"showIcon": true,
"showText": true,
"id": "variant_1765383859499",
"name": "Wiremix"
}
]
},
"calculator": {
"enabled": true,
"trigger": "="
},
"emojiLauncher": {
"enabled": true
},
"webSearch": {
"enabled": true,
"searchEngines": []
}
}

View file

@ -0,0 +1,118 @@
import QtQuick
import Quickshell
import qs.Services
import "calculator.js" as Calculator
Item {
id: root
// Plugin properties
property var pluginService: null
property string trigger: ""
// Plugin interface signals
signal itemsChanged()
Component.onCompleted: {
console.log("Calculator: Plugin loaded")
// Load custom trigger from settings (default is "=")
if (pluginService) {
trigger = pluginService.loadPluginData("calculator", "trigger", "=")
}
}
// Required function: Get items for launcher
function getItems(query) {
console.log("Calculator: getItems called with query:", query)
// If query is empty, return nothing
if (!query || query.trim().length === 0) {
return []
}
const trimmedQuery = query.trim()
// Check if it looks like a math expression
if (!Calculator.isMathExpression(trimmedQuery)) {
return []
}
// Try to evaluate the expression
const result = Calculator.evaluate(trimmedQuery)
if (!result.success) {
// Don't show error items, just return empty
return []
}
// Format the result nicely
let resultString = result.result.toString()
// Only apply scientific notation formatting for actual numbers, not BigInt strings
if (typeof result.result === 'number') {
// For very long decimals or very large/small numbers, use scientific notation
if (resultString.length > 15 && Math.abs(result.result) >= 1e6) {
resultString = result.result.toExponential(6)
} else if (resultString.length > 15 && Math.abs(result.result) < 1e-6) {
resultString = result.result.toExponential(6)
}
}
// For BigInt string results, use as-is (already formatted)
return [
{
name: resultString,
icon: "material:equal",
comment: trimmedQuery + " = " + resultString,
action: "copy:" + resultString,
categories: ["Calculator"]
}
]
}
// Required function: Execute item action
function executeItem(item) {
if (!item || !item.action) {
console.warn("Calculator: Invalid item or action")
return
}
console.log("Calculator: Executing item:", item.name, "with action:", item.action)
const actionParts = item.action.split(":")
const actionType = actionParts[0]
const actionData = actionParts.slice(1).join(":")
switch (actionType) {
case "copy":
copyToClipboard(actionData)
break
default:
console.warn("Calculator: Unknown action type:", actionType)
showToast("Unknown action: " + actionType)
}
}
// Helper function to copy to clipboard
function copyToClipboard(text) {
Quickshell.execDetached(["sh", "-c", "echo -n '" + text + "' | wl-copy"])
showToast("Copied to clipboard: " + text)
}
// Helper function to show toast notification
function showToast(message) {
if (typeof ToastService !== "undefined") {
ToastService.showInfo("Calculator", message)
} else {
console.log("Calculator Toast:", message)
}
}
// Watch for trigger changes
onTriggerChanged: {
if (pluginService) {
pluginService.savePluginData("calculator", "trigger", trigger)
}
}
}

View file

@ -0,0 +1,275 @@
import QtQuick
import QtQuick.Controls
import qs.Widgets
FocusScope {
id: root
property var pluginService: null
implicitHeight: settingsColumn.implicitHeight
height: implicitHeight
Column {
id: settingsColumn
anchors.fill: parent
anchors.margins: 16
spacing: 16
Text {
text: "Calculator Plugin Settings"
font.pixelSize: 18
font.weight: Font.Bold
color: "#FFFFFF"
}
Text {
text: "This plugin evaluates mathematical expressions and copies the result to your clipboard."
font.pixelSize: 14
color: "#CCFFFFFF"
wrapMode: Text.WordWrap
width: parent.width - 32
}
Rectangle {
width: parent.width - 32
height: 1
color: "#30FFFFFF"
}
Column {
spacing: 12
width: parent.width - 32
Text {
text: "Trigger Configuration"
font.pixelSize: 16
font.weight: Font.Medium
color: "#FFFFFF"
}
Text {
text: noTriggerToggle.checked ? "Calculator is always active. Simply type a math expression like '3 + 3' in the launcher." : "Set a trigger prefix to activate the calculator. Type the trigger before your expression."
font.pixelSize: 12
color: "#CCFFFFFF"
wrapMode: Text.WordWrap
width: parent.width
}
Row {
spacing: 12
CheckBox {
id: noTriggerToggle
text: "No trigger (always active)"
checked: loadSettings("noTrigger", false)
contentItem: Text {
text: noTriggerToggle.text
font.pixelSize: 14
color: "#FFFFFF"
leftPadding: noTriggerToggle.indicator.width + 8
verticalAlignment: Text.AlignVCenter
}
indicator: Rectangle {
implicitWidth: 20
implicitHeight: 20
radius: 4
border.color: noTriggerToggle.checked ? "#4CAF50" : "#60FFFFFF"
border.width: 2
color: noTriggerToggle.checked ? "#4CAF50" : "transparent"
Rectangle {
width: 12
height: 12
anchors.centerIn: parent
radius: 2
color: "#FFFFFF"
visible: noTriggerToggle.checked
}
}
onCheckedChanged: {
saveSettings("noTrigger", checked)
if (checked) {
saveSettings("trigger", "")
} else {
const currentTrigger = triggerField.text || "="
saveSettings("trigger", currentTrigger)
}
}
}
}
Row {
spacing: 12
anchors.left: parent.left
anchors.right: parent.right
visible: !noTriggerToggle.checked
Text {
text: "Trigger:"
font.pixelSize: 14
color: "#FFFFFF"
anchors.verticalCenter: parent.verticalCenter
}
DankTextField {
id: triggerField
width: 100
height: 40
text: loadSettings("trigger", "=")
placeholderText: "="
backgroundColor: "#30FFFFFF"
textColor: "#FFFFFF"
onTextEdited: {
const newTrigger = text.trim()
saveSettings("trigger", newTrigger || "=")
saveSettings("noTrigger", newTrigger === "")
}
}
Text {
text: "Examples: =, calc, c"
font.pixelSize: 12
color: "#AAFFFFFF"
anchors.verticalCenter: parent.verticalCenter
}
}
}
Rectangle {
width: parent.width - 32
height: 1
color: "#30FFFFFF"
}
Column {
spacing: 8
width: parent.width - 32
Text {
text: "Supported Operations:"
font.pixelSize: 14
font.weight: Font.Medium
color: "#FFFFFF"
}
Column {
spacing: 4
leftPadding: 16
Text {
text: "• Addition: 3 + 3"
font.pixelSize: 12
color: "#CCFFFFFF"
}
Text {
text: "• Subtraction: 10 - 5"
font.pixelSize: 12
color: "#CCFFFFFF"
}
Text {
text: "• Multiplication: 4 * 7"
font.pixelSize: 12
color: "#CCFFFFFF"
}
Text {
text: "• Division: 20 / 4"
font.pixelSize: 12
color: "#CCFFFFFF"
}
Text {
text: "• Exponentiation: 2 ^ 8"
font.pixelSize: 12
color: "#CCFFFFFF"
}
Text {
text: "• Modulo: 17 % 5"
font.pixelSize: 12
color: "#CCFFFFFF"
}
Text {
text: "• Parentheses: (5 + 3) * 2"
font.pixelSize: 12
color: "#CCFFFFFF"
}
Text {
text: "• Decimals: 3.14 * 2"
font.pixelSize: 12
color: "#CCFFFFFF"
}
}
}
Rectangle {
width: parent.width - 32
height: 1
color: "#30FFFFFF"
}
Column {
spacing: 8
width: parent.width - 32
Text {
text: "Usage:"
font.pixelSize: 14
font.weight: Font.Medium
color: "#FFFFFF"
}
Column {
spacing: 4
leftPadding: 16
bottomPadding: 24
Text {
text: "1. Open Launcher (Ctrl+Space or click launcher button)"
font.pixelSize: 12
color: "#CCFFFFFF"
}
Text {
text: noTriggerToggle.checked ? "2. Type a mathematical expression (e.g., '3 + 3')" : "2. Type your trigger followed by the expression (e.g., '= 3 + 3')"
font.pixelSize: 12
color: "#CCFFFFFF"
}
Text {
text: "3. The result will appear as a launcher item"
font.pixelSize: 12
color: "#CCFFFFFF"
}
Text {
text: "4. Press Enter to copy the result to clipboard"
font.pixelSize: 12
color: "#CCFFFFFF"
}
}
}
}
function saveSettings(key, value) {
if (pluginService) {
pluginService.savePluginData("calculator", key, value)
}
}
function loadSettings(key, defaultValue) {
if (pluginService) {
return pluginService.loadPluginData("calculator", key, defaultValue)
}
return defaultValue
}
}

View file

@ -0,0 +1,152 @@
# Calculator Plugin for DMS Launcher
[![RELEASE](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2Frochacbruno%2FDankCalculator%2Fraw%2Frefs%2Fheads%2Fmain%2Fplugin.json&query=version&style=for-the-badge&label=RELEASE&labelColor=101418&color=9ccbfb)](https://plugins.danklinux.com/calculator.html)
A launcher plugin that evaluates mathematical expressions and copies results to the clipboard.
![Calculator Plugin Screenshot](screenshot.png)
## Features
- **Real-time calculation**: Type mathematical expressions directly in the launcher
- **Default prefix**: Uses `=` as the default trigger prefix (configurable)
- **Safe evaluation**: Only allows mathematical operations, preventing code injection
- **Clipboard integration**: Press Enter to copy the result to clipboard
- **Multiple operations**: Supports +, -, *, /, ^, %, and parentheses
## Installation
### Via DMS
```bash
dms plugins install Calculator
```
### Via DMS GUI
- Mod + ,
- Go to Plugins Tab
- Choose Browse
- Enable third party
- install Calculator
### Manually
```
cd ~/.config/DankMaterialShell/plugins
git clone https://github.com/rochacbruno/DankCalculator Calculator
```
1. Open DMS Settings (Ctrl+,)
2. Navigate to Plugins tab
3. Click "Scan for Plugins"
4. Enable the "Calculator" plugin with the toggle switch
## Usage
### With Default Settings (= Prefix)
1. Open the launcher (Ctrl+Space)
2. Type the `=` prefix followed by a mathematical expression: `= 3 + 3`
3. The result (`6`) appears as a launcher item
4. Press Enter to copy the result to clipboard
### Customizing the Trigger
You can configure a different trigger prefix or disable it entirely in the settings:
1. Open Settings → Plugins → Calculator
2. Change the trigger to a custom value (e.g., `calc`, `c`, `math`)
3. Or check "No trigger (always active)" to remove the prefix requirement
4. In the launcher, type your configured trigger: `calc 3 + 3` or just `3 + 3` (if no trigger)
5. Press Enter to copy the result
### Adding a keybinding (niri)
```kdl
binds {
Mod+Shift+C hotkey-overlay-title="Calculator" {
spawn "dms" "ipc" "call" "spotlight" "openQuery" "=";
}
}
```
## Supported Operations
- **Addition**: `= 3 + 3``6`
- **Subtraction**: `= 10 - 5``5`
- **Multiplication**: `= 4 * 7``28`
- **Division**: `= 20 / 4``5`
- **Exponentiation**: `= 2 ^ 8``256`
- **Modulo**: `= 17 % 5``2`
- **Parentheses**: `= (5 + 3) * 2``16`
- **Decimals**: `= 3.14 * 2``6.28`
- **Complex**: `= (10 + 5) * 2 - 3 / 3``29`
## Examples
| Expression | Result |
|------------|--------|
| `= 3 + 3` | `6` |
| `= 100 / 4` | `25` |
| `= 2 ^ 10` | `1024` |
| `= (5 + 3) * 2` | `16` |
| `= 3.14159 * 2` | `6.28318` |
| `= 16 ^ 0.5` | `4` (square root) |
## Security
The calculator uses safe expression evaluation:
- Only allows numbers, operators (+, -, *, /, ^, %), parentheses, and dots
- Rejects any expressions with letters or special characters (except operators)
- Prevents code injection by validating input before evaluation
## Files
- `plugin.json` - Plugin manifest
- `CalculatorLauncher.qml` - Main launcher component
- `CalculatorSettings.qml` - Settings UI
- `calculator.js` - Safe expression evaluation logic
- `README.md` - This file
## Configuration
Settings are stored in `~/.config/DankMaterialShell/plugin_settings.json` under the `calculator` plugin key:
```json
{
"pluginSettings": {
"calculator": {
"trigger": "=",
"noTrigger": false
}
}
}
```
## Troubleshooting
**Calculator items don't appear:**
- Make sure the plugin is enabled in Settings → Plugins
- Check that you're typing a valid mathematical expression
- Try disabling "No trigger" and setting a specific trigger
**Result shows wrong value:**
- JavaScript has floating-point precision limitations
- Very large or very small numbers may use scientific notation
**Copy to clipboard doesn't work:**
- Make sure your system clipboard is accessible
- Check console for error messages
## Version
1.0.0
## Author
Bruno Cesar Rocha
## License
Same as DankMaterialShell

View file

@ -0,0 +1,245 @@
// Calculator utility for safe mathematical expression evaluation
.pragma library
/**
* Checks if expression contains only integers (no decimals)
*/
function isIntegerOnly(expression) {
return !/\./.test(expression);
}
/**
* Evaluates integer expression using BigInt for precision
*/
function evaluateInteger(expression) {
try {
// Replace operators with BigInt-safe versions
let expr = expression.replace(/\s/g, '');
// Handle exponentiation separately (BigInt doesn't support **)
if (expr.includes('^')) {
return evaluateWithExponentiation(expr, true);
}
// For modulo, division, and basic arithmetic, try BigInt
// Note: BigInt division truncates, so we need to handle / carefully
if (expr.includes('/')) {
// If division exists, fall back to regular number for accuracy
return null;
}
// Replace numbers with BigInt literals
expr = expr.replace(/(\d+)/g, '$1n');
// Evaluate
const result = eval(expr);
// Convert back to string then number for display
// Check if result fits in safe integer range
const numResult = Number(result);
if (Number.isSafeInteger(numResult)) {
return numResult;
}
// Return as string for very large integers
return result.toString().replace(/n$/, '');
} catch (e) {
return null;
}
}
/**
* Handles exponentiation for both BigInt and regular numbers
*/
function evaluateWithExponentiation(expression, useBigInt) {
// Find exponentiation operations and evaluate them
let expr = expression;
// Handle ^ operator by converting to **
expr = expr.replace(/\^/g, '**');
if (useBigInt) {
// For BigInt, we need custom exponentiation
// This is complex, so fall back to regular evaluation
return null;
}
const result = eval(expr);
return result;
}
/**
* Performs precise decimal arithmetic by working with scaled integers
*/
function evaluatePrecise(expression) {
try {
// Replace ^ with ** for exponentiation
let cleaned = expression.replace(/\^/g, '**');
// Evaluate using JavaScript's eval (safe because we validated the input)
let result = eval(cleaned);
// Check if result is a valid number
if (typeof result !== 'number' || !isFinite(result)) {
return null;
}
// Handle floating point precision issues
// Round to 15 significant digits (JavaScript's max precision)
if (Math.abs(result) < 1e-10 && result !== 0) {
// Very small number, keep in scientific notation
return result;
}
// For regular decimals, use toPrecision to avoid floating point errors
// But only if the number has decimal places
if (result % 1 !== 0) {
// Count significant digits in result
const resultStr = result.toString();
if (resultStr.includes('e')) {
// Already in scientific notation
return result;
}
// Round to 15 significant figures to eliminate floating point errors
// e.g., 0.1 + 0.2 = 0.30000000000000004 becomes 0.3
const precision = 15;
const rounded = parseFloat(result.toPrecision(precision));
// If rounding made it a whole number, return as integer
if (rounded % 1 === 0 && Math.abs(rounded) < Number.MAX_SAFE_INTEGER) {
return Math.round(rounded);
}
return rounded;
}
return result;
} catch (e) {
return null;
}
}
/**
* Safely evaluates a mathematical expression
* @param {string} expression - The mathematical expression to evaluate
* @returns {object} - {success: boolean, result: number|string|null, error: string|null}
*/
function evaluate(expression) {
if (!expression || typeof expression !== 'string') {
return {
success: false,
result: null,
error: "Invalid expression"
};
}
// Clean the expression
let cleaned = expression.trim();
// Check if it's empty
if (cleaned.length === 0) {
return {
success: false,
result: null,
error: "Empty expression"
};
}
// Only allow numbers, basic operators, parentheses, dots, and spaces
const allowedChars = /^[0-9+\-*/().\s%^]+$/;
if (!allowedChars.test(cleaned)) {
return {
success: false,
result: null,
error: "Invalid characters in expression"
};
}
// Check if it looks like a mathematical expression
// Must contain at least one operator or be a simple number
const hasOperator = /[+\-*/^%]/.test(cleaned);
const isSimpleNumber = /^-?\d+\.?\d*$/.test(cleaned);
if (!hasOperator && !isSimpleNumber) {
return {
success: false,
result: null,
error: "Not a valid mathematical expression"
};
}
try {
let result;
// Try BigInt evaluation for integer-only expressions (better precision for large integers)
if (isIntegerOnly(cleaned) && !cleaned.includes('/')) {
result = evaluateInteger(cleaned);
}
// Fall back to precise decimal evaluation
if (result === null || result === undefined) {
result = evaluatePrecise(cleaned);
}
if (result === null || result === undefined) {
return {
success: false,
result: null,
error: "Evaluation failed"
};
}
// Check if result is valid
if (typeof result === 'number' && !isFinite(result)) {
return {
success: false,
result: null,
error: "Invalid result"
};
}
return {
success: true,
result: result,
error: null
};
} catch (e) {
return {
success: false,
result: null,
error: "Evaluation error: " + e.message
};
}
}
/**
* Checks if a string looks like it could be a mathematical expression
* @param {string} query - The query to check
* @returns {boolean} - True if it looks like a math expression
*/
function isMathExpression(query) {
if (!query || typeof query !== 'string') {
return false;
}
const cleaned = query.trim();
// Must contain only allowed characters
const allowedChars = /^[0-9+\-*/().\s%^]+$/;
if (!allowedChars.test(cleaned)) {
return false;
}
// Must have at least one digit
if (!/\d/.test(cleaned)) {
return false;
}
// Must be at least 3 characters for an expression (e.g., "1+1")
// or be a simple number
const hasOperator = /[+\-*/^%]/.test(cleaned);
const isSimpleNumber = /^-?\d+\.?\d*$/.test(cleaned);
return (hasOperator && cleaned.length >= 3) || isSimpleNumber;
}

View file

@ -0,0 +1 @@
ref: refs/heads/main

View file

@ -0,0 +1,9 @@
[core]
bare = false
filemode = true
[remote "origin"]
url = https://github.com/rochacbruno/DankCalculator
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
remote = origin
merge = refs/heads/main

View file

@ -0,0 +1 @@
de6dbd59b7630e897a50e107f704c1cd4a131128

View file

@ -0,0 +1 @@
de6dbd59b7630e897a50e107f704c1cd4a131128

View file

@ -0,0 +1 @@
ea2857f89d1a0d00e01e6697f11da2d9f267e071

View file

@ -0,0 +1,19 @@
{
"id": "calculator",
"name": "Calculator",
"description": "A calculator plugin that evaluates mathematical expressions and copies results to clipboard",
"version": "0.1.3",
"author": "Bruno Cesar Rocha <rochacbruno>",
"icon": "calculate",
"type": "launcher",
"capabilities": ["launcher"],
"component": "./CalculatorLauncher.qml",
"settings": "./CalculatorSettings.qml",
"trigger": "=",
"requires_dms": ">0.1.18",
"requires": ["wl-copy"],
"permissions": [
"settings_read",
"settings_write"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,181 @@
#!/usr/bin/env node
// Test cases for calculator precision improvements
// Note: This is a Node.js test file for demonstration purposes
// The actual calculator.js is a QML JavaScript module
// Mock QML .pragma library behavior
const Calculator = {
isIntegerOnly: function(expression) {
return !/\./.test(expression);
},
evaluateInteger: function(expression) {
try {
let expr = expression.replace(/\s/g, '');
if (expr.includes('^') || expr.includes('/')) {
return null;
}
expr = expr.replace(/(\d+)/g, '$1n');
const result = eval(expr);
const numResult = Number(result);
if (Number.isSafeInteger(numResult)) {
return numResult;
}
return result.toString().replace(/n$/, '');
} catch (e) {
return null;
}
},
evaluatePrecise: function(expression) {
try {
let cleaned = expression.replace(/\^/g, '**');
let result = eval(cleaned);
if (typeof result !== 'number' || !isFinite(result)) {
return null;
}
if (Math.abs(result) < 1e-10 && result !== 0) {
return result;
}
if (result % 1 !== 0) {
const resultStr = result.toString();
if (resultStr.includes('e')) {
return result;
}
const precision = 15;
const rounded = parseFloat(result.toPrecision(precision));
if (rounded % 1 === 0 && Math.abs(rounded) < Number.MAX_SAFE_INTEGER) {
return Math.round(rounded);
}
return rounded;
}
return result;
} catch (e) {
return null;
}
},
evaluate: function(expression) {
if (!expression || typeof expression !== 'string') {
return { success: false, result: null, error: "Invalid expression" };
}
let cleaned = expression.trim();
if (cleaned.length === 0) {
return { success: false, result: null, error: "Empty expression" };
}
const allowedChars = /^[0-9+\-*/().\s%^]+$/;
if (!allowedChars.test(cleaned)) {
return { success: false, result: null, error: "Invalid characters" };
}
const hasOperator = /[+\-*/^%]/.test(cleaned);
const isSimpleNumber = /^-?\d+\.?\d*$/.test(cleaned);
if (!hasOperator && !isSimpleNumber) {
return { success: false, result: null, error: "Not a math expression" };
}
try {
let result;
if (this.isIntegerOnly(cleaned) && !cleaned.includes('/')) {
result = this.evaluateInteger(cleaned);
}
if (result === null || result === undefined) {
result = this.evaluatePrecise(cleaned);
}
if (result === null || result === undefined) {
return { success: false, result: null, error: "Evaluation failed" };
}
if (typeof result === 'number' && !isFinite(result)) {
return { success: false, result: null, error: "Invalid result" };
}
return { success: true, result: result, error: null };
} catch (e) {
return { success: false, result: null, error: "Evaluation error: " + e.message };
}
}
};
// Test cases
console.log("=== Calculator Precision Test Suite ===\n");
const tests = [
// Floating point precision tests
{ expr: "0.1 + 0.2", expected: "0.3", description: "Classic floating point precision issue" },
{ expr: "0.1 + 0.2 + 0.3", expected: "0.6", description: "Multiple decimal additions" },
{ expr: "1.1 + 2.2", expected: "3.3", description: "Simple decimal addition" },
{ expr: "3.3 - 1.1", expected: "2.2", description: "Decimal subtraction" },
{ expr: "0.3 - 0.1", expected: "0.2", description: "Another precision issue" },
// BigInt large integer tests
{ expr: "999999999999999999 + 1", expected: "1000000000000000000", description: "Large integer addition (BigInt)" },
{ expr: "123456789012345678 * 2", expected: "246913578024691356", description: "Large integer multiplication (BigInt)" },
{ expr: "999999999999999999 - 999999999999999998", expected: "1", description: "Large integer subtraction" },
// Regular operations
{ expr: "2 + 2", expected: "4", description: "Simple addition" },
{ expr: "10 - 3", expected: "7", description: "Simple subtraction" },
{ expr: "5 * 6", expected: "30", description: "Simple multiplication" },
{ expr: "20 / 4", expected: "5", description: "Simple division" },
{ expr: "2 ^ 10", expected: "1024", description: "Exponentiation" },
{ expr: "17 % 5", expected: "2", description: "Modulo" },
{ expr: "(5 + 3) * 2", expected: "16", description: "Parentheses" },
// Edge cases
{ expr: "100 / 3", expected: "33.3333333333333", description: "Repeating decimal (rounded to 15 sig figs)" },
{ expr: "1.23456789012345678", expected: "1.23456789012346", description: "High precision decimal (rounded to 15 sig figs)" }
];
let passed = 0;
let failed = 0;
tests.forEach((test, index) => {
const result = Calculator.evaluate(test.expr);
const resultStr = result.success ? result.result.toString() : "ERROR";
const matches = resultStr.startsWith(test.expected.substring(0, Math.min(test.expected.length, 10)));
if (matches) {
console.log(`✓ Test ${index + 1}: ${test.description}`);
console.log(` Expression: ${test.expr}`);
console.log(` Result: ${resultStr}`);
passed++;
} else {
console.log(`✗ Test ${index + 1}: ${test.description}`);
console.log(` Expression: ${test.expr}`);
console.log(` Expected: ${test.expected}`);
console.log(` Got: ${resultStr}`);
failed++;
}
console.log();
});
console.log(`=== Test Results ===`);
console.log(`Passed: ${passed}/${tests.length}`);
console.log(`Failed: ${failed}/${tests.length}`);
if (failed === 0) {
console.log("\n✓ All tests passed!");
} else {
console.log(`\n${failed} test(s) failed`);
process.exit(1);
}

View file

@ -0,0 +1,39 @@
// Quick test for the specific case
const fs = require('fs');
// Load and parse the calculator.js file (QML pragma library style)
const calcCode = fs.readFileSync('./calculator.js', 'utf8')
.replace('.pragma library', ''); // Remove QML pragma
// Create a function wrapper to execute the code
const Calculator = new Function(calcCode + '\nreturn { isMathExpression, evaluate };')();
// Test the specific case
const testValue = '99999999999';
console.log('Testing:', testValue);
console.log('---');
const isMath = Calculator.isMathExpression(testValue);
console.log('isMathExpression:', isMath);
if (isMath) {
const result = Calculator.evaluate(testValue);
console.log('Evaluation success:', result.success);
console.log('Result value:', result.result);
console.log('Result type:', typeof result.result);
if (result.success) {
const str = result.result.toString();
console.log('String representation:', str);
console.log('String length:', str.length);
console.log('---');
console.log('Would convert to scientific notation?');
console.log(' Length > 15?', str.length > 15, `(actual: ${str.length})`);
console.log(' Abs value >= 1e6?', Math.abs(result.result) >= 1e6, `(actual: ${result.result})`);
console.log(' RESULT:', (str.length > 15 && Math.abs(result.result) >= 1e6) ? 'YES - would use scientific' : 'NO - would display normally');
if (str.length > 15 && Math.abs(result.result) >= 1e6) {
console.log(' Scientific notation:', result.result.toExponential(6));
}
}
}

View file

@ -0,0 +1,173 @@
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Services
Item {
id: root
property var pluginService: null
property string trigger: ">"
property var commandHistory: []
property int maxHistoryItems: 20
signal itemsChanged()
Component.onCompleted: {
console.log("CommandRunner: Plugin loaded")
if (pluginService) {
trigger = pluginService.loadPluginData("commandRunner", "trigger", ">")
commandHistory = pluginService.loadPluginData("commandRunner", "history", [])
maxHistoryItems = pluginService.loadPluginData("commandRunner", "maxHistoryItems", 20)
}
}
function getItems(query) {
const items = []
if (query && query.trim().length > 0) {
const command = query.trim()
items.push({
name: "Run: " + command,
icon: "material:terminal",
comment: "Execute command in terminal",
action: "run:" + command,
categories: ["Command Runner"]
})
items.push({
name: "Run in background: " + command,
icon: "material:step_over",
comment: "Execute command silently in background",
action: "background:" + command,
categories: ["Command Runner"]
})
items.push({
name: "Copy: " + command,
icon: "material:content_copy",
comment: "Copy command to clipboard",
action: "copy:" + command,
categories: ["Command Runner"]
})
}
if (commandHistory.length > 0) {
const filteredHistory = query
? commandHistory.filter(cmd => cmd.toLowerCase().includes(query.toLowerCase()))
: commandHistory
for (let i = 0; i < Math.min(10, filteredHistory.length); i++) {
const cmd = filteredHistory[i]
items.push({
name: cmd,
icon: "material:history",
comment: "Run from history",
action: "run:" + cmd,
categories: ["Command Runner"]
})
}
}
return items
}
function executeItem(item) {
if (!item || !item.action) {
console.warn("CommandRunner: Invalid item or action")
return
}
console.log("CommandRunner: Executing item:", item.name, "with action:", item.action)
const actionParts = item.action.split(":")
const actionType = actionParts[0]
const command = actionParts.slice(1).join(":")
switch (actionType) {
case "noop":
return
case "copy":
copyToClipboard(command)
break
case "run":
runCommand(command)
break
case "background":
runBackground(command)
break
default:
console.warn("CommandRunner: Unknown action type:", actionType)
showToast("Unknown action: " + actionType)
}
}
function copyToClipboard(text) {
Quickshell.execDetached(["sh", "-c", "echo -n '" + text + "' | wl-copy"])
showToast("Copied to clipboard: " + text)
}
function runCommand(command) {
addToHistory(command)
const terminal = getTerminalCommand()
const wrappedCommand = command + "; echo '\nPress Enter to close...'; read"
Quickshell.execDetached([terminal.cmd, terminal.execFlag, "sh", "-c", wrappedCommand])
showToast("Running in " + terminal.cmd + ": " + command)
}
function runBackground(command) {
addToHistory(command)
Quickshell.execDetached(["sh", "-c", command])
showToast("Running in background: " + command)
}
function showToast(message) {
if (typeof ToastService !== "undefined") {
ToastService.showInfo("Command Runner", message)
} else {
console.log("CommandRunner Toast:", message)
}
}
function getTerminalCommand() {
if (pluginService) {
const terminal = pluginService.loadPluginData("commandRunner", "terminal", "kitty")
const execFlag = pluginService.loadPluginData("commandRunner", "execFlag", "-e")
if (terminal && execFlag) {
return {cmd: terminal, execFlag: execFlag}
}
}
return {cmd: "kitty", execFlag: "-e"}
}
function addToHistory(command) {
const index = commandHistory.indexOf(command)
if (index > -1) {
commandHistory.splice(index, 1)
}
commandHistory.unshift(command)
if (commandHistory.length > maxHistoryItems) {
commandHistory = commandHistory.slice(0, maxHistoryItems)
}
if (pluginService) {
pluginService.savePluginData("commandRunner", "history", commandHistory)
}
itemsChanged()
}
onTriggerChanged: {
if (pluginService) {
pluginService.savePluginData("commandRunner", "trigger", trigger)
}
itemsChanged()
}
}

View file

@ -0,0 +1,436 @@
import QtQuick
import QtQuick.Controls
import qs.Common
import qs.Widgets
FocusScope {
id: root
property var pluginService: null
implicitHeight: settingsColumn.implicitHeight
height: implicitHeight
Column {
id: settingsColumn
anchors.fill: parent
anchors.margins: 16
spacing: 16
StyledText {
text: "Command Runner Settings"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
color: Theme.surfaceText
}
StyledText {
text: "Execute shell commands directly from the launcher with history tracking."
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width - 32
}
StyledRect {
width: parent.width - 32
height: 1
color: Theme.outlineVariant
}
Column {
spacing: 12
width: parent.width - 32
StyledText {
text: "Trigger Configuration"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
}
StyledText {
text: noTriggerToggle.checked ? "Items will always show in the launcher (no trigger needed)." : "Set the trigger text to activate this plugin. Type the trigger in the launcher to run commands."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
Row {
spacing: 12
CheckBox {
id: noTriggerToggle
text: "No trigger (always show)"
checked: loadSettings("noTrigger", false)
contentItem: StyledText {
text: noTriggerToggle.text
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
leftPadding: noTriggerToggle.indicator.width + 8
verticalAlignment: Text.AlignVCenter
}
indicator: StyledRect {
implicitWidth: 20
implicitHeight: 20
radius: Theme.cornerRadiusSmall
border.color: noTriggerToggle.checked ? Theme.primary : Theme.outline
border.width: 2
color: noTriggerToggle.checked ? Theme.primary : "transparent"
StyledRect {
width: 12
height: 12
anchors.centerIn: parent
radius: 2
color: Theme.onPrimary
visible: noTriggerToggle.checked
}
}
onCheckedChanged: {
saveSettings("noTrigger", checked)
if (checked) {
saveSettings("trigger", "")
} else {
saveSettings("trigger", triggerField.text || ">")
}
}
}
}
Row {
spacing: 12
anchors.left: parent.left
anchors.right: parent.right
visible: !noTriggerToggle.checked
StyledText {
text: "Trigger:"
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
DankTextField {
id: triggerField
width: 100
height: 40
text: loadSettings("trigger", ">")
placeholderText: ">"
backgroundColor: Theme.surfaceContainer
textColor: Theme.surfaceText
onTextEdited: {
const newTrigger = text.trim()
saveSettings("trigger", newTrigger || ">")
saveSettings("noTrigger", newTrigger === "")
}
}
StyledText {
text: "Examples: >, $, !, /run, etc."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter
}
}
}
StyledRect {
width: parent.width - 32
height: 1
color: Theme.outlineVariant
}
Column {
spacing: 12
width: parent.width - 32
StyledText {
text: "Terminal Configuration"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
}
StyledText {
text: "Configure which terminal emulator to use for commands"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
Row {
spacing: 12
width: parent.width
StyledText {
text: "Terminal:"
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
DankTextField {
id: terminalField
width: 150
height: 40
text: loadSettings("terminal", "kitty")
placeholderText: "kitty"
backgroundColor: Theme.surfaceContainer
textColor: Theme.surfaceText
onTextEdited: {
saveSettings("terminal", text.trim())
}
}
StyledText {
text: "Exec flag:"
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
DankTextField {
id: execFlagField
width: 80
height: 40
text: loadSettings("execFlag", "-e")
placeholderText: "-e"
backgroundColor: Theme.surfaceContainer
textColor: Theme.surfaceText
onTextEdited: {
saveSettings("execFlag", text.trim())
}
}
}
Column {
spacing: 4
leftPadding: 16
StyledText {
text: "Common terminals: kitty (-e), alacritty (-e), foot (-e), wezterm (start)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "Others: gnome-terminal (--), konsole (-e), xterm (-e)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
}
StyledRect {
width: parent.width - 32
height: 1
color: Theme.outlineVariant
}
Column {
spacing: 12
width: parent.width - 32
StyledText {
text: "History Settings"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
}
Row {
spacing: 12
width: parent.width
StyledText {
text: "Max history items:"
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
DankTextField {
id: historyField
width: 80
height: 40
text: loadSettings("maxHistoryItems", "20")
placeholderText: "20"
backgroundColor: Theme.surfaceContainer
textColor: Theme.surfaceText
onTextEdited: {
const num = parseInt(text)
if (!isNaN(num) && num > 0 && num <= 100) {
saveSettings("maxHistoryItems", num)
}
}
}
StyledText {
text: "(1-100)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter
}
}
StyledRect {
width: parent.width
height: 40
radius: Theme.cornerRadius
color: clearMouseArea.containsMouse ? Theme.errorHover : Theme.error
StyledText {
anchors.centerIn: parent
text: "Clear Command History"
color: Theme.onError
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
}
MouseArea {
id: clearMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
saveSettings("history", [])
if (typeof ToastService !== "undefined") {
ToastService.showInfo("Command history cleared")
}
}
}
}
}
StyledRect {
width: parent.width - 32
height: 1
color: Theme.outlineVariant
}
Column {
spacing: 8
width: parent.width - 32
StyledText {
text: "Features:"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
Column {
spacing: 4
leftPadding: 16
StyledText {
text: "• Run commands in terminal or background"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "• Command history with recent commands"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "• Common command shortcuts"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "• Copy commands to clipboard"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "• Auto-detects available terminal emulator"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
}
StyledRect {
width: parent.width - 32
height: 1
color: Theme.outlineVariant
}
Column {
spacing: 8
width: parent.width - 32
StyledText {
text: "Usage:"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
Column {
spacing: 4
leftPadding: 16
bottomPadding: 24
StyledText {
text: "1. Open Launcher (Ctrl+Space or click launcher button)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: noTriggerToggle.checked ? "2. Commands are always visible in the launcher" : "2. Type your trigger (default: >) followed by command"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: noTriggerToggle.checked ? "3. Type your command, e.g., 'htop' or 'ls -la'" : "3. Example: '> htop' or '> ls -la'"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "4. Select 'Run' to open in terminal, 'Run in background' for silent execution"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "5. Browse recent commands from history or pick from common commands"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
}
}
function saveSettings(key, value) {
if (pluginService) {
pluginService.savePluginData("commandRunner", key, value)
}
}
function loadSettings(key, defaultValue) {
if (pluginService) {
return pluginService.loadPluginData("commandRunner", key, defaultValue)
}
return defaultValue
}
}

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 DankMaterialShell Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,180 @@
# Command Runner
A DankMaterialShell launcher plugin for executing shell commands directly from the launcher with history tracking and preset shortcuts.
![Command Runner Screenshot](screenshot.png)
## Features
- **Execute Commands** - Run any shell command in terminal or background
- **Command History** - Track and reuse recently executed commands
- **Common Shortcuts** - Quick access to frequently used commands (htop, btop, ncdu, etc.)
- **Terminal Support** - Auto-detect or configure your preferred terminal emulator
- **Background Execution** - Run commands silently without opening a terminal
- **Clipboard Copy** - Copy commands to clipboard before executing
- **Configurable Trigger** - Default `>` or set your own trigger
## Installation
### From Plugin Registry (Recommended)
```bash
# Coming soon - will be available via DMS plugin manager
```
### Manual Installation
```bash
# Copy plugin to DMS plugins directory
cp -r CommandRunner ~/.config/DankMaterialShell/plugins/
# Enable in DMS
# 1. Open Settings (Ctrl+,)
# 2. Go to Plugins tab
# 3. Click "Scan for Plugins"
# 4. Toggle "Command Runner" to enable
# 5. Configure your terminal emulator in plugin settings
```
## Configuration
**Important**: Configure your terminal before first use!
1. Open Settings → Plugins → Command Runner
2. Set **Terminal**: Your terminal emulator (e.g., `kitty`, `alacritty`, `foot`)
3. Set **Exec flag**: The flag for executing commands (e.g., `-e` for most terminals)
### Common Terminal Configurations
| Terminal | Command | Exec Flag |
|----------|---------|-----------|
| kitty | `kitty` | `-e` |
| alacritty | `alacritty` | `-e` |
| foot | `foot` | `-e` |
| wezterm | `wezterm` | `start` |
| gnome-terminal | `gnome-terminal` | `--` |
| konsole | `konsole` | `-e` |
| xterm | `xterm` | `-e` |
## Usage
### Execute Commands in Terminal
1. Open launcher (Ctrl+Space)
2. Type `>` followed by command
3. Examples:
- `> htop` - System monitor
- `> btop` - Modern resource monitor
- `> ls -la` - List files with details
- `> journalctl -f` - View live system logs
4. Select "Run: command" and press Enter
### Execute Commands in Background
1. Type command as above
2. Select "Run in background: command"
3. Command executes silently without terminal window
### Copy Command to Clipboard
1. Type command
2. Select "Copy: command"
3. Command copied to clipboard for use elsewhere
### Use Command History
- Recent commands appear automatically in the list
- Click any historical command to re-execute
- History persists across sessions
### Common Command Shortcuts
Access pre-configured shortcuts without typing:
- `htop` - Interactive process viewer
- `btop` - Resource monitor
- `ncdu` - Disk usage analyzer
- `nmtui` - Network manager TUI
- `ranger` - File manager
- `neofetch` / `fastfetch` - System info
- And more!
## Settings
- **Trigger**: Set custom trigger (`>`, `$`, `!`, `/run`, etc.) or disable for always-on
- **Terminal Emulator**: Configure which terminal to use
- **Exec Flag**: Set the command execution flag for your terminal
- **Max History Items**: Configure history size (1-100 items)
- **Clear History**: Remove all stored commands
## Examples
### System Monitoring
```
> htop # Interactive process viewer
> btop # Modern resource monitor
> journalctl -f # Live system logs
> df -h # Disk usage
> free -h # Memory usage
```
### File Operations
```
> ls -la # List all files
> ncdu ~ # Analyze disk usage
> ranger # File manager
```
### Network
```
> nmtui # Network manager
> ip addr # Network interfaces
> ping 8.8.8.8 # Test connectivity
```
### Development
```
> vim config.txt # Edit file in vim
> git status # Check git status
> npm install # Install packages
```
## Requirements
- DankMaterialShell >= 0.1.0
- Terminal emulator (kitty, alacritty, foot, etc.)
- `wl-copy` (for clipboard support)
- Wayland compositor
## Compatibility
- **Compositors**: Niri and Hyprland
- **Distros**: Universal - works on any Linux distribution
- **Terminals**: Supports all major terminal emulators
## Technical Details
- **Type**: Launcher plugin
- **Trigger**: `>` (configurable)
- **Language**: QML (Qt Modeling Language)
- **Storage**: Command history stored in DMS settings
## Troubleshooting
### Commands not launching?
1. Verify terminal is configured in plugin settings
2. Check terminal is installed: `which kitty` (or your terminal)
3. Verify exec flag matches your terminal
### Terminal opens but command doesn't run?
- Ensure exec flag is correct for your terminal
- Most terminals use `-e`, but some (wezterm) use `start`
## Contributing
Found a bug or want to add features? Open an issue or submit a pull request!
## License
MIT License - See LICENSE file for details
## Author
Created for the DankMaterialShell community
## Links
- [DankMaterialShell](https://github.com/AvengeMedia/DankMaterialShell)
- [Plugin Registry](https://github.com/AvengeMedia/dms-plugin-registry)

View file

@ -0,0 +1 @@
ref: refs/heads/main

View file

@ -0,0 +1,9 @@
[core]
bare = false
filemode = true
[remote "origin"]
url = https://github.com/devnullvoid/dms-command-runner
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
remote = origin
merge = refs/heads/main

View file

@ -0,0 +1 @@
d89a09413e2fc041089b595a06c0fb316b12e17a

View file

@ -0,0 +1 @@
d89a09413e2fc041089b595a06c0fb316b12e17a

View file

@ -0,0 +1,20 @@
{
"id": "commandRunner",
"name": "Command Runner",
"description": "Execute shell commands directly from the launcher",
"version": "1.1.0",
"author": "devnullvoid",
"icon": "terminal",
"type": "launcher",
"capabilities": [
"command-execution",
"shell"
],
"component": "./CommandRunner.qml",
"settings": "./CommandRunnerSettings.qml",
"trigger": ">",
"permissions": [
"settings_read",
"settings_write"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View file

@ -0,0 +1,3 @@
repo=https://github.com/AvengeMedia/dms-plugins
path=DankActions
repodir=0026f1eba8dedaec

View file

@ -0,0 +1,638 @@
import QtQuick
import QtQuick.Controls
import qs.Common
import qs.Services
import qs.Widgets
import qs.Modules.Plugins
PluginSettings {
id: root
pluginId: "dankActions"
property string editingVariantId: ""
function loadVariantForEditing(variantData) {
editingVariantId = variantData.id || ""
nameField.text = variantData.name || ""
iconField.text = variantData.icon || ""
displayTextField.text = variantData.displayText || ""
displayCommandField.text = variantData.displayCommand || ""
clickCommandField.text = variantData.clickCommand || ""
middleClickCommandField.text = variantData.middleClickCommand || ""
rightClickCommandField.text = variantData.rightClickCommand || ""
updateIntervalField.text = (variantData.updateInterval || 0).toString()
showIconToggle.checked = variantData.showIcon !== undefined ? variantData.showIcon : true
showTextToggle.checked = variantData.showText !== undefined ? variantData.showText : true
}
function clearForm() {
editingVariantId = ""
nameField.text = ""
iconField.text = ""
displayTextField.text = ""
displayCommandField.text = ""
clickCommandField.text = ""
middleClickCommandField.text = ""
rightClickCommandField.text = ""
updateIntervalField.text = "0"
showIconToggle.checked = true
showTextToggle.checked = true
}
StyledText {
width: parent.width
text: "Custom Action Manager"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
color: Theme.surfaceText
}
StyledText {
width: parent.width
text: "Create custom widgets that execute commands and display dynamic output"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
}
StyledRect {
width: parent.width
height: addActionColumn.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Theme.surfaceContainerHigh
Column {
id: addActionColumn
anchors.fill: parent
anchors.margins: Theme.spacingL
spacing: Theme.spacingM
Row {
width: parent.width
spacing: Theme.spacingM
StyledText {
text: root.editingVariantId ? "Edit Action" : "Create New Action"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
DankButton {
text: "Cancel"
iconName: "close"
visible: root.editingVariantId !== ""
onClicked: root.clearForm()
}
}
Row {
width: parent.width
spacing: Theme.spacingM
Column {
width: (parent.width - Theme.spacingM) / 2
spacing: Theme.spacingXS
StyledText {
text: "Variant Name *"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: nameField
width: parent.width
placeholderText: "e.g., Power Profile"
keyNavigationTab: iconField
onFocusStateChanged: hasFocus => {
if (hasFocus) root.ensureItemVisible(nameField)
}
}
}
Column {
width: (parent.width - Theme.spacingM) / 2
spacing: Theme.spacingXS
StyledText {
text: "Icon Name"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: iconField
width: parent.width
placeholderText: "e.g., power_settings_new"
keyNavigationBacktab: nameField
keyNavigationTab: displayTextField
onFocusStateChanged: hasFocus => {
if (hasFocus) root.ensureItemVisible(iconField)
}
}
}
}
Column {
width: parent.width
spacing: Theme.spacingXS
StyledText {
text: "Static Display Text (optional)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: displayTextField
width: parent.width
placeholderText: "Text to show (or leave empty if using command output)"
keyNavigationBacktab: iconField
keyNavigationTab: displayCommandField
onFocusStateChanged: hasFocus => {
if (hasFocus) root.ensureItemVisible(displayTextField)
}
}
}
Column {
width: parent.width
spacing: Theme.spacingXS
StyledText {
text: "Display Command (optional)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: displayCommandField
width: parent.width
placeholderText: 'e.g., echo "Hello World" or powerprofilesctl get'
keyNavigationBacktab: displayTextField
keyNavigationTab: clickCommandField
onFocusStateChanged: hasFocus => {
if (hasFocus) root.ensureItemVisible(displayCommandField)
}
}
StyledText {
text: "Command output will replace static text. Runs on widget load."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
}
Column {
width: parent.width
spacing: Theme.spacingXS
StyledText {
text: "Left Click Command (optional)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: clickCommandField
width: parent.width
placeholderText: "e.g., notify-send 'Clicked!' or cycle-power-profile.sh"
keyNavigationBacktab: displayCommandField
keyNavigationTab: middleClickCommandField
onFocusStateChanged: hasFocus => {
if (hasFocus) root.ensureItemVisible(clickCommandField)
}
}
StyledText {
text: "Command to run on left click. After completion, display command refreshes."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
}
Column {
width: parent.width
spacing: Theme.spacingXS
StyledText {
text: "Middle Click Command (optional)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: middleClickCommandField
width: parent.width
placeholderText: "e.g., notify-send 'Middle clicked!'"
keyNavigationBacktab: clickCommandField
keyNavigationTab: rightClickCommandField
onFocusStateChanged: hasFocus => {
if (hasFocus) root.ensureItemVisible(middleClickCommandField)
}
}
}
Column {
width: parent.width
spacing: Theme.spacingXS
StyledText {
text: "Right Click Command (optional)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: rightClickCommandField
width: parent.width
placeholderText: "e.g., notify-send 'Right clicked!'"
keyNavigationBacktab: middleClickCommandField
keyNavigationTab: updateIntervalField
onFocusStateChanged: hasFocus => {
if (hasFocus) root.ensureItemVisible(rightClickCommandField)
}
}
}
Column {
width: parent.width
spacing: Theme.spacingXS
StyledText {
text: "Update Interval (seconds, 0 = disabled)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: updateIntervalField
width: parent.width
placeholderText: "0"
text: "0"
keyNavigationBacktab: rightClickCommandField
onFocusStateChanged: hasFocus => {
if (hasFocus) root.ensureItemVisible(updateIntervalField)
}
}
StyledText {
text: "Automatically re-run display command every N seconds. Set to 0 to disable."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
}
Row {
width: parent.width
spacing: Theme.spacingL
Column {
spacing: Theme.spacingXS
StyledText {
text: "Show Icon"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankToggle {
id: showIconToggle
checked: true
}
}
Column {
spacing: Theme.spacingXS
StyledText {
text: "Show Text"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankToggle {
id: showTextToggle
checked: true
}
}
}
DankButton {
text: root.editingVariantId ? "Update Action" : "Create Action"
iconName: root.editingVariantId ? "check" : "add"
onClicked: {
if (!nameField.text) {
ToastService.showError("Please enter a variant name")
return
}
var interval = parseInt(updateIntervalField.text) || 0
if (interval < 0) {
ToastService.showError("Update interval must be 0 or greater")
return
}
var variantConfig = {
icon: iconField.text || "terminal",
displayText: displayTextField.text || "",
displayCommand: displayCommandField.text || "",
clickCommand: clickCommandField.text || "",
middleClickCommand: middleClickCommandField.text || "",
rightClickCommand: rightClickCommandField.text || "",
updateInterval: interval,
showIcon: showIconToggle.checked,
showText: showTextToggle.checked
}
if (root.editingVariantId) {
variantConfig.name = nameField.text
updateVariant(root.editingVariantId, variantConfig)
} else {
createVariant(nameField.text, variantConfig)
}
root.clearForm()
}
}
}
}
StyledRect {
width: parent.width
height: Math.max(200, variantsColumn.implicitHeight + Theme.spacingL * 2)
radius: Theme.cornerRadius
color: Theme.surfaceContainerHigh
Column {
id: variantsColumn
anchors.fill: parent
anchors.margins: Theme.spacingL
spacing: Theme.spacingM
StyledText {
text: "Existing Actions"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
ListView {
width: parent.width
height: Math.max(100, contentHeight)
clip: true
spacing: Theme.spacingXS
model: root.variantsModel
delegate: StyledRect {
required property var model
width: ListView.view.width
height: variantColumn.implicitHeight + Theme.spacingM * 2
radius: Theme.cornerRadius
color: variantMouseArea.containsMouse ? Theme.surfaceContainerHighest : Theme.surfaceContainer
Column {
id: variantColumn
anchors.fill: parent
anchors.margins: Theme.spacingM
spacing: Theme.spacingXS
Row {
width: parent.width
spacing: Theme.spacingM
Item {
width: Theme.iconSize
height: Theme.iconSize
anchors.verticalCenter: parent.verticalCenter
DankIcon {
anchors.centerIn: parent
name: model.icon || "terminal"
size: Theme.iconSize
color: Theme.surfaceText
}
}
Column {
anchors.verticalCenter: parent.verticalCenter
spacing: 2
width: parent.width - Theme.iconSize - (editButton.width + deleteButton.width + Theme.spacingXS) - Theme.spacingM * 3
StyledText {
text: model.name || "Unnamed"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
width: parent.width
elide: Text.ElideRight
}
StyledText {
text: {
var parts = []
if (model.displayText) parts.push("Text: " + model.displayText)
if (model.displayCommand) parts.push("Cmd: " + model.displayCommand)
if (model.updateInterval && model.updateInterval > 0) parts.push("Update: " + model.updateInterval + "s")
return parts.join(" | ") || "No display config"
}
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: parent.width
elide: Text.ElideRight
}
StyledText {
text: {
var actions = []
if (model.clickCommand) actions.push("L: " + model.clickCommand)
if (model.middleClickCommand) actions.push("M: " + model.middleClickCommand)
if (model.rightClickCommand) actions.push("R: " + model.rightClickCommand)
return actions.join(" | ") || "No click actions"
}
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: parent.width
elide: Text.ElideRight
}
}
Row {
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
Rectangle {
id: editButton
width: 32
height: 32
radius: 16
color: editArea.containsMouse ? Theme.primary : "transparent"
DankIcon {
anchors.centerIn: parent
name: "edit"
size: 16
color: editArea.containsMouse ? Theme.onPrimary : Theme.surfaceVariantText
}
MouseArea {
id: editArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
root.loadVariantForEditing(model)
}
}
}
Rectangle {
id: deleteButton
width: 32
height: 32
radius: 16
color: deleteArea.containsMouse ? Theme.error : "transparent"
DankIcon {
anchors.centerIn: parent
name: "delete"
size: 16
color: deleteArea.containsMouse ? Theme.onError : Theme.surfaceVariantText
}
MouseArea {
id: deleteArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
removeVariant(model.id)
}
}
}
}
}
}
MouseArea {
id: variantMouseArea
anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true
}
}
StyledText {
anchors.centerIn: parent
text: "No actions created yet"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
visible: variantsModel.count === 0
}
}
}
}
StyledRect {
width: parent.width
height: examplesColumn.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Theme.surface
Column {
id: examplesColumn
anchors.fill: parent
anchors.margins: Theme.spacingL
spacing: Theme.spacingM
Row {
spacing: Theme.spacingM
DankIcon {
name: "lightbulb"
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: "Usage Examples"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
}
Column {
width: parent.width
spacing: Theme.spacingS
StyledText {
text: "• Power Profile Cycler"
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: Theme.surfaceText
}
StyledText {
text: "Display: powerprofilesctl get\nClick: powerprofilesctl set $(powerprofilesctl list | grep -v \"$(powerprofilesctl get)\" | head -1)"
font.pixelSize: Theme.fontSizeSmall
font.family: "monospace"
color: Theme.surfaceVariantText
wrapMode: Text.Wrap
width: parent.width
leftPadding: Theme.spacingM
}
StyledText {
text: "• System Uptime"
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: Theme.surfaceText
}
StyledText {
text: "Display: uptime -p | sed 's/up //'\nClick: notify-send \"Uptime\" \"$(uptime -p)\""
font.pixelSize: Theme.fontSizeSmall
font.family: "monospace"
color: Theme.surfaceVariantText
wrapMode: Text.Wrap
width: parent.width
leftPadding: Theme.spacingM
}
StyledText {
text: "• Custom Greeting"
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: Theme.surfaceText
}
StyledText {
text: "Display: echo \"Hello $(whoami)!\"\nClick: notify-send \"Hi!\" \"Welcome back!\""
font.pixelSize: Theme.fontSizeSmall
font.family: "monospace"
color: Theme.surfaceVariantText
wrapMode: Text.Wrap
width: parent.width
leftPadding: Theme.spacingM
}
}
StyledText {
text: "After creating actions, add them to your bar from Bar Settings → Add Widget"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
}
}
}

View file

@ -0,0 +1,263 @@
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Common
import qs.Services
import qs.Widgets
import qs.Modules.Plugins
PluginComponent {
id: root
property string variantId: ""
property var variantData: null
property string displayIcon: "terminal"
property string displayText: ""
property string displayCommand: ""
property string clickCommand: ""
property string middleClickCommand: ""
property string rightClickCommand: ""
property int updateInterval: 0
property bool showIcon: true
property bool showText: true
property string currentOutput: ""
property bool isLoading: false
onVariantDataChanged: {
updatePropertiesFromVariantData()
}
Connections {
target: PluginService
function onPluginDataChanged(changedPluginId) {
if (changedPluginId === "dankActions" && variantId) {
const newData = PluginService.getPluginVariantData("dankActions", variantId)
if (newData) {
variantData = newData
}
}
}
}
function updatePropertiesFromVariantData() {
if (!variantData) {
displayIcon = "terminal"
displayText = ""
displayCommand = ""
clickCommand = ""
middleClickCommand = ""
rightClickCommand = ""
updateInterval = 0
showIcon = true
showText = true
currentOutput = ""
return
}
displayIcon = variantData.icon || "terminal"
displayText = variantData.displayText || ""
displayCommand = variantData.displayCommand || ""
clickCommand = variantData.clickCommand || ""
middleClickCommand = variantData.middleClickCommand || ""
rightClickCommand = variantData.rightClickCommand || ""
updateInterval = variantData.updateInterval || 0
showIcon = variantData.showIcon !== undefined ? variantData.showIcon : true
showText = variantData.showText !== undefined ? variantData.showText : true
if (displayCommand) {
Qt.callLater(refreshOutput)
} else {
currentOutput = displayText
}
if (updateInterval > 0) {
updateTimer.restart()
}
}
onDisplayCommandChanged: {
if (displayCommand) {
Qt.callLater(refreshOutput)
} else {
currentOutput = displayText
}
}
onDisplayTextChanged: {
if (!displayCommand) {
currentOutput = displayText
}
}
onUpdateIntervalChanged: {
if (updateInterval > 0) {
updateTimer.restart()
} else {
updateTimer.stop()
}
}
Component.onCompleted: {
if (displayCommand) {
Qt.callLater(refreshOutput)
} else {
currentOutput = displayText
}
if (updateInterval > 0) {
updateTimer.start()
}
}
Timer {
id: updateTimer
interval: root.updateInterval * 1000
repeat: true
running: false
onTriggered: {
if (root.displayCommand) {
root.refreshOutput()
}
}
}
function refreshOutput() {
if (!displayCommand) {
currentOutput = displayText
return
}
isLoading = true
displayProcess.running = true
}
function executeCommand(command) {
if (!command) return
isLoading = true
actionProcess.command = ["sh", "-c", command]
actionProcess.running = true
}
Process {
id: displayProcess
command: ["sh", "-c", root.displayCommand]
running: false
stdout: SplitParser {
onRead: data => {
root.currentOutput = data.trim()
}
}
onExited: (exitCode, exitStatus) => {
root.isLoading = false
if (exitCode !== 0) {
console.warn("CustomActions: Display command failed with code", exitCode)
}
}
}
Process {
id: actionProcess
command: ["sh", "-c", ""]
running: false
onExited: (exitCode, exitStatus) => {
root.isLoading = false
if (exitCode === 0) {
if (root.displayCommand) {
root.refreshOutput()
}
} else {
console.warn("CustomActions: Action command failed with code", exitCode)
}
}
}
pillClickAction: () => {
if (root.clickCommand) {
root.executeCommand(root.clickCommand)
}
}
horizontalBarPill: Component {
MouseArea {
implicitWidth: contentRow.implicitWidth
implicitHeight: contentRow.implicitHeight
acceptedButtons: Qt.MiddleButton | Qt.RightButton
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: (mouse) => {
if (mouse.button === Qt.MiddleButton && root.middleClickCommand) {
root.executeCommand(root.middleClickCommand)
} else if (mouse.button === Qt.RightButton && root.rightClickCommand) {
root.executeCommand(root.rightClickCommand)
}
}
Row {
id: contentRow
spacing: Theme.spacingXS
DankIcon {
name: root.displayIcon
size: Theme.iconSize - 6
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
visible: root.showIcon
}
StyledText {
text: root.currentOutput || ""
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
visible: root.showText && root.currentOutput
}
}
}
}
verticalBarPill: Component {
MouseArea {
implicitWidth: contentColumn.implicitWidth
implicitHeight: contentColumn.implicitHeight
acceptedButtons: Qt.MiddleButton | Qt.RightButton
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: (mouse) => {
if (mouse.button === Qt.MiddleButton && root.middleClickCommand) {
root.executeCommand(root.middleClickCommand)
} else if (mouse.button === Qt.RightButton && root.rightClickCommand) {
root.executeCommand(root.rightClickCommand)
}
}
Column {
id: contentColumn
spacing: Theme.spacingXS
DankIcon {
name: root.displayIcon
size: Theme.iconSize - 6
color: Theme.surfaceText
anchors.horizontalCenter: parent.horizontalCenter
visible: root.showIcon
}
StyledText {
text: root.currentOutput || ""
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: Theme.surfaceText
anchors.horizontalCenter: parent.horizontalCenter
visible: root.showText && root.currentOutput
}
}
}
}
}

View file

@ -0,0 +1,15 @@
{
"id": "dankActions",
"name": "Dank Actions",
"description": "Execute custom commands with dynamic output display and configurable icons",
"version": "1.0.3",
"author": "Avenge Media",
"icon": "terminal",
"firstParty": true,
"component": "./DankActionsWidget.qml",
"settings": "./DankActionsSettings.qml",
"permissions": [
"settings_read",
"settings_write"
]
}

View file

@ -0,0 +1,110 @@
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Common
import qs.Services
import qs.Modules.Plugins
PluginComponent {
id: root
Item {}
property bool enableCriticalAlert: pluginData.enableCriticalAlert ?? true
property int criticalThreshold: pluginData.criticalThreshold ?? 10
property string criticalTitle: pluginData.criticalTitle || "Critical Battery Level"
property string criticalMessage: pluginData.criticalMessage || "Battery at ${level}% - Connect charger immediately!"
property bool enableWarningAlert: pluginData.enableWarningAlert ?? true
property int warningThreshold: pluginData.warningThreshold ?? 20
property string warningTitle: pluginData.warningTitle || "Low Battery"
property string warningMessage: pluginData.warningMessage || "Battery at ${level}% - Consider charging soon"
property bool criticalAlertSent: false
property bool warningAlertSent: false
Component.onCompleted: {
console.log("DankBatteryAlerts: Started monitoring battery level")
console.log("DankBatteryAlerts: Critical alerts:", enableCriticalAlert, "at", criticalThreshold + "%")
console.log("DankBatteryAlerts: Warning alerts:", enableWarningAlert, "at", warningThreshold + "%")
}
Connections {
target: BatteryService.batteryAvailable ? BatteryService : null
function onBatteryLevelChanged() {
const level = BatteryService.batteryLevel
const isCharging = BatteryService.isCharging
if (isCharging) {
criticalAlertSent = false
warningAlertSent = false
return
}
if (enableCriticalAlert && level <= criticalThreshold && !criticalAlertSent) {
sendNotification(
criticalTitle,
criticalMessage.replace("${level}", level),
"critical",
"battery_alert"
)
criticalAlertSent = true
} else if (enableWarningAlert && level <= warningThreshold && !warningAlertSent && !criticalAlertSent) {
sendNotification(
warningTitle,
warningMessage.replace("${level}", level),
"normal",
"battery_std"
)
warningAlertSent = true
}
if (level > warningThreshold) {
warningAlertSent = false
}
if (level > criticalThreshold) {
criticalAlertSent = false
}
}
}
function sendNotification(title, message, urgency, icon) {
const process = notifyProcessComponent.createObject(root, {
notifyTitle: title,
notifyMessage: message,
notifyUrgency: urgency,
notifyIcon: icon
})
process.running = true
}
Component {
id: notifyProcessComponent
Process {
property string notifyTitle: ""
property string notifyMessage: ""
property string notifyUrgency: "normal"
property string notifyIcon: "battery_alert"
command: [
"notify-send",
"-a", "DankMaterialShell",
"-i", notifyIcon,
"-u", notifyUrgency,
notifyTitle,
notifyMessage
]
onExited: (exitCode) => {
if (exitCode !== 0) {
console.error("DankBatteryAlerts: notify-send failed with code:", exitCode)
}
destroy()
}
}
}
Component.onDestruction: {
console.log("DankBatteryAlerts: Stopped monitoring battery level")
}
}

View file

@ -0,0 +1,139 @@
import QtQuick
import qs.Common
import qs.Widgets
import qs.Modules.Plugins
PluginSettings {
id: root
pluginId: "dankBatteryAlerts"
StyledText {
text: "Battery Alerts"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
color: Theme.surfaceText
}
StyledText {
text: "Get notified when battery reaches critical or warning levels while on battery power"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: parent.width
wrapMode: Text.WordWrap
}
StyledRect {
width: parent.width
height: 1
color: Theme.surfaceVariant
}
StyledText {
text: "Critical Alert"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.DemiBold
color: Theme.surfaceText
}
ToggleSetting {
settingKey: "enableCriticalAlert"
label: "Enable Critical Alert"
description: "Show urgent notification when battery reaches critical level"
defaultValue: true
}
SliderSetting {
settingKey: "criticalThreshold"
label: "Critical Threshold"
description: "Battery percentage to trigger critical alert"
defaultValue: 10
minimum: 1
maximum: 30
unit: "%"
rightIcon: "battery_alert"
}
StringSetting {
settingKey: "criticalTitle"
label: "Critical Title"
description: "Notification title for critical alerts"
placeholder: "Critical Battery Level"
defaultValue: "Critical Battery Level"
}
StringSetting {
settingKey: "criticalMessage"
label: "Critical Message"
description: "Use ${level} for battery percentage"
placeholder: "Battery at ${level}% - Connect charger immediately!"
defaultValue: "Battery at ${level}% - Connect charger immediately!"
}
StyledRect {
width: parent.width
height: 1
color: Theme.surfaceVariant
}
StyledText {
text: "Warning Alert"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.DemiBold
color: Theme.surfaceText
}
ToggleSetting {
settingKey: "enableWarningAlert"
label: "Enable Warning Alert"
description: "Show notification when battery reaches warning level"
defaultValue: true
}
SliderSetting {
settingKey: "warningThreshold"
label: "Warning Threshold"
description: "Battery percentage to trigger warning alert"
defaultValue: 20
minimum: 5
maximum: 50
unit: "%"
rightIcon: "battery_std"
}
StringSetting {
settingKey: "warningTitle"
label: "Warning Title"
description: "Notification title for warning alerts"
placeholder: "Low Battery"
defaultValue: "Low Battery"
}
StringSetting {
settingKey: "warningMessage"
label: "Warning Message"
description: "Use ${level} for battery percentage"
placeholder: "Battery at ${level}% - Consider charging soon"
defaultValue: "Battery at ${level}% - Consider charging soon"
}
StyledRect {
width: parent.width
height: 1
color: Theme.surfaceVariant
}
StyledText {
text: "Alert Behavior"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.DemiBold
color: Theme.surfaceText
}
StyledText {
text: "• Critical alerts use urgent priority and persist longer\n• Alerts reset when battery is charging or rises above threshold\n• Only one alert per threshold per battery discharge cycle"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: parent.width
wrapMode: Text.WordWrap
}
}

View file

@ -0,0 +1,12 @@
{
"id": "dankBatteryAlerts",
"name": "Dank Battery Alerts",
"description": "Receive notifications when battery level reaches critical or warning thresholds",
"version": "1.1.0",
"author": "Avenge Media",
"icon": "battery_alert",
"type": "daemon",
"component": "./DankBatteryAlerts.qml",
"settings": "./DankBatteryAlertsSettings.qml",
"permissions": ["settings_read", "settings_write"]
}

View file

@ -0,0 +1,270 @@
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Common
import qs.Services
import qs.Modules.Plugins
PluginComponent {
id: root
property bool preparingForSleep: false
property string hookWallpaperPath: pluginData.wallpaperPath || ""
property string hookLightMode: pluginData.lightMode || ""
property string hookTheme: pluginData.theme || ""
property string hookBatteryLevel: pluginData.batteryLevel || ""
property string hookBatteryCharging: pluginData.batteryCharging || ""
property string hookBatteryPluggedIn: pluginData.batteryPluggedIn || ""
property string hookPowerRequestLock: pluginData.hookPowerRequestLock || ""
property string hookPowerMonitorOff: pluginData.hookPowerMonitorOff || ""
property string hookPowerMonitorOn: pluginData.hookPowerMonitorOn || ""
property string hookPowerSuspend: pluginData.hookPowerSuspend || ""
property string hookResumeFromSleep: pluginData.hookResumeFromSleep || ""
property string hookWifiConnected: pluginData.wifiConnected || ""
property string hookWifiSSID: pluginData.wifiSSID || ""
property string hookEthernetConnected: pluginData.ethernetConnected || ""
property string hookAudioVolume: pluginData.audioVolume || ""
property string hookAudioMute: pluginData.audioMute || ""
property string hookMicMute: pluginData.micMute || ""
property string hookBrightness: pluginData.brightness || ""
property string hookNightMode: pluginData.nightMode || ""
property string hookDoNotDisturb: pluginData.doNotDisturb || ""
property string hookMediaPlaying: pluginData.mediaPlaying || ""
property string hookIdleStateActive: pluginData.idleStateActive || ""
property string hookMonitorWallpaper: pluginData.monitorWallpaper || ""
Connections {
target: SessionData
function onWallpaperPathChanged() {
if (hookWallpaperPath) {
executeHook(hookWallpaperPath, "onWallpaperChanged", SessionData.wallpaperPath)
}
}
function onMonitorWallpapersChanged() {
if (hookMonitorWallpaper) {
const wallpapersJson = JSON.stringify(SessionData.monitorWallpapers)
executeHook(hookMonitorWallpaper, "onMonitorWallpapersChanged", wallpapersJson)
}
}
function onIsLightModeChanged() {
if (hookLightMode) {
executeHook(hookLightMode, "onLightModeChanged", SessionData.isLightMode ? "light" : "dark")
}
}
function onNightModeEnabledChanged() {
if (hookNightMode) {
executeHook(hookNightMode, "onNightModeChanged", SessionData.nightModeEnabled ? "enabled" : "disabled")
}
}
function onDoNotDisturbChanged() {
if (hookDoNotDisturb) {
executeHook(hookDoNotDisturb, "onDoNotDisturbChanged", SessionData.doNotDisturb ? "enabled" : "disabled")
}
}
}
Connections {
target: typeof Theme !== "undefined" ? Theme : null
function onCurrentThemeChanged() {
if (hookTheme) {
executeHook(hookTheme, "onThemeChanged", Theme.currentTheme)
}
}
}
Connections {
target: BatteryService.batteryAvailable ? BatteryService : null
function onBatteryLevelChanged() {
if (hookBatteryLevel) {
executeHook(hookBatteryLevel, "onBatteryLevelChanged", String(BatteryService.batteryLevel))
}
}
function onIsChargingChanged() {
if (hookBatteryCharging) {
executeHook(hookBatteryCharging, "onBatteryChargingChanged", BatteryService.isCharging ? "charging" : "not-charging")
}
}
function onIsPluggedInChanged() {
if (hookBatteryPluggedIn) {
executeHook(hookBatteryPluggedIn, "onBatteryPluggedInChanged", BatteryService.isPluggedIn ? "plugged-in" : "on-battery")
}
}
}
Connections {
target: IdleService
function onLockRequested() {
if (hookPowerRequestLock) {
executeHook(hookPowerRequestLock, "onLockRequested", "")
}
}
function onRequestMonitorOff() {
if (hookPowerMonitorOff) {
executeHook(hookPowerMonitorOff, "onRequestMonitorOff", "")
}
}
function onRequestMonitorOn() {
if (hookPowerMonitorOn) {
executeHook(hookPowerMonitorOn, "onRequestMonitorOn", "")
}
}
function onRequestSuspend() {
if (hookPowerSuspend) {
executeHook(hookPowerSuspend, "onRequestSuspend", "")
}
}
}
Connections {
target: DMSService
function onLoginctlStateUpdate(data) {
var lastState = root.preparingForSleep
root.preparingForSleep = data.preparingForSleep
if (lastState && !root.preparingForSleep) {
executeHook(hookResumeFromSleep, "onResumeFromSleep", "")
}
}
}
Connections {
target: NetworkService
function onWifiConnectedChanged() {
if (hookWifiConnected) {
executeHook(hookWifiConnected, "onWifiConnectedChanged", NetworkService.wifiConnected ? "connected" : "disconnected")
}
}
function onCurrentWifiSSIDChanged() {
if (hookWifiSSID) {
executeHook(hookWifiSSID, "onWifiSSIDChanged", NetworkService.currentWifiSSID || "none")
}
}
function onEthernetConnectedChanged() {
if (hookEthernetConnected) {
executeHook(hookEthernetConnected, "onEthernetConnectedChanged", NetworkService.ethernetConnected ? "connected" : "disconnected")
}
}
}
Connections {
target: AudioService.sink && AudioService.sink.audio ? AudioService.sink.audio : null
function onVolumeChanged() {
if (hookAudioVolume && AudioService.sink && AudioService.sink.audio) {
executeHook(hookAudioVolume, "onAudioVolumeChanged", String(Math.round(AudioService.sink.audio.volume * 100)))
}
}
function onMutedChanged() {
if (hookAudioMute && AudioService.sink && AudioService.sink.audio) {
executeHook(hookAudioMute, "onAudioMuteChanged", AudioService.sink.audio.muted ? "muted" : "unmuted")
}
}
}
Connections {
target: AudioService.source && AudioService.source.audio ? AudioService.source.audio : null
function onMutedChanged() {
if (hookMicMute && AudioService.source && AudioService.source.audio) {
executeHook(hookMicMute, "onMicMuteChanged", AudioService.source.audio.muted ? "muted" : "unmuted")
}
}
}
Connections {
target: DisplayService
function onBrightnessLevelChanged() {
if (hookBrightness && DisplayService.brightnessAvailable) {
executeHook(hookBrightness, "onBrightnessChanged", String(DisplayService.brightnessLevel))
}
}
}
Connections {
target: MprisController.activePlayer
function onIsPlayingChanged() {
if (hookMediaPlaying && MprisController.activePlayer) {
executeHook(hookMediaPlaying, "onMediaPlayingChanged", MprisController.activePlayer.isPlaying ? "playing" : "paused")
}
}
}
function executeHook(scriptPath, hookName, hookValue) {
if (!scriptPath || scriptPath.trim() === "") {
return
}
const process = hookProcessComponent.createObject(root, {
hookScript: scriptPath,
hookName: hookName,
hookValue: hookValue
})
if (!process) {
console.error("DankHooks: Failed to create process object")
return
}
process.running = true
}
Component {
id: hookProcessComponent
Process {
property string hookScript: ""
property string hookName: ""
property string hookValue: ""
command: ["sh", "-c", "$HOOK_SCRIPT \"$HOOK_NAME\" \"$HOOK_VALUE\""]
environment: {
"HOOK_SCRIPT": hookScript,
"HOOK_NAME": hookName,
"HOOK_VALUE": hookValue
}
stdout: StdioCollector {
onStreamFinished: {
if (text.trim()) {
console.log("DankHooks output:", text.trim())
}
}
}
stderr: StdioCollector {
onStreamFinished: {
if (text.trim()) {
ToastService.showError("Hook Script Error", text.trim())
}
}
}
onExited: (exitCode) => {
if (exitCode !== 0) {
ToastService.showError("Hook Script Error", `Script '${hookScript}' exited with code: ${exitCode}`)
}
destroy()
}
}
}
Component.onDestruction: {
console.log("DankHooks: Stopped monitoring system events")
}
}

View file

@ -0,0 +1,324 @@
import QtQuick
import qs.Common
import qs.Widgets
import qs.Modules.Plugins
PluginSettings {
id: root
pluginId: "dankHooks"
StyledText {
text: "System Event Hooks"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
color: Theme.surfaceText
}
StyledText {
text: "Execute custom scripts when system events occur. Scripts receive two arguments: hook name (e.g., 'onBatteryLevelChanged') and event value."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: parent.width
wrapMode: Text.WordWrap
}
StyledRect {
width: parent.width
height: 1
color: Theme.surfaceVariant
}
StyledText {
text: "Appearance & Theme"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.DemiBold
color: Theme.surfaceText
}
StringSetting {
settingKey: "wallpaperPath"
label: "Wallpaper Changed"
description: "Hook: onWallpaperChanged | Value: wallpaper file path"
placeholder: "/path/to/wallpaper-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "monitorWallpaper"
label: "Per-Monitor Wallpapers Changed"
description: "Hook: onMonitorWallpapersChanged | Value: JSON object with all monitors (e.g., '{\"eDP-1\":\"/path1.jpg\",\"DP-2\":\"/path2.jpg\"}')"
placeholder: "/path/to/monitor-wallpaper-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "lightMode"
label: "Light/Dark Mode Changed"
description: "Hook: onLightModeChanged | Value: 'light' or 'dark'"
placeholder: "/path/to/mode-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "theme"
label: "Theme Changed"
description: "Hook: onThemeChanged | Value: theme name (e.g., 'blue', 'red', 'dynamic')"
placeholder: "/path/to/theme-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "nightMode"
label: "Night Mode Changed"
description: "Hook: onNightModeChanged | Value: 'enabled' or 'disabled'"
placeholder: "/path/to/nightmode-hook.sh"
defaultValue: ""
}
StyledRect {
width: parent.width
height: 1
color: Theme.surfaceVariant
}
StyledText {
text: "Power & Battery"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.DemiBold
color: Theme.surfaceText
}
StringSetting {
settingKey: "batteryLevel"
label: "Battery Level Changed"
description: "Hook: onBatteryLevelChanged | Value: percentage (0-100)"
placeholder: "/path/to/battery-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "batteryCharging"
label: "Battery Charging State Changed"
description: "Hook: onBatteryChargingChanged | Value: 'charging' or 'not-charging'"
placeholder: "/path/to/charging-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "batteryPluggedIn"
label: "Power Adapter Changed"
description: "Hook: onBatteryPluggedInChanged | Value: 'plugged-in' or 'on-battery'"
placeholder: "/path/to/power-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "hookPowerRequestLock"
label: "Lock Screen Event Triggered"
description: "Hook: onLockRequested | Value: empty"
placeholder: "/path/to/sessionlock-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "hookPowerMonitorOff"
label: "Monitor Off Event Triggered"
description: "Hook: onRequestMonitorOff | Value: empty"
placeholder: "/path/to/monitoroff-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "hookPowerMonitorOn"
label: "Monitor On Event Triggered"
description: "Hook: onRequestMonitorOn | Value: empty"
placeholder: "/path/to/monitoron-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "hookPowerSuspend"
label: "Suspend Event Triggered"
description: "Hook: onRequestSuspend | Value: empty"
placeholder: "/path/to/suspend-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "hookResumeFromSleep"
label: "Resume From Sleep Event Triggered"
description: "Hook: onResumeFromSleep | Value: empty"
placeholder: "/path/to/resumeFromSleep-hook.sh"
defaultValue: ""
}
StyledRect {
width: parent.width
height: 1
color: Theme.surfaceVariant
}
StyledText {
text: "Network"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.DemiBold
color: Theme.surfaceText
}
StringSetting {
settingKey: "wifiConnected"
label: "WiFi Connection Changed"
description: "Hook: onWifiConnectedChanged | Value: 'connected' or 'disconnected'"
placeholder: "/path/to/wifi-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "wifiSSID"
label: "WiFi Network Changed"
description: "Hook: onWifiSSIDChanged | Value: SSID name or 'none'"
placeholder: "/path/to/ssid-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "ethernetConnected"
label: "Ethernet Connection Changed"
description: "Hook: onEthernetConnectedChanged | Value: 'connected' or 'disconnected'"
placeholder: "/path/to/ethernet-hook.sh"
defaultValue: ""
}
StyledRect {
width: parent.width
height: 1
color: Theme.surfaceVariant
}
StyledText {
text: "Audio"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.DemiBold
color: Theme.surfaceText
}
StringSetting {
settingKey: "audioVolume"
label: "Audio Volume Changed"
description: "Hook: onAudioVolumeChanged | Value: percentage (0-100)"
placeholder: "/path/to/volume-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "audioMute"
label: "Audio Mute Changed"
description: "Hook: onAudioMuteChanged | Value: 'muted' or 'unmuted'"
placeholder: "/path/to/mute-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "micMute"
label: "Microphone Mute Changed"
description: "Hook: onMicMuteChanged | Value: 'muted' or 'unmuted'"
placeholder: "/path/to/mic-hook.sh"
defaultValue: ""
}
StyledRect {
width: parent.width
height: 1
color: Theme.surfaceVariant
}
StyledText {
text: "Display & Media"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.DemiBold
color: Theme.surfaceText
}
StringSetting {
settingKey: "brightness"
label: "Brightness Changed"
description: "Hook: onBrightnessChanged | Value: percentage (0-100)"
placeholder: "/path/to/brightness-hook.sh"
defaultValue: ""
}
StringSetting {
settingKey: "mediaPlaying"
label: "Media Playback Changed"
description: "Hook: onMediaPlayingChanged | Value: 'playing' or 'paused'"
placeholder: "/path/to/media-hook.sh"
defaultValue: ""
}
StyledRect {
width: parent.width
height: 1
color: Theme.surfaceVariant
}
StyledText {
text: "System"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.DemiBold
color: Theme.surfaceText
}
StringSetting {
settingKey: "doNotDisturb"
label: "Do Not Disturb Changed"
description: "Hook: onDoNotDisturbChanged | Value: 'enabled' or 'disabled'"
placeholder: "/path/to/dnd-hook.sh"
defaultValue: ""
}
StyledRect {
width: parent.width
height: 1
color: Theme.surfaceVariant
}
StyledText {
text: "Hook Script Examples"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.DemiBold
color: Theme.surfaceText
}
StyledText {
text: "Example hook script:"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledRect {
width: parent.width
height: exampleCode.height + 16
color: Theme.surface
radius: Theme.cornerRadius
StyledText {
id: exampleCode
anchors.centerIn: parent
anchors.margins: 8
width: parent.width - 16
text: '#!/bin/bash\n# Save as ~/.config/scripts/hook.sh\n# Make executable: chmod +x ~/.config/scripts/hook.sh\n\nHOOK_NAME="$1" # e.g., "onWallpaperChanged"\nHOOK_VALUE="$2" # e.g., "/path/to/wallpaper.jpg"\n\necho "Hook: $HOOK_NAME, Value: $HOOK_VALUE"\nnotify-send "$HOOK_NAME" "$HOOK_VALUE"'
font.pixelSize: Theme.fontSizeSmall
font.family: "monospace"
color: Theme.surfaceText
wrapMode: Text.WordWrap
}
}
StyledText {
text: "All hooks pass two arguments: $1 = hook name (e.g., 'onBatteryLevelChanged'), $2 = event value. See descriptions above for each hook's values."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: parent.width
wrapMode: Text.WordWrap
}
}

View file

@ -0,0 +1,49 @@
# Dank Hooks Plugin
## Available Hooks
### Appearance & Theme
| Hook | Trigger | Hook Name | Value |
|------|---------|-----------|-------|
| **Wallpaper Changed** | When wallpaper changes | `onWallpaperChanged` | Wallpaper file path |
| **Light/Dark Mode Changed** | When switching between modes | `onLightModeChanged` | `light` or `dark` |
| **Theme Changed** | When color theme changes | `onThemeChanged` | Theme name (e.g., `blue`, `red`, `dynamic`) |
| **Night Mode Changed** | When night mode toggles | `onNightModeChanged` | `enabled` or `disabled` |
### Power & Battery
| Hook | Trigger | Hook Name | Value |
|------|---------|-----------|-------|
| **Battery Level Changed** | When battery percentage changes | `onBatteryLevelChanged` | Battery percentage (0-100) |
| **Battery Charging State Changed** | When charging state changes | `onBatteryChargingChanged` | `charging` or `not-charging` |
| **Power Adapter Changed** | When power adapter connects/disconnects | `onBatteryPluggedInChanged` | `plugged-in` or `on-battery` |
### Network
| Hook | Trigger | Hook Name | Value |
|------|---------|-----------|-------|
| **WiFi Connection Changed** | When WiFi connects/disconnects | `onWifiConnectedChanged` | `connected` or `disconnected` |
| **WiFi Network Changed** | When connected WiFi network changes | `onWifiSSIDChanged` | SSID name or `none` |
| **Ethernet Connection Changed** | When Ethernet connects/disconnects | `onEthernetConnectedChanged` | `connected` or `disconnected` |
### Audio
| Hook | Trigger | Hook Name | Value |
|------|---------|-----------|-------|
| **Audio Volume Changed** | When speaker volume changes | `onAudioVolumeChanged` | Volume percentage (0-100) |
| **Audio Mute Changed** | When speakers mute/unmute | `onAudioMuteChanged` | `muted` or `unmuted` |
| **Microphone Mute Changed** | When microphone mutes/unmutes | `onMicMuteChanged` | `muted` or `unmuted` |
### Display & Media
| Hook | Trigger | Hook Name | Value |
|------|---------|-----------|-------|
| **Brightness Changed** | When screen brightness changes | `onBrightnessChanged` | Brightness percentage (0-100) |
| **Media Playback Changed** | When media starts/stops playing | `onMediaPlayingChanged` | `playing` or `paused` |
### System
| Hook | Trigger | Hook Name | Value |
|------|---------|-----------|-------|
| **Do Not Disturb Changed** | When DND mode toggles | `onDoNotDisturbChanged` | `enabled` or `disabled` |

View file

@ -0,0 +1,15 @@
{
"id": "dankHooks",
"name": "Dank Hooks",
"description": "Execute custom scripts on system events like wallpaper changes, theme updates, battery level changes, and more",
"version": "1.0.5",
"author": "Avenge Media",
"icon": "webhook",
"type": "daemon",
"component": "./DankHooks.qml",
"settings": "./DankHooksSettings.qml",
"permissions": [
"settings_read",
"settings_write"
]
}

View file

@ -0,0 +1,149 @@
import QtQuick
import QtQuick.Controls
import qs.Common
import qs.Services
import qs.Widgets
import qs.Modules.Plugins
PluginSettings {
id: root
pluginId: "dankPomodoroTimer"
StyledText {
width: parent.width
text: "Pomodoro Settings"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
color: Theme.surfaceText
}
StyledText {
width: parent.width
text: "Configure timer durations and behavior"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
}
StyledRect {
width: parent.width
height: durationsColumn.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Theme.surfaceContainerHigh
Column {
id: durationsColumn
anchors.fill: parent
anchors.margins: Theme.spacingL
spacing: Theme.spacingM
StyledText {
text: "Durations"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
StringSetting {
settingKey: "workDuration"
label: "Work Duration (minutes)"
description: "Length of each focus session"
placeholder: "25"
defaultValue: "25"
}
StringSetting {
settingKey: "shortBreakDuration"
label: "Short Break (minutes)"
description: "Break after each pomodoro"
placeholder: "5"
defaultValue: "5"
}
StringSetting {
settingKey: "longBreakDuration"
label: "Long Break (minutes)"
description: "Break after 4 pomodoros"
placeholder: "15"
defaultValue: "15"
}
}
}
StyledRect {
width: parent.width
height: behaviorColumn.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Theme.surfaceContainerHigh
Column {
id: behaviorColumn
anchors.fill: parent
anchors.margins: Theme.spacingL
spacing: Theme.spacingM
StyledText {
text: "Behavior"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
ToggleSetting {
settingKey: "autoStartBreaks"
label: "Auto-start Breaks"
description: "Automatically start break timers after work sessions"
defaultValue: false
}
ToggleSetting {
settingKey: "autoStartPomodoros"
label: "Auto-start Pomodoros"
description: "Automatically start work sessions after breaks"
defaultValue: false
}
}
}
StyledRect {
width: parent.width
height: infoColumn.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Theme.surface
Column {
id: infoColumn
anchors.fill: parent
anchors.margins: Theme.spacingL
spacing: Theme.spacingM
Row {
spacing: Theme.spacingM
DankIcon {
name: "info"
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: "About Pomodoro Technique"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
}
StyledText {
text: "The Pomodoro Technique uses 25-minute focused work sessions followed by short breaks. After 4 pomodoros, take a longer break to recharge.\n\n• Work: 25 minutes of focused work\n• Short Break: 5 minute rest\n• Long Break: 15 minutes after 4 pomodoros\n\nNotifications will alert you when each session completes."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
lineHeight: 1.4
}
}
}
}

View file

@ -0,0 +1,447 @@
import QtQuick
import Quickshell
import qs.Common
import qs.Services
import qs.Widgets
import qs.Modules.Plugins
PluginComponent {
id: root
property int workDuration: pluginData.workDuration || 25
property int shortBreakDuration: pluginData.shortBreakDuration || 5
property int longBreakDuration: pluginData.longBreakDuration || 15
property bool autoStartBreaks: pluginData.autoStartBreaks ?? false
property bool autoStartPomodoros: pluginData.autoStartPomodoros ?? false
onWorkDurationChanged: {
if (globalTimerState.value === "work" && globalTotalSeconds.value > 0) {
const newTotal = workDuration * 60
const elapsed = globalTotalSeconds.value - globalRemainingSeconds.value
globalTotalSeconds.set(newTotal)
globalRemainingSeconds.set(Math.max(1, newTotal - elapsed))
}
}
onShortBreakDurationChanged: {
if (globalTimerState.value === "shortBreak" && globalTotalSeconds.value > 0) {
const newTotal = shortBreakDuration * 60
const elapsed = globalTotalSeconds.value - globalRemainingSeconds.value
globalTotalSeconds.set(newTotal)
globalRemainingSeconds.set(Math.max(1, newTotal - elapsed))
}
}
onLongBreakDurationChanged: {
if (globalTimerState.value === "longBreak" && globalTotalSeconds.value > 0) {
const newTotal = longBreakDuration * 60
const elapsed = globalTotalSeconds.value - globalRemainingSeconds.value
globalTotalSeconds.set(newTotal)
globalRemainingSeconds.set(Math.max(1, newTotal - elapsed))
}
}
PluginGlobalVar {
id: globalRemainingSeconds
varName: "remainingSeconds"
defaultValue: 0
}
PluginGlobalVar {
id: globalTotalSeconds
varName: "totalSeconds"
defaultValue: 0
}
PluginGlobalVar {
id: globalIsRunning
varName: "isRunning"
defaultValue: false
}
PluginGlobalVar {
id: globalTimerState
varName: "timerState"
defaultValue: "work"
}
PluginGlobalVar {
id: globalCompletedPomodoros
varName: "completedPomodoros"
defaultValue: 0
}
PluginGlobalVar {
id: globalTimerOwnerId
varName: "timerOwnerId"
defaultValue: ""
}
property string instanceId: Math.random().toString(36).substring(2)
Timer {
id: pomodoroTimer
interval: 1000
repeat: true
running: globalIsRunning.value && globalTimerOwnerId.value === root.instanceId
onTriggered: {
if (globalRemainingSeconds.value > 0) {
globalRemainingSeconds.set(globalRemainingSeconds.value - 1)
} else {
root.timerComplete()
}
}
}
function timerComplete() {
globalIsRunning.set(false)
if (globalTimerState.value === "work") {
globalCompletedPomodoros.set(globalCompletedPomodoros.value + 1)
const isLongBreak = globalCompletedPomodoros.value % 4 === 0
Quickshell.execDetached(["sh", "-c", "notify-send 'Pomodoro Complete' 'Time for a " + (isLongBreak ? "long" : "short") + " break!' -u normal"])
if (isLongBreak) {
root.startLongBreak(root.autoStartBreaks)
} else {
root.startShortBreak(root.autoStartBreaks)
}
} else {
Quickshell.execDetached(["sh", "-c", "notify-send 'Break Complete' 'Ready for another pomodoro?' -u normal"])
root.startWork(root.autoStartPomodoros)
}
}
function startWork(autoStart) {
globalTimerState.set("work")
globalTotalSeconds.set(root.workDuration * 60)
globalRemainingSeconds.set(globalTotalSeconds.value)
if (autoStart) {
globalTimerOwnerId.set(root.instanceId)
}
globalIsRunning.set(autoStart ?? false)
}
function startShortBreak(autoStart) {
globalTimerState.set("shortBreak")
globalTotalSeconds.set(root.shortBreakDuration * 60)
globalRemainingSeconds.set(globalTotalSeconds.value)
if (autoStart) {
globalTimerOwnerId.set(root.instanceId)
}
globalIsRunning.set(autoStart ?? false)
}
function startLongBreak(autoStart) {
globalTimerState.set("longBreak")
globalTotalSeconds.set(root.longBreakDuration * 60)
globalRemainingSeconds.set(globalTotalSeconds.value)
if (autoStart) {
globalTimerOwnerId.set(root.instanceId)
}
globalIsRunning.set(autoStart ?? false)
}
function toggleTimer() {
if (!globalIsRunning.value) {
globalTimerOwnerId.set(root.instanceId)
}
globalIsRunning.set(!globalIsRunning.value)
}
function resetTimer() {
globalIsRunning.set(false)
globalRemainingSeconds.set(globalTotalSeconds.value)
}
function formatTime(seconds, isVertical = false) {
const mins = Math.floor(seconds / 60)
const secs = seconds % 60
return isVertical ? mins + "\n" + (secs < 10 ? "0" : "") + secs : mins + " " + (secs < 10 ? "0" : "") + secs
}
function getStateColor() {
if (globalTimerState.value === "work") return Theme.primary
if (globalTimerState.value === "shortBreak") return Theme.success
return Theme.warning
}
function getStateIcon() {
if (globalTimerState.value === "work") return "work"
return "coffee"
}
Timer {
id: initTimer
interval: 100
repeat: false
running: true
onTriggered: {
if (globalRemainingSeconds.value === 0 && globalTotalSeconds.value === 0) {
startWork(false)
}
}
}
horizontalBarPill: Component {
Row {
spacing: Theme.spacingXS
DankIcon {
name: root.getStateIcon()
size: Theme.iconSize - 6
color: root.getStateColor()
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: root.formatTime(globalRemainingSeconds.value)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter
}
}
}
verticalBarPill: Component {
Column {
spacing: Theme.spacingXS
DankIcon {
name: root.getStateIcon()
size: Theme.iconSize - 6
color: root.getStateColor()
anchors.horizontalCenter: parent.horizontalCenter
}
StyledText {
text: root.formatTime(globalRemainingSeconds.value, true)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: Theme.surfaceVariantText
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
popoutContent: Component {
PopoutComponent {
id: popout
headerText: "Pomodoro Timer"
detailsText: {
if (globalTimerState.value === "work") return "Focus session • " + globalCompletedPomodoros.value + " completed"
if (globalTimerState.value === "shortBreak") return "Short break"
return "Long break"
}
showCloseButton: true
Column {
id: popoutContentColumn
width: parent.width
spacing: Theme.spacingM
Item {
width: parent.width
height: 180
Rectangle {
width: 180
height: 180
radius: 90
anchors.centerIn: parent
color: "transparent"
border.width: 8
border.color: Qt.rgba(root.getStateColor().r, root.getStateColor().g, root.getStateColor().b, 0.2)
Canvas {
id: progressCanvas
width: parent.width - 16
height: parent.height - 16
anchors.centerIn: parent
onPaint: {
var ctx = getContext("2d")
ctx.clearRect(0, 0, width, height)
ctx.lineWidth = 8
ctx.strokeStyle = root.getStateColor()
ctx.beginPath()
const centerX = width / 2
const centerY = height / 2
const radius = (width - 8) / 2
const progress = globalRemainingSeconds.value / globalTotalSeconds.value
const startAngle = -Math.PI / 2
const endAngle = startAngle + (2 * Math.PI * progress)
ctx.arc(centerX, centerY, radius, startAngle, endAngle, false)
ctx.stroke()
}
Connections {
target: globalRemainingSeconds
function onValueChanged() {
progressCanvas.requestPaint()
}
}
}
Column {
anchors.centerIn: parent
spacing: Theme.spacingXS
StyledText {
text: root.formatTime(globalRemainingSeconds.value)
font.pixelSize: 36
font.weight: Font.Bold
color: root.getStateColor()
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
width: 120
}
StyledText {
text: {
if (globalTimerState.value === "work") return "Work"
if (globalTimerState.value === "shortBreak") return "Short Break"
return "Long Break"
}
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceVariantText
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
}
Row {
anchors.horizontalCenter: parent.horizontalCenter
spacing: Theme.spacingM
Rectangle {
width: 64
height: 64
radius: 32
color: playArea.containsMouse ? Qt.rgba(root.getStateColor().r, root.getStateColor().g, root.getStateColor().b, 0.2) : "transparent"
DankIcon {
anchors.centerIn: parent
name: globalIsRunning.value ? "pause" : "play_arrow"
size: 32
color: root.getStateColor()
}
MouseArea {
id: playArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.toggleTimer()
}
}
Rectangle {
width: 64
height: 64
radius: 32
color: resetArea.containsMouse ? Theme.surfaceContainerHighest : "transparent"
DankIcon {
anchors.centerIn: parent
name: "refresh"
size: 24
color: Theme.surfaceText
}
MouseArea {
id: resetArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.resetTimer()
}
}
}
Column {
width: parent.width
spacing: Theme.spacingS
StyledText {
text: "Quick Actions"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
Row {
id: quickActionsRow
width: parent.width
spacing: Theme.spacingS
property real buttonWidth: (width - spacing * 2) / 3
DankButton {
text: "Work"
iconName: "work"
width: quickActionsRow.buttonWidth
onClicked: root.startWork(false)
}
DankButton {
text: "Short Break"
iconName: "coffee"
width: quickActionsRow.buttonWidth
onClicked: root.startShortBreak(false)
}
DankButton {
text: "Long Break"
iconName: "weekend"
width: quickActionsRow.buttonWidth
onClicked: root.startLongBreak(false)
}
}
}
StyledRect {
width: parent.width
height: statsColumn.implicitHeight + Theme.spacingM * 2
radius: Theme.cornerRadius
color: Theme.surfaceContainerHigh
Column {
id: statsColumn
anchors.fill: parent
anchors.margins: Theme.spacingM
spacing: Theme.spacingXS
Row {
spacing: Theme.spacingM
DankIcon {
name: "check_circle"
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: globalCompletedPomodoros.value + " pomodoros completed"
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
}
StyledText {
text: "Next long break after " + (4 - (globalCompletedPomodoros.value % 4)) + " more"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
leftPadding: Theme.iconSize + Theme.spacingM
}
}
}
}
}
}
}

View file

@ -0,0 +1,15 @@
{
"id": "dankPomodoroTimer",
"name": "Dank Pomodoro Timer",
"description": "Productivity timer with 25-minute work sessions and breaks",
"version": "1.1.3",
"author": "Avenge Media",
"icon": "timer",
"firstParty": true,
"component": "./DankPomodoroWidget.qml",
"settings": "./DankPomodoroSettings.qml",
"permissions": [
"settings_read",
"settings_write"
]
}

View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View file

@ -0,0 +1,31 @@
# DankMaterialShell plugins
A collection of first-party, officially maintained plugins for [DankMaterialShell](https://github.com/AvengeMedia/DankMaterialShell)
## Plugins
### [Dank Actions](./DankActions)
Scriptable, custom actions that can be added to the DankBar.
Allows for creating multiple widgets that execute custom script actions on click, or periodically.
<img width="488" height="638" alt="image" src="https://github.com/user-attachments/assets/36b44c32-69b5-49c9-97d2-87f530e4b7fd" />
### [Dank Pomodoro Timer](./DankPomodoroTimer)
A timer that is intended to improve productivity using the [Pomodoro technique](https://en.wikipedia.org/wiki/Pomodoro_Technique).
<img width="442" height="545" alt="image" src="https://github.com/user-attachments/assets/b51b5f78-5215-403c-850f-c7e137097438" />
### [Dank Hooks](./DankHooks)
Trigger scripts based on various system events, such as `onWallpaperChanged`, `onVolumeChanged`, etc.
<img width="472" height="593" alt="image" src="https://github.com/user-attachments/assets/83e89b5b-0636-4b8e-ba29-1fa4d12169a0" />
### [Dank Battery Alerts](./DankBatteryAlerts)
Trigger notifications when battery reaches low charge levels.
<img width="497" height="710" alt="image" src="https://github.com/user-attachments/assets/4302d886-eb87-41d4-a9a4-1eeaadd787c6" />

View file

@ -0,0 +1 @@
ref: refs/heads/master

View file

@ -0,0 +1,9 @@
[core]
bare = false
filemode = true
[remote "origin"]
url = https://github.com/AvengeMedia/dms-plugins
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

View file

@ -0,0 +1 @@
8715ca35b61d7c6275a300fa4992e2b0490f70f7

View file

@ -0,0 +1 @@
8715ca35b61d7c6275a300fa4992e2b0490f70f7

View file

@ -0,0 +1,54 @@
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib
# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl
# Qt unit tests
target_wrapper.*
# QtCreator
*.autosave
# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*
# QtCreator CMake
CMakeLists.txt.user*
# QtCreator 4.8< compilation database
compile_commands.json
# QtCreator local machine specific files for imported projects
*creator.user*
*_qmlcache.qrc

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,251 @@
import QtQuick
import QtQuick.Controls
import qs.Common
import qs.Widgets
FocusScope {
id: root
property var pluginService: null
implicitHeight: settingsColumn.implicitHeight
height: implicitHeight
Column {
id: settingsColumn
anchors.fill: parent
anchors.margins: 16
spacing: 16
StyledText {
text: "Emoji & Unicode Launcher Settings"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
color: Theme.surfaceText
}
StyledText {
text: "Search and copy emojis and unicode characters directly from the launcher."
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width - 32
}
StyledRect {
width: parent.width - 32
height: 1
color: Theme.outlineVariant
}
Column {
spacing: 12
width: parent.width - 32
StyledText {
text: "Trigger Configuration"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
}
StyledText {
text: noTriggerToggle.checked ? "Items will always show in the launcher (no trigger needed)." : "Set the trigger text to activate this plugin. Type the trigger in the launcher to filter to emojis and unicode characters."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
Row {
spacing: 12
CheckBox {
id: noTriggerToggle
text: "No trigger (always show)"
checked: loadSettings("noTrigger", false)
contentItem: StyledText {
text: noTriggerToggle.text
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
leftPadding: noTriggerToggle.indicator.width + 8
verticalAlignment: Text.AlignVCenter
}
indicator: StyledRect {
implicitWidth: 20
implicitHeight: 20
radius: Theme.cornerRadiusSmall
border.color: noTriggerToggle.checked ? Theme.primary : Theme.outline
border.width: 2
color: noTriggerToggle.checked ? Theme.primary : "transparent"
StyledRect {
width: 12
height: 12
anchors.centerIn: parent
radius: 2
color: Theme.onPrimary
visible: noTriggerToggle.checked
}
}
onCheckedChanged: {
saveSettings("noTrigger", checked)
if (checked) {
saveSettings("trigger", "")
} else {
saveSettings("trigger", triggerField.text || ":")
}
}
}
}
Row {
spacing: 12
anchors.left: parent.left
anchors.right: parent.right
visible: !noTriggerToggle.checked
StyledText {
text: "Trigger:"
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
DankTextField {
id: triggerField
width: 100
height: 40
text: loadSettings("trigger", ":")
placeholderText: ":"
backgroundColor: Theme.surfaceContainer
textColor: Theme.surfaceText
onTextEdited: {
const newTrigger = text.trim()
saveSettings("trigger", newTrigger || ":")
saveSettings("noTrigger", newTrigger === "")
}
}
StyledText {
text: "Examples: :, ;, /emoji, etc."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter
}
}
}
StyledRect {
width: parent.width - 32
height: 1
color: Theme.outlineVariant
}
Column {
spacing: 8
width: parent.width - 32
StyledText {
text: "Features:"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
Column {
spacing: 4
leftPadding: 16
StyledText {
text: "• 1k+ emojis & unicode symbols (faces, tools, math, currency)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "• Nerd Font glyph catalog for launcher / terminal icons"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "• Search by name, character, or keyword"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "• Click to copy to clipboard"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
}
StyledRect {
width: parent.width - 32
height: 1
color: Theme.outlineVariant
}
Column {
spacing: 8
width: parent.width - 32
StyledText {
text: "Usage:"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
Column {
spacing: 4
leftPadding: 16
bottomPadding: 24
StyledText {
text: "1. Open Launcher (Ctrl+Space or click launcher button)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: noTriggerToggle.checked ? "2. Emojis are always visible in the launcher" : "2. Type your trigger (default: :) to filter to emojis/unicode"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: noTriggerToggle.checked ? "3. Search by typing: 'smile', 'heart', 'copyright', etc." : "3. Search by typing: ': smile', ': heart', ': copyright', etc."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "4. Select and press Enter to copy to clipboard"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
}
}
function saveSettings(key, value) {
if (pluginService) {
pluginService.savePluginData("emojiLauncher", key, value)
}
}
function loadSettings(key, defaultValue) {
if (pluginService) {
return pluginService.loadPluginData("emojiLauncher", key, defaultValue)
}
return defaultValue
}
}

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 DankMaterialShell Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,130 @@
# Emoji & Unicode Launcher
A DankMaterialShell launcher plugin that provides quick access to thousands of emojis, mathematical symbols, and Nerd Font glyphs with instant clipboard copying.
![Emoji & Unicode Launcher Screenshot](screenshot.png)
## Features
- **Expanded Emoji Catalog** - 900+ curated emoji entries combined with the bundled emoji dataset for complete coverage (gear, toolbox, etc.)
- **Unicode & Math Symbols** - Hundreds of useful unicode characters from arrows to operators and currency signs
- **Nerd Font Glyphs** - Searchable Nerd Font icons for launcher, terminal, and code workflows
- **Instant Copy** - One-click copy to clipboard with visual confirmation
- **Smart Search** - Search by name, character, or keywords
- **Configurable Trigger** - Default `:` or set your own trigger (or disable for always-on)
- **Toast Notifications** - Visual feedback for every action
## Installation
### From Plugin Registry (Recommended)
```bash
# Coming soon - will be available via DMS plugin manager
```
### Manual Installation
```bash
# Copy plugin to DMS plugins directory
cp -r EmojiLauncher ~/.config/DankMaterialShell/plugins/
# Enable in DMS
# 1. Open Settings (Ctrl+,)
# 2. Go to Plugins tab
# 3. Click "Scan for Plugins"
# 4. Toggle "Emoji & Unicode Launcher" to enable
```
## Usage
### Default Trigger Mode
1. Open launcher (Ctrl+Space)
2. Type `:` followed by search query
3. Examples:
- `:smile` - Find smiling emojis
- `:heart` - Find heart emojis
- `:copyright` - Find © symbol
- `:arrow` - Find arrow characters
4. Select item and press Enter to copy
### Always-On Mode
Configure in settings to show emoji/unicode items without a trigger prefix.
## Search Examples
**Emojis:**
- `smile` → 😀 😃 😄 😁 😊
- `heart` → ❤️ 🧡 💛 💚 💙 💜
- `fire` → 🔥
- `star` → ⭐ ✨ 🌟
**Unicode Characters:**
- `copyright` → ©
- `trademark` → ™
- `degree` → °
- `pi` → π
- `arrow` → → ← ↑ ↓
- `infinity` → ∞
- `euro` → €
## Configuration
Access settings via DMS Settings → Plugins → Emoji & Unicode Launcher:
- **Trigger**: Set custom trigger character (`:`, `;`, `/emoji`, etc.) or disable for always-on mode
- **No Trigger Mode**: Toggle to show items without trigger prefix
## Character Database
### Data Sources
- `data/emojis.txt` — comprehensive emoji list (Terminal Root)
- `data/math.txt` — math and general-purpose unicode symbols
- `data/nerdfont.txt` — curated Nerd Font glyph export
All files ship with the plugin, so search works fully offline.
### Highlights
- **Emoji coverage:** faces, hands, tools, activities, symbols, and flags (including gear ⚙️ and toolbox 🧰)
- **Unicode symbols:** math operators, arrows, currency, Greek letters, quotes, and miscellaneous symbols
- **Nerd Font glyphs:** VS Code Codicons, Powerline (ple-) separators, development icons, and other monospace-friendly glyphs for terminal/theming
### Updating the catalog
1. Modify the plain-text sources in `data/` (`emojis.txt`, `math.txt`, `nerdfont.txt`).
2. Run `scripts/generate_catalog.py` to rebuild `catalog.js` (the file bundled with the plugin). The script parses the text files, normalizes names, and refreshes search keywords.
## Requirements
- DankMaterialShell >= 0.1.0
- `wl-copy` (from wl-clipboard package)
- Wayland compositor (Niri, Hyprland, etc.)
## Compatibility
- **Compositors**: Niri and Hyprland
- **Distros**: Universal - works on any Linux distribution
## Technical Details
- **Type**: Launcher plugin
- **Trigger**: `:` (configurable)
- **Language**: QML (Qt Modeling Language)
- **Dependencies**: None (uses built-in character database)
## Contributing
Found a bug or want to add more characters? Open an issue or submit a pull request!
## Credits
Emoji database sourced from [Terminal Root's emoji collection](https://terminalroot.com/emojis.txt) - a comprehensive list of emojis with searchable names.
## License
MIT License - See LICENSE file for details
## Author
Created for the DankMaterialShell community
## Links
- [DankMaterialShell](https://github.com/AvengeMedia/DankMaterialShell)
- [Plugin Registry](https://github.com/AvengeMedia/dms-plugin-registry)

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
ref: refs/heads/main

View file

@ -0,0 +1,9 @@
[core]
bare = false
filemode = true
[remote "origin"]
url = https://github.com/devnullvoid/dms-emoji-launcher
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
remote = origin
merge = refs/heads/main

View file

@ -0,0 +1 @@
2951ec7f823c983c11b6b231403581a386a7c9f6

View file

@ -0,0 +1 @@
2951ec7f823c983c11b6b231403581a386a7c9f6

View file

@ -0,0 +1,14 @@
{
"id": "emojiLauncher",
"name": "Emoji & Unicode Launcher",
"description": "Search and copy emojis and unicode characters",
"version": "1.2.0",
"author": "devnullvoid",
"icon": "emoji_emotions",
"type": "launcher",
"capabilities": ["emoji-search", "unicode-search"],
"component": "./EmojiLauncher.qml",
"settings": "./EmojiLauncherSettings.qml",
"trigger": ":",
"permissions": ["settings_read", "settings_write"]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View file

@ -0,0 +1,161 @@
#!/usr/bin/env python3
"""Builds the catalog.js bundle from the plain-text data sources."""
from __future__ import annotations
import json
import re
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
DATA = ROOT / "data"
OUTPUT = ROOT / "catalog.js"
def main() -> None:
emoji_entries = parse_emoji(DATA / "emojis.txt")
unicode_entries = parse_unicode(DATA / "math.txt")
nerd_font_entries = parse_nerdfont(DATA / "nerdfont.txt")
write_catalog(
emoji_entries=emoji_entries,
unicode_entries=unicode_entries,
nerd_font_entries=nerd_font_entries,
)
def parse_emoji(path: Path) -> list[dict]:
return _parse_symbol_file(
path,
key_name="emoji",
extra_keywords=lambda raw: [],
)
def parse_unicode(path: Path) -> list[dict]:
return _parse_symbol_file(
path,
key_name="char",
extra_keywords=lambda raw: [],
)
def parse_nerdfont(path: Path) -> list[dict]:
def extra_keywords(raw: str) -> list[str]:
extras = ["nerdfont", raw]
if raw.startswith("ple-"):
extras.extend(["powerline", "ple"])
return extras
entries = _parse_symbol_file(
path,
key_name="char",
preprocess_name=lambda name: re.sub(r"[_-]+", " ", name).strip(),
extra_keywords=extra_keywords,
)
for entry in entries:
name = entry.get("name", "")
if name.startswith("Ple "):
entry["name"] = "Powerline " + name[4:]
return entries
def _parse_symbol_file(
path: Path,
*,
key_name: str,
preprocess_name=lambda name: name,
extra_keywords=lambda raw: [],
) -> list[dict]:
text = path.read_text(encoding="utf-8")
entries: list[dict] = []
for raw_line in text.splitlines():
if not raw_line:
continue
trimmed = raw_line.strip()
if not trimmed or trimmed.startswith("#"):
continue
match = re.match(r"^(\S+|\s)\s+(.*)$", raw_line)
if not match:
continue
symbol = match.group(1)
raw_name = match.group(2).strip()
if not raw_name or ".." in symbol:
continue
cleaned_name = preprocess_name(raw_name) or raw_name
friendly = prettify_name(cleaned_name)
keywords = build_keywords(cleaned_name, extra_keywords(raw_name))
entry = {
key_name: symbol,
"name": friendly,
"keywords": keywords,
}
entries.append(entry)
return entries
def prettify_name(raw: str) -> str:
tokens = [token for token in re.split(r"\s+", raw) if token]
return " ".join(token.capitalize() for token in tokens)
def build_keywords(raw: str, extras: list[str]) -> list[str]:
seen: set[str] = set()
keywords: list[str] = []
def add_token(token: str) -> None:
lowered = token.lower()
if lowered and lowered not in seen:
seen.add(lowered)
keywords.append(lowered)
def tokenize(value: str) -> list[str]:
return [part for part in re.split(r"[^a-zA-Z0-9+]+", value.lower()) if part]
for token in tokenize(raw):
add_token(token)
for extra in extras:
for token in tokenize(extra):
add_token(token)
return keywords
def write_catalog(*, emoji_entries, unicode_entries, nerd_font_entries) -> None:
OUTPUT.write_text(
"\n".join(
[
"// Auto-generated by scripts/generate_catalog.py",
"// Do not edit manually.",
".pragma library",
"",
f"var emojiEntries = {json.dumps(emoji_entries, ensure_ascii=False)};",
f"var unicodeEntries = {json.dumps(unicode_entries, ensure_ascii=False)};",
f"var nerdFontEntries = {json.dumps(nerd_font_entries, ensure_ascii=False)};",
"",
"function clone(array) {",
" return array ? array.slice() : [];",
"}",
"",
"function getEmojiEntries() { return clone(emojiEntries); }",
"function getUnicodeEntries() { return clone(unicodeEntries); }",
"function getNerdFontEntries() { return clone(nerdFontEntries); }",
]
)
+ "\n",
encoding="utf-8",
)
if __name__ == "__main__":
main()

View file

@ -0,0 +1 @@
/home/lew/.config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 DankMaterialShell Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,237 @@
# Web Search
A DankMaterialShell launcher plugin for searching the web with 23+ built-in search engines and support for custom search engines.
![Web Search Screenshot](screenshot.png)
## Features
- **23+ Built-in Search Engines** - Google, DuckDuckGo, GitHub, Stack Overflow, and more
- **Custom Search Engines** - Add your own search engines with URL templates
- **Keyword-Based Selection** - Type keywords to use specific engines (e.g., `github rust`)
- **Configurable Default Engine** - Set your preferred search engine
- **One-Click Search** - Select and press Enter to open browser
- **Toast Notifications** - Visual feedback for every search
- **Configurable Trigger** - Default `?` or set your own trigger
## Installation
### From Plugin Registry (Recommended)
```bash
# Coming soon - will be available via DMS plugin manager
```
### Manual Installation
```bash
# Copy plugin to DMS plugins directory
cp -r WebSearch ~/.config/DankMaterialShell/plugins/
# Enable in DMS
# 1. Open Settings (Ctrl+,)
# 2. Go to Plugins tab
# 3. Click "Scan for Plugins"
# 4. Toggle "Web Search" to enable
```
## Usage
### Basic Search
1. Open launcher (Ctrl+Space)
2. Type `?` followed by search query
3. Examples:
- `? rust tutorials` - Search with default engine
- `? linux kernel` - General search
4. Select engine and press Enter to open browser
### Engine-Specific Search
Use keywords to search specific engines directly:
- `? github awesome-linux` - Search GitHub
- `? youtube music video` - Search YouTube
- `? wiki quantum physics` - Search Wikipedia
- `? stackoverflow async rust` - Search Stack Overflow
## Built-in Search Engines
### General Search
- **Google** - Keywords: `google`, `search`
- **DuckDuckGo** - Keywords: `ddg`, `duckduckgo`, `privacy`
- **Brave Search** - Keywords: `brave`, `privacy`
- **Bing** - Keywords: `bing`, `microsoft`
### Development
- **GitHub** - Keywords: `github`, `code`, `git`
- **Stack Overflow** - Keywords: `stackoverflow`, `stack`, `coding`
- **npm** - Keywords: `npm`, `node`, `javascript`
- **PyPI** - Keywords: `pypi`, `python`, `pip`
- **crates.io** - Keywords: `crates`, `rust`, `cargo`
- **MDN Web Docs** - Keywords: `mdn`, `mozilla`, `web`, `docs`
### Linux & Packages
- **Arch Linux Wiki** - Keywords: `arch`, `linux`, `packages`
- **AUR** - Keywords: `aur`, `arch`, `packages`
### Social & Media
- **YouTube** - Keywords: `youtube`, `video`, `yt`
- **Reddit** - Keywords: `reddit`
- **Twitter/X** - Keywords: `twitter`, `x`, `social`
- **LinkedIn** - Keywords: `linkedin`, `job`, `professional`
### Reference
- **Wikipedia** - Keywords: `wikipedia`, `wiki`
- **Google Translate** - Keywords: `translate`, `translation`
- **IMDb** - Keywords: `imdb`, `movies`, `tv`
### Shopping
- **Amazon** - Keywords: `amazon`, `shop`, `shopping`
- **eBay** - Keywords: `ebay`, `shop`, `auction`
### Utilities
- **Google Maps** - Keywords: `maps`, `location`, `directions`
- **Google Images** - Keywords: `images`, `pictures`, `photos`
## Custom Search Engines
Add your own search engines via Settings:
1. Open Settings → Plugins → Web Search
2. Scroll to "Custom Search Engines"
3. Fill in the form:
- **ID**: Unique identifier (e.g., `myengine`)
- **Name**: Display name (e.g., `My Search Engine`)
- **Icon**: Material icon name (e.g., `search`), prefix with `material:` to pull a Material Symbol (e.g., `material:travel_explore`), or prefix with `unicode:` to use emoji/Nerd Font glyphs (e.g., `unicode:`)
- **URL**: Search URL with `%s` placeholder
- **Keywords**: Comma-separated keywords for quick access
### Example Custom Engines
**Rust Documentation:**
```
ID: rustdoc
Name: Rust Docs
Icon: unicode:🦀
URL: https://doc.rust-lang.org/std/?search=%s
Keywords: rust,docs,documentation
```
**Arch Wiki:**
```
ID: archwiki
Name: Arch Wiki
Icon: material:menu_book
URL: https://wiki.archlinux.org/index.php?search=%s
Keywords: arch,wiki,documentation
```
**GitLab:**
```
ID: gitlab
Name: GitLab
Icon: material:code
URL: https://gitlab.com/search?search=%s
Keywords: gitlab,code
```
## Configuration
Access settings via DMS Settings → Plugins → Web Search:
- **Trigger**: Set custom trigger (`?`, `/`, `/search`, etc.) or disable for always-on mode
- **Default Search Engine**: Choose your preferred engine (Google, DuckDuckGo, Brave, Bing)
- **Custom Search Engines**: Add/manage your own search engines
## Search Examples
### General Queries
```
? rust programming # Search with default engine
? how to install arch # General search
```
### Development
```
? github awesome-linux # Search GitHub
? stackoverflow async rust # Search Stack Overflow
? npm react hooks # Search npm packages
? pypi requests # Search Python packages
```
### Linux
```
? arch firefox # Search Arch packages
? aur brave-bin # Search AUR
? wiki systemd # Search Wikipedia
```
### Media
```
? youtube rust tutorial # Search YouTube
? reddit linux gaming # Search Reddit
? imdb inception # Search IMDb
```
## Requirements
- DankMaterialShell >= 0.1.0
- Web browser (default system browser via `xdg-open`)
- Wayland compositor
## Compatibility
- **Compositors**: Niri and Hyprland
- **Distros**: Universal - works on any Linux distribution
- **Browsers**: Works with any default browser
## Technical Details
- **Type**: Launcher plugin
- **Trigger**: `?` (configurable)
- **Language**: QML (Qt Modeling Language)
- **Browser Launch**: Uses `xdg-open` for system default browser
## Tips & Tricks
1. **Keyword Shortcuts**: Type engine keywords first for direct search
- `github rust` instead of `? github rust`
2. **Combine Keywords**: Use multiple keywords to narrow results
- `stackoverflow rust async await`
3. **Custom Engines**: Add frequently-used sites for quick access
- Add your company's internal documentation
- Add specialized search engines for your workflow
## Contributing
Want to add more built-in search engines? Open an issue or submit a pull request!
## License
MIT License - See LICENSE file for details
## Author
Created for the DankMaterialShell community
## Links
- [DankMaterialShell](https://github.com/AvengeMedia/DankMaterialShell)
- [Plugin Registry](https://github.com/AvengeMedia/dms-plugin-registry)

View file

@ -0,0 +1,352 @@
import QtQuick
import Quickshell
import qs.Services
Item {
id: root
property var pluginService: null
property string trigger: "?"
property var searchEngines: []
property string defaultEngine: "google"
signal itemsChanged()
property var builtInEngines: [
{
id: "google",
name: "Google",
icon: "material:travel_explore",
url: "https://www.google.com/search?q=%s",
keywords: ["google", "search"]
},
{
id: "duckduckgo",
name: "DuckDuckGo",
icon: "material:shield",
url: "https://duckduckgo.com/?q=%s",
keywords: ["ddg", "duckduckgo", "privacy"]
},
{
id: "brave",
name: "Brave Search",
icon: "material:security",
url: "https://search.brave.com/search?q=%s",
keywords: ["brave", "privacy"]
},
{
id: "bing",
name: "Bing",
icon: "material:language",
url: "https://www.bing.com/search?q=%s",
keywords: ["bing", "microsoft"]
},
{
id: "youtube",
name: "YouTube",
icon: "material:youtube_activity",
url: "https://www.youtube.com/results?search_query=%s",
keywords: ["youtube", "video", "yt"]
},
{
id: "github",
name: "GitHub",
icon: "unicode:",
url: "https://github.com/search?q=%s",
keywords: ["github", "code", "git"]
},
{
id: "stackoverflow",
name: "Stack Overflow",
icon: "unicode:",
url: "https://stackoverflow.com/search?q=%s",
keywords: ["stackoverflow", "stack", "coding"]
},
{
id: "reddit",
name: "Reddit",
icon: "unicode:",
url: "https://www.reddit.com/search?q=%s",
keywords: ["reddit"]
},
{
id: "wikipedia",
name: "Wikipedia",
icon: "material:menu_book",
url: "https://en.wikipedia.org/wiki/Special:Search?search=%s",
keywords: ["wikipedia", "wiki"]
},
{
id: "amazon",
name: "Amazon",
icon: "material:shopping_cart",
url: "https://www.amazon.com/s?k=%s",
keywords: ["amazon", "shop", "shopping"]
},
{
id: "ebay",
name: "eBay",
icon: "material:local_mall",
url: "https://www.ebay.com/sch/i.html?_nkw=%s",
keywords: ["ebay", "shop", "auction"]
},
{
id: "maps",
name: "Google Maps",
icon: "material:map",
url: "https://www.google.com/maps/search/%s",
keywords: ["maps", "location", "directions"]
},
{
id: "images",
name: "Google Images",
icon: "material:photo_library",
url: "https://www.google.com/search?tbm=isch&q=%s",
keywords: ["images", "pictures", "photos"]
},
{
id: "twitter",
name: "Twitter/X",
icon: "unicode:",
url: "https://twitter.com/search?q=%s",
keywords: ["twitter", "x", "social"]
},
{
id: "linkedin",
name: "LinkedIn",
icon: "unicode:",
url: "https://www.linkedin.com/search/results/all/?keywords=%s",
keywords: ["linkedin", "job", "professional"]
},
{
id: "imdb",
name: "IMDb",
icon: "unicode:",
url: "https://www.imdb.com/find?q=%s",
keywords: ["imdb", "movies", "tv"]
},
{
id: "translate",
name: "Google Translate",
icon: "material:g_translate",
url: "https://translate.google.com/?text=%s",
keywords: ["translate", "translation"]
},
{
id: "archlinux",
name: "Arch Linux Wiki",
icon: "material:terminal",
url: "https://wiki.archlinux.org/index.php?search=%s",
keywords: ["arch", "linux", "packages"]
},
{
id: "aur",
name: "AUR",
icon: "unicode:",
url: "https://aur.archlinux.org/packages?K=%s",
keywords: ["aur", "arch", "packages"]
},
{
id: "npmjs",
name: "npm",
icon: "unicode:",
url: "https://www.npmjs.com/search?q=%s",
keywords: ["npm", "node", "javascript"]
},
{
id: "pypi",
name: "PyPI",
icon: "unicode:",
url: "https://pypi.org/search/?q=%s",
keywords: ["pypi", "python", "pip"]
},
{
id: "crates",
name: "crates.io",
icon: "material:inventory_2",
url: "https://crates.io/search?q=%s",
keywords: ["crates", "rust", "cargo"]
},
{
id: "mdn",
name: "MDN Web Docs",
icon: "material:code_blocks",
url: "https://developer.mozilla.org/en-US/search?q=%s",
keywords: ["mdn", "mozilla", "web", "docs"]
}
]
Component.onCompleted: {
loadSettings()
}
onPluginServiceChanged: {
if (pluginService) {
loadSettings()
}
}
function loadSettings() {
if (pluginService) {
trigger = pluginService.loadPluginData("webSearch", "trigger", "?")
defaultEngine = pluginService.loadPluginData("webSearch", "defaultEngine", "google")
searchEngines = pluginService.loadPluginData("webSearch", "searchEngines", [])
}
}
function getItems(query) {
const items = []
const allEngines = builtInEngines.concat(searchEngines)
if (!query || query.trim().length === 0) {
items.push({
name: "Type a search query",
icon: "unicode:🔍",
comment: "Search the web with your default engine (" + getEngineName(defaultEngine) + ")",
action: "noop",
categories: ["Web Search"]
})
for (let i = 0; i < allEngines.length; i++) {
const engine = allEngines[i]
items.push({
name: engine.name,
icon: engine.icon || "unicode:🔍",
comment: engine.keywords ? engine.keywords.join(", ") : "Search engine",
action: "noop",
categories: ["Web Search"]
})
}
return items
}
let matchedEngineId = null
let searchQuery = query.trim()
let fallbackQuery = query.trim()
for (let i = 0; i < allEngines.length; i++) {
const engine = allEngines[i]
if (engine.keywords) {
for (let k = 0; k < engine.keywords.length; k++) {
const keyword = engine.keywords[k]
if (searchQuery.toLowerCase().startsWith(keyword + " ")) {
matchedEngineId = engine.id
searchQuery = searchQuery.substring(keyword.length + 1).trim()
break
}
}
if (matchedEngineId) break
}
}
const primaryEngineId = matchedEngineId || defaultEngine
const primaryEngineObj = allEngines.find(e => e.id === primaryEngineId)
if (primaryEngineObj) {
items.push({
name: "Search with " + primaryEngineObj.name + ": " + searchQuery,
icon: primaryEngineObj.icon || "unicode:🔍",
comment: "Open in browser",
action: "search:" + primaryEngineId + ":" + searchQuery,
categories: ["Web Search"]
})
}
for (let i = 0; i < allEngines.length; i++) {
const engine = allEngines[i]
if (engine.id !== primaryEngineId) {
items.push({
name: "Search with " + engine.name + ": " + (matchedEngineId ? fallbackQuery : searchQuery),
icon: engine.icon || "material:search",
comment: "Open in browser",
action: "search:" + engine.id + ":" + (matchedEngineId ? fallbackQuery : searchQuery),
categories: ["Web Search"]
})
}
}
return items
}
function executeItem(item) {
if (!item || !item.action) {
console.warn("WebSearch: Invalid item or action")
return
}
console.log("WebSearch: Executing item:", item.name, "with action:", item.action)
const actionParts = item.action.split(":")
const actionType = actionParts[0]
switch (actionType) {
case "noop":
return
case "search":
performSearch(actionParts)
break
default:
console.warn("WebSearch: Unknown action type:", actionType)
showToast("Unknown action: " + actionType)
}
}
function performSearch(actionParts) {
const engineId = actionParts[1]
const query = actionParts.slice(2).join(":")
const allEngines = builtInEngines.concat(searchEngines)
const engine = allEngines.find(e => e.id === engineId)
if (engine) {
const encodedQuery = encodeQuery(query)
const url = engine.url.replace("%s", encodedQuery)
Quickshell.execDetached(["xdg-open", url])
showToast("Searching " + engine.name + " for: " + query)
} else {
console.warn("WebSearch: Engine not found:", engineId)
showToast("Search engine not found: " + engineId)
}
}
function showToast(message) {
if (typeof ToastService !== "undefined") {
ToastService.showInfo("Web Search", message)
} else {
console.log("WebSearch Toast:", message)
}
}
function getEngineName(engineId) {
const allEngines = builtInEngines.concat(searchEngines)
const engine = allEngines.find(e => e.id === engineId)
return engine ? engine.name : "Unknown"
}
function encodeQuery(str) {
return str.replace(/ /g, "+")
}
onTriggerChanged: {
if (pluginService) {
pluginService.savePluginData("webSearch", "trigger", trigger)
}
itemsChanged()
}
onDefaultEngineChanged: {
if (pluginService) {
pluginService.savePluginData("webSearch", "defaultEngine", defaultEngine)
}
itemsChanged()
}
onSearchEnginesChanged: {
if (pluginService) {
pluginService.savePluginData("webSearch", "searchEngines", searchEngines)
}
itemsChanged()
}
}

View file

@ -0,0 +1,727 @@
import QtQuick
import QtQuick.Controls
import qs.Common
import qs.Widgets
import qs.Modules.Plugins
PluginSettings {
id: root
pluginId: "webSearch"
property int editingIndex: -1
StyledText {
width: parent.width
text: "Web Search Settings"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
color: Theme.surfaceText
}
StyledText {
width: parent.width
text: "Search the web with built-in and custom search engines directly from the launcher."
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
}
StyledRect {
width: parent.width
height: 1
color: Theme.outlineVariant
}
Column {
spacing: 12
width: parent.width
StyledText {
text: "Trigger Configuration"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
}
StyledText {
text: noTriggerToggle.checked ? "Items will always show in the launcher (no trigger needed)." : "Set the trigger text to activate web search. Type the trigger in the launcher followed by your search query."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
Row {
spacing: 12
CheckBox {
id: noTriggerToggle
text: "No trigger (always show)"
checked: root.loadValue("noTrigger", false)
contentItem: StyledText {
text: noTriggerToggle.text
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
leftPadding: noTriggerToggle.indicator.width + 8
verticalAlignment: Text.AlignVCenter
}
indicator: StyledRect {
implicitWidth: 20
implicitHeight: 20
radius: Theme.cornerRadiusSmall
border.color: noTriggerToggle.checked ? Theme.primary : Theme.outline
border.width: 2
color: noTriggerToggle.checked ? Theme.primary : "transparent"
StyledRect {
width: 12
height: 12
anchors.centerIn: parent
radius: 2
color: Theme.onPrimary
visible: noTriggerToggle.checked
}
}
onCheckedChanged: {
root.saveValue("noTrigger", checked)
if (checked) {
root.saveValue("trigger", "")
} else {
root.saveValue("trigger", triggerField.text || "?")
}
}
}
}
Row {
spacing: 12
width: parent.width
visible: !noTriggerToggle.checked
StyledText {
text: "Trigger:"
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
DankTextField {
id: triggerField
width: 100
height: 40
text: root.loadValue("trigger", "?")
placeholderText: "?"
backgroundColor: Theme.surfaceContainer
textColor: Theme.surfaceText
onTextEdited: {
const newTrigger = text.trim()
root.saveValue("trigger", newTrigger || "?")
root.saveValue("noTrigger", newTrigger === "")
}
}
StyledText {
text: "Examples: ?, /, /search, etc."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter
}
}
}
StyledRect {
width: parent.width
height: 1
color: Theme.outlineVariant
}
SelectionSetting {
settingKey: "defaultEngine"
label: "Default Search Engine"
description: "The search engine used when no keyword is specified"
options: [
{label: "Google", value: "google"},
{label: "DuckDuckGo", value: "duckduckgo"},
{label: "Brave Search", value: "brave"},
{label: "Bing", value: "bing"}
]
defaultValue: "google"
}
StyledRect {
width: parent.width
height: 1
color: Theme.outlineVariant
}
StyledRect {
width: parent.width
height: addEngineColumn.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Theme.surfaceContainerHigh
Column {
id: addEngineColumn
anchors.fill: parent
anchors.margins: Theme.spacingL
spacing: Theme.spacingM
StyledText {
text: root.editingIndex === -1 ? "Create Custom Search Engine" : "Edit Custom Search Engine"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
Row {
width: parent.width
spacing: Theme.spacingM
Column {
width: (parent.width - Theme.spacingM) / 2
spacing: Theme.spacingXS
StyledText {
text: "Engine ID *"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: idField
width: parent.width
placeholderText: "e.g., myengine"
keyNavigationTab: nameField
onFocusStateChanged: hasFocus => {
if (hasFocus) root.ensureItemVisible(idField)
}
}
}
Column {
width: (parent.width - Theme.spacingM) / 2
spacing: Theme.spacingXS
StyledText {
text: "Display Name *"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: nameField
width: parent.width
placeholderText: "e.g., My Engine"
keyNavigationBacktab: idField
keyNavigationTab: iconField
onFocusStateChanged: hasFocus => {
if (hasFocus) root.ensureItemVisible(nameField)
}
}
}
}
Row {
width: parent.width
spacing: Theme.spacingM
Column {
width: (parent.width - Theme.spacingM) / 2
spacing: Theme.spacingXS
StyledText {
text: "Icon"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: iconField
width: parent.width
placeholderText: "e.g., unicode:🔍"
keyNavigationBacktab: nameField
keyNavigationTab: urlField
onFocusStateChanged: hasFocus => {
if (hasFocus) root.ensureItemVisible(iconField)
}
}
StyledText {
text: "Prefix with 'material:' for Material Symbols or 'unicode:' for emoji/Nerd Font glyphs."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
}
Column {
width: (parent.width - Theme.spacingM) / 2
spacing: Theme.spacingXS
StyledText {
text: "Search URL *"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: urlField
width: parent.width
placeholderText: "e.g., https://example.com/search?q=%s"
keyNavigationBacktab: iconField
keyNavigationTab: keywordsField
onFocusStateChanged: hasFocus => {
if (hasFocus) root.ensureItemVisible(urlField)
}
}
StyledText {
text: "Use %s as placeholder for search query"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
}
}
Column {
width: parent.width
spacing: Theme.spacingXS
StyledText {
text: "Keywords (comma separated)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: keywordsField
width: parent.width
placeholderText: "e.g., my,engine,search"
keyNavigationBacktab: urlField
onFocusStateChanged: hasFocus => {
if (hasFocus) root.ensureItemVisible(keywordsField)
}
}
StyledText {
text: "Use these keywords to trigger this engine (e.g., '? keyword query')"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
}
Row {
spacing: Theme.spacingM
DankButton {
id: addButton
text: root.editingIndex === -1 ? "Create Engine" : "Update Engine"
iconName: root.editingIndex === -1 ? "add" : "save"
onClicked: {
const id = idField.text.trim()
const name = nameField.text.trim()
const url = urlField.text.trim()
if (!id || !name || !url) {
if (typeof ToastService !== "undefined") {
ToastService.showError("Please fill in required fields (ID, Name, URL)")
}
return
}
const keywordsText = keywordsField.text.trim()
const keywords = keywordsText ? keywordsText.split(",").map(k => k.trim()).filter(k => k.length > 0) : []
const engine = {
id: id,
name: name,
icon: iconField.text.trim() || "unicode:🔍",
url: url,
keywords: keywords
}
const currentEngines = root.loadValue("searchEngines", [])
if (root.editingIndex === -1) {
const updatedEngines = currentEngines.concat([engine])
root.saveValue("searchEngines", updatedEngines)
} else {
currentEngines[root.editingIndex] = engine
root.saveValue("searchEngines", currentEngines)
root.editingIndex = -1
}
idField.text = ""
nameField.text = ""
iconField.text = ""
urlField.text = ""
keywordsField.text = ""
idField.forceActiveFocus()
}
}
DankButton {
text: "Cancel"
iconName: "close"
visible: root.editingIndex !== -1
onClicked: {
root.editingIndex = -1
idField.text = ""
nameField.text = ""
iconField.text = ""
urlField.text = ""
keywordsField.text = ""
}
}
}
}
}
StyledRect {
width: parent.width
height: Math.max(200, enginesColumn.implicitHeight + Theme.spacingL * 2)
radius: Theme.cornerRadius
color: Theme.surfaceContainerHigh
Column {
id: enginesColumn
anchors.fill: parent
anchors.margins: Theme.spacingL
spacing: Theme.spacingM
StyledText {
text: "Existing Custom Engines"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
ListView {
width: parent.width
height: Math.max(100, contentHeight)
clip: true
spacing: Theme.spacingXS
model: root.variantsModel.count > 0 ? root.variantsModel : root.loadValue("searchEngines", [])
delegate: StyledRect {
required property var model
required property int index
width: ListView.view.width
height: engineColumn.implicitHeight + Theme.spacingM * 2
radius: Theme.cornerRadius
color: engineMouseArea.containsMouse ? Theme.surfaceContainerHighest : Theme.surfaceContainer
Column {
id: engineColumn
anchors.fill: parent
anchors.margins: Theme.spacingM
spacing: Theme.spacingXS
Row {
width: parent.width
spacing: Theme.spacingM
Item {
width: Theme.iconSize
height: Theme.iconSize
anchors.verticalCenter: parent.verticalCenter
visible: false // Workaround for DankMaterialShell bug with unicode/material icons
DankIcon {
anchors.centerIn: parent
name: model.icon || "unicode:🔍"
size: Theme.iconSize
color: Theme.surfaceText
}
}
Column {
anchors.verticalCenter: parent.verticalCenter
spacing: 2
width: parent.width - editButton.width - deleteButton.width - Theme.spacingM * 3
StyledText {
text: model.name || "Unnamed"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
width: parent.width
elide: Text.ElideRight
}
StyledText {
text: "ID: " + (model.id || "") + " | URL: " + (model.url || "")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: parent.width
elide: Text.ElideRight
}
StyledText {
text: {
const kw = model.keywords
if (kw && kw.length > 0) {
let result = []
for (let i = 0; i < kw.length; i++) {
result.push(kw[i])
}
return "Keywords: " + result.join(", ")
}
return "No keywords"
}
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: parent.width
elide: Text.ElideRight
}
}
Rectangle {
id: editButton
anchors.verticalCenter: parent.verticalCenter
width: 32
height: 32
radius: 16
color: editArea.containsMouse ? Theme.primary : "transparent"
DankIcon {
anchors.centerIn: parent
name: "edit"
size: 16
color: editArea.containsMouse ? Theme.onPrimary : Theme.surfaceVariantText
}
MouseArea {
id: editArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
root.editingIndex = index
const engine = root.loadValue("searchEngines", [])[index]
idField.text = engine.id
nameField.text = engine.name
iconField.text = engine.icon
urlField.text = engine.url
keywordsField.text = Array.isArray(engine.keywords) ? engine.keywords.join(", ") : ""
root.ensureItemVisible(idField)
}
}
}
Rectangle {
id: deleteButton
anchors.verticalCenter: parent.verticalCenter
width: 32
height: 32
radius: 16
color: deleteArea.containsMouse ? Theme.error : "transparent"
DankIcon {
anchors.centerIn: parent
name: "delete"
size: 16
color: deleteArea.containsMouse ? Theme.onError : Theme.surfaceVariantText
}
MouseArea {
id: deleteArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
const currentEngines = root.loadValue("searchEngines", [])
const updatedEngines = currentEngines.filter((_, i) => i !== index)
root.saveValue("searchEngines", updatedEngines)
}
}
}
}
}
MouseArea {
id: engineMouseArea
anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true
}
}
StyledText {
anchors.centerIn: parent
text: "No custom engines created yet"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
visible: parent.count === 0
}
}
}
}
StyledRect {
width: parent.width
height: 1
color: Theme.outlineVariant
}
Column {
spacing: 8
width: parent.width
StyledText {
text: "Built-in Search Engines:"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
Column {
spacing: 4
leftPadding: 16
StyledText {
text: "• Google, DuckDuckGo, Brave Search, Bing"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "• YouTube, GitHub, Stack Overflow, Reddit, Wikipedia"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "• Amazon, eBay, Google Maps, Google Images"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "• Twitter/X, LinkedIn, IMDb, Google Translate"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "• Arch Linux, AUR, npm, PyPI, crates.io, MDN"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
}
StyledRect {
width: parent.width
height: 1
color: Theme.outlineVariant
}
Column {
spacing: 8
width: parent.width
StyledText {
text: "Usage:"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
Column {
spacing: 4
leftPadding: 16
bottomPadding: 24
StyledText {
text: "1. Open Launcher (Ctrl+Space or click launcher button)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: noTriggerToggle.checked ? "2. Type your search query directly" : "2. Type your trigger (default: ?) followed by search query"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: noTriggerToggle.checked ? "3. Example: 'linux kernel' or 'github rust'" : "3. Example: '? linux kernel' or '? github rust'"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "4. Use keywords for specific engines: 'youtube music', 'github project', 'wiki topic'"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "5. Select search engine and press Enter to open in browser"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
}
Column {
spacing: 8
width: parent.width
StyledText {
text: "Adding Custom Search Engines:"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
Column {
spacing: 4
leftPadding: 16
bottomPadding: 24
StyledText {
text: "1. Find the search URL for your desired website"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "2. Replace the search query with %s in the URL"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "3. Example: https://mysite.com/search?q=%s"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "4. Add it using the Custom Search Engines section above"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: "5. Set keywords for quick access (e.g., 'mysite' or 'ms')"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
}
}

View file

@ -0,0 +1 @@
ref: refs/heads/main

View file

@ -0,0 +1,9 @@
[core]
bare = false
filemode = true
[remote "origin"]
url = https://github.com/devnullvoid/dms-web-search
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
remote = origin
merge = refs/heads/main

View file

@ -0,0 +1 @@
81ccd9fd8249b3c9ef40dde42549f807e36ae3e3

View file

@ -0,0 +1 @@
81ccd9fd8249b3c9ef40dde42549f807e36ae3e3

Some files were not shown because too many files have changed in this diff Show more