Skip to main content
Version: 2.2

Dux Labs

IPC

IPC

The dux-edit app exposes its operations over a unix socket. Invoke a method and pass params as key=value pairs:

dux-edit ipc ui.toggle
dux-edit ipc ui.open paths=/etc/hostname line=3
dux-edit ipc ui.open paths=/tmp/a paths=/tmp/b
dux-edit ipc search.find docId=1 version=4 query=TODO

List every available method and its params from the running app:

dux-edit ipc describe

Results print JSON. Params marked * are required. Values that parse as JSON are sent typed, anything else as a string. A key given twice is sent as a list, and so is a list param such as paths, even when given once. ipc needs the running app; method and param names complete with the shell (see dux-edit completion). Set DUX_EDIT_SOCKET to talk to a specific socket.

Expected failures are results, {"ok": false, "code": "..."}, not IPC errors. Offsets are UTF-16 code units and lines are 0-based on the socket, except ui.open, whose line and column are 1-based like the CLI flags.

Keybinds​

For a key that shows the window, run dux-edit itself: it starts the app when it is not running. ui.toggle hides the window again, but needs the app already running.

binds {
Mod+E { spawn "dux-edit"; }
Mod+Shift+E { spawn "dux-edit" "ipc" "ui.toggle"; }
Mod+Alt+E { spawn "dux-edit" "--new-instance"; }
}

Shortcuts inside the window are in Keyboard.

Core​

MethodParams
pingLiveness check
versionBackend and API version
describeList all IPC methods and their params
subscribetopics (ui, docs, highlight, spell, colorScheme; default ui)
unsubscribetopics

UI​

MethodParams
ui.showShow the window, creating it if needed
ui.hideClose the window and stay resident
ui.toggleShow or hide the window
ui.openpaths (absolute paths; empty opens a new draft), positions (one {line, column} object per path; nonnegative integers, 1-based, 0 for unset), line, column (1-based, first path), simple
ui.quitQuit the app

Documents​

MethodParams
doc.openpath, swapId (draft or recovery swap to load), encoding, elevated (read through polkit), force (skip the large file confirmation): both path and swapId empty opens a new draft. A file's result carries indentStyle and indentWidth from .editorconfig or a modeline when known
doc.editdocId*, version*, start*, removed*, text*, length*, undoSteps, redo: apply one text change to the mirror
doc.resetdocId*, version*, text*, conflict: replace the mirror after a resync event
doc.savedocId*, version*, md5, path (save as), encoding, bom, eol (lf|crlf|cr), elevated, force (overwrite a file changed on disk), overwrite (replace an existing file on save as)
doc.reloaddocId*, encoding: re-read the file, dropping unsaved edits
doc.closedocId*, discard (delete its swap), version, md5
doc.setTitledocId*, title*: name a draft
doc.textdocId*: current mirror text
doc.matchBracketdocId*, version*, offset*, first*, last*: match the bracket beside the cursor, ignoring strings and comments
doc.flushWrite pending swaps now
recovery.listSwaps no open document or live instance owns
recovery.discardswapId*

Highlighting​

MethodParams
highlight.viewdocId*, first*, last* (0-based, inclusive): set the visible line range; spans follow on the highlight topic
highlight.setLexerdocId*, lexer (empty for automatic), force (highlight past the size caps)
highlight.statedocId*: lexer and tier of a document
highlight.lexersEvery lexer, for the language picker
MethodParams
search.finddocId*, version*, query*, regex (RE2), caseSensitive, wholeWord, limit (default 10000), seq
search.replaceAllSame as search.find plus replacement* ($1 expands in regex mode): one edit that replaces every match
search.expandSame as search.find plus replacement*, start*, length*: replacement text for one match

Spellcheck​

MethodParams
spell.configureenabled*, language (dictionary code or auto), strings
spell.languagesInstalled hunspell dictionaries
spell.viewdocId*, first*, last*, cursorLine, cursorColumn: ranges follow on the spell topic
spell.suggestword*, language
spell.addword*: add to the user dictionary
spell.ignoreword*: ignore until the app exits

Markdown​

MethodParams
markdown.renderdocId*, version*, palette, codeBackground, linkColor: render to Qt rich text HTML

System​

MethodParams
plugins.listScan the plugin directories
dialog.openFilestitle, dir, multiple (default true): portal open dialog
dialog.saveFiletitle, dir, name: portal save dialog
system.colorScheme.getDesktop light/dark preference
system.elevationWhether saving as administrator can be offered
import.dmsdryRun, apply (also send the result to the UI): copy DMS notepad tabs and settings

Live Updates​

Subscribe to push events instead of polling. Topics: ui (default), docs, highlight, spell, colorScheme.

Next Steps​

  • Usage - CLI wrappers around methods
  • Keyboard - What the window binds by default