Skip to content
src.wesktop.entries
Edit
On this page

Create and remove native desktop entries across platforms: Linux .desktop files, macOS .app bundles, and Windows Start Menu shortcuts from one API.

#src.wesktop.entries

#src.wesktop.entries

Cross-platform desktop entry creation and removal for Linux .desktop files, macOS .app bundles, and Windows Start Menu shortcuts.

#create_entry

python
def create_entry(name: str, command: str, *, icon: str | Path | None=None, comment: str='', categories: str='Utility;') -> Path

Create a platform-native desktop entry. Returns the path of the created entry.

command is a full, already-quoted command line. On Linux/macOS, quote arguments with shlex.quote. On Windows, double-quote any path or argument containing spaces (see :func:quote_windows_command).

#remove_entry

python
def remove_entry(name: str) -> bool

Remove a desktop entry (and its launcher script, if any).

Returns True if something was removed.

#entry_exists

python
def entry_exists(name: str) -> bool

Check whether a desktop entry already exists for name on this platform.

#launcher_name

python
def launcher_name(name: str) -> str

Derive the launcher script name for an app: slugged name + '-open'.

#launcher_path

python
def launcher_path(name: str) -> Path

Path of the launcher script for name (POSIX platforms).

#create_launcher

python
def create_launcher(name: str, command: str) -> Path

Create an executable launcher script for name that execs command.

command must be a fully shell-quoted POSIX command line. Only supported on Linux and macOS -- a POSIX shell script cannot execute on Windows, so Windows shortcuts must point directly at their target instead.

#remove_launcher

python
def remove_launcher(name: str) -> bool

Remove the launcher script for name. Returns True if it existed.

#_split_windows_command

python
def _split_windows_command(command: str) -> tuple[str, str]

Split a Windows command line into (target, arguments).

Quoting contract: a target path containing spaces MUST be double-quoted, e.g. '"C:\Program Files\app.exe" --arg'. Unquoted commands split at the first whitespace. An unquoted absolute-path target whose first token has no file extension is almost certainly a spaces-in-path target truncated at the first space -- that is a hard error instead of silently producing a shortcut to a nonexistent target.

#quote_windows_command

python
def quote_windows_command(parts: Sequence[str]) -> str

Join command parts into a Windows command line.

Follows the quoting contract of :func:_split_windows_command: any part containing whitespace is double-quoted.

#_windows_com_available

python
def _windows_com_available() -> bool

Whether the pywin32 COM backend is importable.

More tools from this site

  • claudestream Drive Claude Code from Python: run it as a subprocess and read its output as typed events, with async and sync sessions, sandbox policies, and tools you define in Python
  • claudewheel A TUI Claude Code Launcher that lets you have more than one profile, manage sessions lifecycle, pick the exact CC version, model to use (even older unlisted ones), pick which GitHub account to use, etc.
  • dirstat Fast, single-binary directory statistics CLI: every file under a tree grouped by format, with counts, sizes, and lines of code, as a colored terminal table or as JSON
  • fastware A batteries-included ASGI framework: msgspec JSON, a managed Granian server, dependency injection, SSE, WebSockets, auth, and a test client
  • go-toml-edit Zero-dep TOML editing library for Go with comment preservation
  • howmuchleft The fastest Claude Code statusline: context window, 5-hour, and weekly limit usage as three customizable gradient bars, rendering in about 6 ms
  • orxtra
  • pgdesign
  • predraw Declarative rendering pipeline: describe a scene in JSON and get SVG, PNG and WebP out, with light and dark style tokens, reusable components and text converted to path outlines
  • reposummary Turn a git repository's history into a Markdown journal: pick a time window or revision range and get a readable digest of what changed, optionally narrated by an LLM
  • rlsbl Release orchestration and project scaffolding CLI that bumps versions, validates a structured JSONL changelog, tags only the commit CI verified, and publishes to npm, PyPI, Go and more
  • safegit git wrapper CLI that gives each commit its own temporary index and retries ref updates on conflict, so concurrent agents share one repository
  • saferm Command-line replacement for rm that archives every deletion with a mandatory reason and the context it ran in, so deleted files can be listed, inspected and restored
  • selfdoc Static Site Generator that builds a project's documentation site directly from its source code, so the docs can never drift from the code they describe, with SEO/AEO, first-class blog, search, and cross-project linking built in
  • strictcli
  • stricttest An always-on test-isolation floor: a pytest plugin and a Go env-hygiene module that make a test suite structurally unable to reach real credentials, the real HOME, the network, or the development repository.
Search