Skip to content

Create an IPC call

This guide walks you through adding a new IPC endpoint to Noctalia shell.


Adding an IPC endpoint is pretty straightforward once you know the pieces.
You’ll go through two main steps:

  1. Add an IpcHandler
  2. Connect to a service (recommended)

Let’s break it down step by step.


First, you’ll create your IPC endpoint in the main IPC manager.
Open Modules/IPC/IPCManager.qml and add a new handler block:

IpcHandler {
target: "myFeature" // This becomes your endpoint name
function toggle() {
// Your toggle logic here
console.log("Feature toggled!")
}
function setMode(mode) {
// Handle different modes
if (mode === "compact") {
// do compact things
} else if (mode === "full") {
// do full things
}
}
}

Each function you add becomes callable as <target> <function> from your window manager.
So the above creates myFeature toggle and myFeature setMode.


Section titled “Step 2: Connect to a Service (Recommended)”

Rather than putting all your logic in the IPC handler, delegate to existing services or create a new one if need be.
This keeps your IPC thin and reuses logic that other parts of the shell might need.

Here’s how the brightness handler does it:

IpcHandler {
target: "brightness"
function increase() {
BrightnessService.increaseBrightness() // Delegate to service
}
function decrease() {
BrightnessService.decreaseBrightness() // Keep handlers simple
}
}

Keep IPC method names short and action-oriented:

  • toggle, increase, decrease, set
  • incrementBrightnessLevel

Always validate inputs, especially for numeric values:

function setStrength(percent) {
// Clamp between 0-100, handle bad input gracefully
var value = Math.max(0, Math.min(100, Number(percent) || 0))
NightLightService.setStrength(value)
}

If your window manager supports holding keys, make methods fast and repeatable.
The brightness handlers work well for this - each call makes a small adjustment.

IPC handlers should be thin wrappers. If you’re writing lots of logic in the handler, it probably belongs in a service instead.


Check out these existing handlers in IPCManager.qml for patterns:

  • brightness - Simple increase/decrease for continuous values
  • volume - Similar pattern to brightness
  • notifications - Toggle-style functionality
  • launcher - Panel open/close operations

Don’t hesitate to copy patterns that work!


Method not found?
Double-check your target name and ensure IPCManager.qml saved properly.

Nothing happening?
Add Logger.log() statements in your method and watch the shell output.