Remove .config/DankMaterialShell/firefox.css
Remove .config/DankMaterialShell/plugin_settings.json Remove .config/DankMaterialShell/plugins/calculator/CalculatorLauncher.qml Remove .config/DankMaterialShell/plugins/calculator/CalculatorSettings.qml Remove .config/DankMaterialShell/plugins/calculator/README.md Remove .config/DankMaterialShell/plugins/calculator/calculator.js Remove .config/DankMaterialShell/plugins/calculator/.git/HEAD Remove .config/DankMaterialShell/plugins/calculator/.git/config Remove .config/DankMaterialShell/plugins/calculator/.git/index Remove .config/DankMaterialShell/plugins/calculator/.git/objects/info/.keep Remove .config/DankMaterialShell/plugins/calculator/.git/objects/pack/pack-67f644835e660794f65c9273e46788b0c3da57cf.idx Remove .config/DankMaterialShell/plugins/calculator/.git/objects/pack/pack-67f644835e660794f65c9273e46788b0c3da57cf.rev Remove .config/DankMaterialShell/plugins/calculator/.git/objects/pack/pack-67f644835e660794f65c9273e46788b0c3da57cf.pack Remove .config/DankMaterialShell/plugins/calculator/.git/refs/heads/main Remove .config/DankMaterialShell/plugins/calculator/.git/refs/remotes/origin/main Remove .config/DankMaterialShell/plugins/calculator/.git/refs/remotes/origin/qalc Remove .config/DankMaterialShell/plugins/calculator/.git/refs/tags/.keep Remove .config/DankMaterialShell/plugins/calculator/plugin.json Remove .config/DankMaterialShell/plugins/calculator/screenshot.png Remove .config/DankMaterialShell/plugins/calculator/test_precision.js Remove .config/DankMaterialShell/plugins/calculator/test_single.js Remove .config/DankMaterialShell/plugins/commandRunner/CommandRunner.qml Remove .config/DankMaterialShell/plugins/commandRunner/CommandRunnerSettings.qml Remove .config/DankMaterialShell/plugins/commandRunner/LICENSE Remove .config/DankMaterialShell/plugins/commandRunner/README.md Remove .config/DankMaterialShell/plugins/commandRunner/.git/HEAD Remove .config/DankMaterialShell/plugins/commandRunner/.git/config Remove .config/DankMaterialShell/plugins/commandRunner/.git/index Remove .config/DankMaterialShell/plugins/commandRunner/.git/objects/info/.keep Remove .config/DankMaterialShell/plugins/commandRunner/.git/objects/pack/pack-5a720f795fd2994ef506cd867d86ca7df8a25a31.idx Remove .config/DankMaterialShell/plugins/commandRunner/.git/objects/pack/pack-5a720f795fd2994ef506cd867d86ca7df8a25a31.rev Remove .config/DankMaterialShell/plugins/commandRunner/.git/objects/pack/pack-5a720f795fd2994ef506cd867d86ca7df8a25a31.pack Remove .config/DankMaterialShell/plugins/commandRunner/.git/refs/heads/main Remove .config/DankMaterialShell/plugins/commandRunner/.git/refs/remotes/origin/main Remove .config/DankMaterialShell/plugins/commandRunner/.git/refs/tags/.keep Remove .config/DankMaterialShell/plugins/commandRunner/plugin.json Remove .config/DankMaterialShell/plugins/commandRunner/screenshot.png Remove .config/DankMaterialShell/plugins/dankActions.meta Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions/DankActionsSettings.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions/DankActionsWidget.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions/plugin.json Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankBatteryAlerts/DankBatteryAlerts.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankBatteryAlerts/DankBatteryAlertsSettings.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankBatteryAlerts/plugin.json Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/DankHooks.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/DankHooksSettings.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/README.md Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/plugin.json Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankPomodoroTimer/DankPomodoroSettings.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankPomodoroTimer/DankPomodoroWidget.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankPomodoroTimer/plugin.json Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/LICENSE Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/README.md Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/HEAD Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/config Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/index Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/info/.keep Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/pack/pack-3221a15c022ef4a7bb6bf2c47e40068b66b3588b.idx Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/pack/pack-3221a15c022ef4a7bb6bf2c47e40068b66b3588b.rev Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/pack/pack-3221a15c022ef4a7bb6bf2c47e40068b66b3588b.pack Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/refs/heads/master Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/refs/remotes/origin/master Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/refs/tags/.keep Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.gitignore Remove .config/DankMaterialShell/plugins/emojiLauncher/EmojiLauncher.qml Remove .config/DankMaterialShell/plugins/emojiLauncher/EmojiLauncherSettings.qml Remove .config/DankMaterialShell/plugins/emojiLauncher/LICENSE Remove .config/DankMaterialShell/plugins/emojiLauncher/README.md Remove .config/DankMaterialShell/plugins/emojiLauncher/catalog.js Remove .config/DankMaterialShell/plugins/emojiLauncher/data/emojis.txt Remove .config/DankMaterialShell/plugins/emojiLauncher/data/math.txt Remove .config/DankMaterialShell/plugins/emojiLauncher/data/nerdfont.txt Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/HEAD Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/config Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/index Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/info/.keep Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/pack/pack-e04a5b1ea381dc3a792b8bf08cf70e735b195c0d.idx Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/pack/pack-e04a5b1ea381dc3a792b8bf08cf70e735b195c0d.rev Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/pack/pack-e04a5b1ea381dc3a792b8bf08cf70e735b195c0d.pack Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/refs/heads/main Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/refs/remotes/origin/main Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/refs/tags/.keep Remove .config/DankMaterialShell/plugins/emojiLauncher/plugin.json Remove .config/DankMaterialShell/plugins/emojiLauncher/screenshot.png Remove .config/DankMaterialShell/plugins/emojiLauncher/scripts/generate_catalog.py Remove .config/DankMaterialShell/plugins/dankActions Remove .config/DankMaterialShell/plugins/webSearch/LICENSE Remove .config/DankMaterialShell/plugins/webSearch/README.md Remove .config/DankMaterialShell/plugins/webSearch/WebSearch.qml Remove .config/DankMaterialShell/plugins/webSearch/WebSearchSettings.qml Remove .config/DankMaterialShell/plugins/webSearch/.git/HEAD Remove .config/DankMaterialShell/plugins/webSearch/.git/config Remove .config/DankMaterialShell/plugins/webSearch/.git/index Remove .config/DankMaterialShell/plugins/webSearch/.git/objects/info/.keep Remove .config/DankMaterialShell/plugins/webSearch/.git/objects/pack/pack-6a60c736f418e5b4b1f0505f66c1e2a371d46fed.idx Remove .config/DankMaterialShell/plugins/webSearch/.git/objects/pack/pack-6a60c736f418e5b4b1f0505f66c1e2a371d46fed.rev Remove .config/DankMaterialShell/plugins/webSearch/.git/objects/pack/pack-6a60c736f418e5b4b1f0505f66c1e2a371d46fed.pack Remove .config/DankMaterialShell/plugins/webSearch/.git/refs/heads/main Remove .config/DankMaterialShell/plugins/webSearch/.git/refs/remotes/origin/main Remove .config/DankMaterialShell/plugins/webSearch/.git/refs/tags/.keep Remove .config/DankMaterialShell/plugins/webSearch/plugin.json Remove .config/DankMaterialShell/plugins/webSearch/screenshot.png Remove .config/DankMaterialShell/settings.json
This commit is contained in:
parent
e08bb9229f
commit
917b479a94
103 changed files with 0 additions and 24611 deletions
|
|
@ -1,132 +0,0 @@
|
|||
@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;
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
{
|
||||
"commandRunner": {
|
||||
"enabled": false,
|
||||
"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": false,
|
||||
"trigger": "="
|
||||
},
|
||||
"emojiLauncher": {
|
||||
"enabled": true
|
||||
},
|
||||
"webSearch": {
|
||||
"enabled": false,
|
||||
"searchEngines": []
|
||||
},
|
||||
"dankDesktopWeather": {
|
||||
"enabled": true
|
||||
},
|
||||
"mediaPlayer": {
|
||||
"enabled": false
|
||||
},
|
||||
"desktopCommand": {
|
||||
"enabled": true
|
||||
},
|
||||
"dankHooks": {
|
||||
"enabled": true,
|
||||
"wifiConnected": "/home/lew/.local/bin/hooks/generic",
|
||||
"audioVolume": ""
|
||||
}
|
||||
}
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,275 +0,0 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,152 +0,0 @@
|
|||
# Calculator Plugin for DMS Launcher
|
||||
|
||||
|
||||
[](https://plugins.danklinux.com/calculator.html)
|
||||
|
||||
A launcher plugin that evaluates mathematical expressions and copies results to the clipboard.
|
||||
|
||||

|
||||
|
||||
## 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
|
||||
|
|
@ -1,245 +0,0 @@
|
|||
// 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;
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
ref: refs/heads/main
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
[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
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
de6dbd59b7630e897a50e107f704c1cd4a131128
|
||||
|
|
@ -1 +0,0 @@
|
|||
de6dbd59b7630e897a50e107f704c1cd4a131128
|
||||
|
|
@ -1 +0,0 @@
|
|||
ea2857f89d1a0d00e01e6697f11da2d9f267e071
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"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.
|
Before Width: | Height: | Size: 13 KiB |
|
|
@ -1,181 +0,0 @@
|
|||
#!/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);
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
// 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,173 +0,0 @@
|
|||
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()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,436 +0,0 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
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.
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
# Command Runner
|
||||
|
||||
A DankMaterialShell launcher plugin for executing shell commands directly from the launcher with history tracking and preset shortcuts.
|
||||
|
||||

|
||||
|
||||
## 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)
|
||||
|
|
@ -1 +0,0 @@
|
|||
ref: refs/heads/main
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
[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
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
d89a09413e2fc041089b595a06c0fb316b12e17a
|
||||
|
|
@ -1 +0,0 @@
|
|||
d89a09413e2fc041089b595a06c0fb316b12e17a
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"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.
|
Before Width: | Height: | Size: 51 KiB |
|
|
@ -1,3 +0,0 @@
|
|||
repo=https://github.com/AvengeMedia/dms-plugins
|
||||
path=DankActions
|
||||
repodir=0026f1eba8dedaec
|
||||
|
|
@ -1,644 +0,0 @@
|
|||
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
|
||||
onToggled: isChecked => {
|
||||
checked = isChecked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: "Show Text"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
id: showTextToggle
|
||||
checked: true
|
||||
onToggled: isChecked => {
|
||||
checked = isChecked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,263 +0,0 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"id": "dankActions",
|
||||
"name": "Dank Actions",
|
||||
"description": "Execute custom commands with dynamic output display and configurable icons",
|
||||
"version": "1.0.4",
|
||||
"license": "MIT",
|
||||
"author": "Avenge Media",
|
||||
"icon": "terminal",
|
||||
"firstParty": true,
|
||||
"component": "./DankActionsWidget.qml",
|
||||
"settings": "./DankActionsSettings.qml",
|
||||
"permissions": [
|
||||
"settings_read",
|
||||
"settings_write"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
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")
|
||||
}
|
||||
}
|
||||
|
|
@ -1,139 +0,0 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"id": "dankBatteryAlerts",
|
||||
"name": "Dank Battery Alerts",
|
||||
"description": "Receive notifications when battery level reaches critical or warning thresholds",
|
||||
"version": "1.1.1",
|
||||
"license": "MIT",
|
||||
"author": "Avenge Media",
|
||||
"icon": "battery_alert",
|
||||
"type": "daemon",
|
||||
"component": "./DankBatteryAlerts.qml",
|
||||
"settings": "./DankBatteryAlertsSettings.qml",
|
||||
"permissions": ["settings_read", "settings_write"]
|
||||
}
|
||||
|
|
@ -1,277 +0,0 @@
|
|||
import QtQuick
|
||||
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 hookMatugenCompleted: pluginData.matugenCompleted || ""
|
||||
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)
|
||||
return;
|
||||
executeHook(hookTheme, "onThemeChanged", Theme.currentTheme);
|
||||
}
|
||||
|
||||
function onMatugenCompleted(mode, result) {
|
||||
if (!hookMatugenCompleted)
|
||||
return;
|
||||
executeHook(hookMatugenCompleted, "onMatugenCompleted", mode + ":" + result);
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,332 +0,0 @@
|
|||
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: "matugenCompleted"
|
||||
label: "Matugen Generation Completed"
|
||||
description: "Hook: onMatugenCompleted | Value: '<mode>:<result>' (e.g., 'dark:success', 'light:no-changes')"
|
||||
placeholder: "/path/to/matugen-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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
# 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`) |
|
||||
| **Matugen Completed** | When matugen finishes generating colors | `onMatugenCompleted` | `<mode>:<result>` (e.g., `dark:success`, `light:no-changes`, `dark:error`) |
|
||||
| **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` |
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"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.7",
|
||||
"license": "MIT",
|
||||
"author": "Avenge Media",
|
||||
"icon": "webhook",
|
||||
"type": "daemon",
|
||||
"component": "./DankHooks.qml",
|
||||
"settings": "./DankHooksSettings.qml",
|
||||
"permissions": [
|
||||
"settings_read",
|
||||
"settings_write"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,156 +0,0 @@
|
|||
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
|
||||
}
|
||||
|
||||
ToggleSetting {
|
||||
settingKey: "autoSetDND"
|
||||
label: "Do Not Disturb Work"
|
||||
description: "Automatically enable Do Not Disturb mode during work sessions"
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,497 +0,0 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
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
|
||||
property bool autoSetDND: pluginData.autoSetDND ?? 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 (root.autoSetDND) {
|
||||
SessionData.setDoNotDisturb(false)
|
||||
}
|
||||
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)
|
||||
|
||||
if (root.autoSetDND) {
|
||||
SessionData.setDoNotDisturb(true)
|
||||
}
|
||||
}
|
||||
globalIsRunning.set(autoStart ?? false)
|
||||
}
|
||||
|
||||
function startShortBreak(autoStart) {
|
||||
if(globalTimerState.value === "work" && root.autoSetDND) {
|
||||
SessionData.setDoNotDisturb(false)
|
||||
}
|
||||
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) {
|
||||
if(globalTimerState.value === "work" && root.autoSetDND) {
|
||||
SessionData.setDoNotDisturb(false)
|
||||
}
|
||||
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)
|
||||
if (root.autoSetDND && globalTimerState.value === "work") {
|
||||
SessionData.setDoNotDisturb(globalIsRunning.value)
|
||||
}
|
||||
}
|
||||
|
||||
function resetTimer() {
|
||||
globalIsRunning.set(false)
|
||||
if (root.autoSetDND && globalTimerState.value === "work") {
|
||||
SessionData.setDoNotDisturb(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"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function resetTimer(): string {
|
||||
root.resetTimer()
|
||||
return "POMDORO_TIME_RESET_SUCCESS"
|
||||
}
|
||||
|
||||
function toggleTimer(): string {
|
||||
root.toggleTimer()
|
||||
return globalIsRunning.value ? "Timer is running" : "Timer is paused"
|
||||
}
|
||||
|
||||
function startWork(): string {
|
||||
root.startWork(true)
|
||||
return "POMODORO_WORK_STARTED"
|
||||
}
|
||||
|
||||
function startShortBreak(): string {
|
||||
root.startShortBreak(true)
|
||||
return "POMODORO_SHORT_BREAK_STARTED"
|
||||
}
|
||||
|
||||
function startLongBreak(): string {
|
||||
root.startLongBreak(true)
|
||||
return "POMODORO_LONG_BREAK_STARTED"
|
||||
}
|
||||
|
||||
target: "pomodoroTimer"
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: initTimer
|
||||
interval: 100
|
||||
repeat: false
|
||||
running: true
|
||||
onTriggered: {
|
||||
if (globalRemainingSeconds.value === 0 && globalTotalSeconds.value === 0) {
|
||||
root.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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"id": "dankPomodoroTimer",
|
||||
"name": "Dank Pomodoro Timer",
|
||||
"description": "Productivity timer with 25-minute work sessions and breaks",
|
||||
"version": "1.1.5",
|
||||
"license": "MIT",
|
||||
"author": "Avenge Media",
|
||||
"icon": "timer",
|
||||
"firstParty": true,
|
||||
"component": "./DankPomodoroWidget.qml",
|
||||
"settings": "./DankPomodoroSettings.qml",
|
||||
"permissions": [
|
||||
"settings_read",
|
||||
"settings_write"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2025 Avenge Media LLC
|
||||
|
||||
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.
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
# 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" />
|
||||
|
|
@ -1 +0,0 @@
|
|||
ref: refs/heads/master
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
[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
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
87870d8b70758f08aa8fd5401a0e4eec3941ed48
|
||||
|
|
@ -1 +0,0 @@
|
|||
87870d8b70758f08aa8fd5401a0e4eec3941ed48
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
# 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
|
|
@ -1,251 +0,0 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
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.
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
# 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.
|
||||
|
||||

|
||||
|
||||
## 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
|
|
@ -1 +0,0 @@
|
|||
ref: refs/heads/main
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
[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
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
2951ec7f823c983c11b6b231403581a386a7c9f6
|
||||
|
|
@ -1 +0,0 @@
|
|||
2951ec7f823c983c11b6b231403581a386a7c9f6
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"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.
|
Before Width: | Height: | Size: 69 KiB |
|
|
@ -1,161 +0,0 @@
|
|||
#!/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()
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/lew/.config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
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.
|
||||
|
|
@ -1,237 +0,0 @@
|
|||
# Web Search
|
||||
|
||||
A DankMaterialShell launcher plugin for searching the web with 23+ built-in search engines and support for custom search engines.
|
||||
|
||||

|
||||
|
||||
## 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)
|
||||
|
|
@ -1,352 +0,0 @@
|
|||
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()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,727 +0,0 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
ref: refs/heads/main
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
[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
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
81ccd9fd8249b3c9ef40dde42549f807e36ae3e3
|
||||
|
|
@ -1 +0,0 @@
|
|||
81ccd9fd8249b3c9ef40dde42549f807e36ae3e3
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue