Skip to content

m365: menu entries work when opened through xdg-open - #2

Open
rhmatzeka wants to merge 1 commit into
mainfrom
fix/m365-xdg-open
Open

rhmatzeka wants to merge 1 commit into
mainfrom
fix/m365-xdg-open

Conversation

@rhmatzeka

@rhmatzeka rhmatzeka commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Problem

Opening a .pptx/.docx/.xlsx with xdg-open (terminal, many apps) did nothing when "Open with Microsoft 365" is the default. xdg-open's generic launcher splits the Exec line on spaces, so the sh -c "exec ~/.local/bin/m365-open \\"\\$@\\"" sh %F wrapper fails with Unterminated quoted string, and xdg-open still exits 0. Double-clicking in a file manager (gio) worked, which hid the bug.

Fix

  • config/applications/*.desktop: Exec is now a single command with an @BIN@ placeholder, no sh -c.
  • linux/install.sh (apps): renders the entries with the absolute ~/.local/bin path into ~/.local/share/rhmatzeka-tools/applications/ and links them as before, so uninstall still works through the manifest.
  • bin/m365-open: new --app word|excel|powerpoint [FILE...] (no file opens the empty app, which the Word/Excel/PowerPoint entries used to decide in shell), and it calls m365 next to itself instead of relying on PATH.

Tested

  • xdg-open and gio launch with a file name containing spaces: the path reaches m365-open as one argument (logging stub, nothing uploaded).
  • Word entry with no file and m365-open --app powerpoint with PATH=/usr/bin:/bin: m365 starts the empty app.
  • sh -n, bash -n, shellcheck: clean.

After merging

Existing installs link straight to the templates, so re-run the apps component once (./install.sh --only apps) to render the new entries.

xdg-open splits a .desktop Exec line on spaces, so the sh -c wrapper used to
reach ~/.local/bin broke with 'Unterminated quoted string' and nothing opened,
while gio and file managers worked. The entries are now templates with @bin@,
rendered by the installer with the absolute path, and the Word/Excel/PowerPoint
choice between empty app and file moved into m365-open --app. m365-open also
calls m365 next to itself instead of relying on PATH.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant