Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions PACKAGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,15 @@ The packaged config contains a `spawn kitty` keybind as an editable example. Kit
<prefix>/lib/dinit.d/user/umbriel
<prefix>/lib/dinit.d/user/umbriel-session
<prefix>/share/umbriel/effects/<kind>/<name>/{shader.glsl,effect.toml}
<prefix>/share/bash-completion/completions/umbriel
<prefix>/share/zsh/site-functions/_umbriel
<prefix>/share/fish/vendor_completions.d/umbriel.fish
```

`share/umbriel/config.toml` is required. It is installed directly from [`examples/config.toml`](examples/config.toml) and serves as the default when no user or system configuration exists.

The three completion files are generated by the installed binary during `meson install` (`umbriel completions <shell>`), so they always match the actions and commands that build ships. A cross build cannot run the target binary and installs none of them; hold the build for the target architecture when completion matters.

Bundled effect presets install under `share/umbriel/effects/`; users include an `effect.toml` and select its name, and nothing is active until selected.

The desktop entry must launch `start-umbriel`. The generated launcher and compositor service definitions contain the configured absolute path to the `umbriel` binary. Packages using nonstandard paths must preserve these configured references.
Expand Down
14 changes: 14 additions & 0 deletions docs/user/ipc.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,20 @@ Disconnect, malformed or oversized input, or 250 ms without a snapshot closes th

`umbriel config set`, `config get`, and `config unset` manage [runtime overrides](configuration.md#runtime-overrides). Their requests are `{"cmd":"config-set","args":["<key>","<value>"]}`, `{"cmd":"config-get","args":["<key>"]}`, and `{"cmd":"config-unset","args":["<key>"]}` (or `["--all"]`).

## Shell completions

`umbriel completions <bash|zsh|fish>` prints a completion script. Packages install it for bash, zsh, and fish under `share/bash-completion/completions`, `share/zsh/site-functions`, and `share/fish/vendor_completions.d` with no further setup; an uninstalled build can eval it instead:

```sh
eval "$(umbriel completions bash)" # bash
eval "$(umbriel completions zsh)" # zsh
umbriel completions fish | source # fish
```

Completion covers every action and its arguments, every IPC subcommand and its flags, the `config` subcommands (`validate`, `schema`, `set`, `get`, `unset`), `subscribe` event names, and `completions` shells. Action arguments complete the vocabulary their parser accepts: layout modes and `toggle` sequences, window regions, stacking anchors, `normal`/`tabbed`, scratchpad and submap names, effect preset and pool names, and `--output`/`--window`/`--name` flags that the action takes.

Configured names (outputs, workspaces, scratchpads, submaps, effect presets and pools) come from the configuration file and need no session. Output names, window ids, workspace names, and effect pool names also come from the running compositor when it answers within a 120 ms budget that covers the whole request — connect, send, and reply; a stopped or absent compositor simply leaves those arguments out. Set `UMBRIEL_COMPLETE_LIVE=0` to skip that query entirely. `umbriel complete -- <word>...` is the callback the scripts use: it prints `candidate<TAB>description` lines, or exits 2 for a path (`-c`) and 3 for a command line (`spawn`, the startup `-s` flag), which the shell completes itself.

## Virtual outputs

| Request | CLI |
Expand Down
12 changes: 12 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,8 @@ core_sources = files(
'src/workspace/tab_presenter.cpp',
'src/workspace/scratchpad.cpp',
'src/cli/ipc_client.cpp',
'src/cli/complete.cpp',
'src/cli/completion_script.cpp',
'src/server/action_request.cpp',
'src/server/event_pacer.cpp',
'src/server/ipc.cpp',
Expand Down Expand Up @@ -993,6 +995,16 @@ install_data(
install_dir: get_option('datadir') / 'wayland-sessions',
)

# The completion scripts are generated by the binary, so the tables they read and the scripts that get installed have
# one source. A cross build cannot execute the target binary, so it installs none.
if not meson.is_cross_build()
meson.add_install_script(
'tools/install_completions.sh',
meson.current_build_dir() / 'umbriel',
get_option('datadir'),
)
endif

umbriel_session_config = configuration_data()
umbriel_session_config.set(
'UMBRIEL_EXECUTABLE',
Expand Down
27 changes: 27 additions & 0 deletions src/cli/cli_words.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once

#include <string_view>

namespace umbriel {

// The words the CLI spells for itself, shared by the dispatch in `main.cpp` and the completion engine, so a rename
// cannot leave the two disagreeing about what the command line accepts.
inline constexpr std::string_view kCliMsg = "msg";
inline constexpr std::string_view kCliSubscribe = "subscribe";
inline constexpr std::string_view kCliConfig = "config";
inline constexpr std::string_view kCliCompletions = "completions";
inline constexpr std::string_view kCliComplete = "complete";
inline constexpr std::string_view kCliHelp = "help";
inline constexpr std::string_view kCliConfigValidate = "validate";
inline constexpr std::string_view kCliConfigSchema = "schema";
inline constexpr std::string_view kCliJsonFlag = "--json";
inline constexpr std::string_view kCliJsonShortFlag = "-j";
inline constexpr std::string_view kCliSpawnFlag = "-s";
inline constexpr std::string_view kCliConfigFlag = "-c";
inline constexpr std::string_view kCliHelpShortFlag = "-h";
inline constexpr std::string_view kCliHelpFlag = "--help";
inline constexpr std::string_view kCliVersionFlag = "--version";
inline constexpr std::string_view kCliVersionShortFlag = "-v";
inline constexpr std::string_view kCliVersionUpperFlag = "-V";

} // namespace umbriel
Loading