R7.9: Explorer's New makes docx, xlsx, pptx and md on Windows

Each app installs a blank file and points ShellNew at it. Explorer
lists a type only through its default class, so a type no program
handles (no default, or one naming no class) gets the app's class;
an installed handler is never replaced. Uninstall removes only what
this install wrote.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-17 00:32:48 -04:00
1 parent 2f971c646f
commit 632a66eb46
11 files changed
+80 -5

No files matched your search

+1
View File
@@ -1,6 +1,7 @@
; Per-user installer; pass each define the checks below name.
Unicode true
!include "MUI2.nsh"
!include "LogicLib.nsh"
!ifndef APP_NAME
!error "pass -DAPP_NAME"
+4
View File
@@ -18,6 +18,10 @@ makensis=${MAKENSIS:-"/c/Program Files (x86)/NSIS/makensis.exe"}
}
stage=$root/target/stage/$slug
"$root/packaging/stage.sh" "$slug" "$stage"
# Explorer's New copies these; the install list owns them.
for ext in $(awk -F'\t' -v slug="$slug" '$1 == slug { print $2 }' "$root/packaging/types.tsv"); do
[ ! -e "$root/packaging/windows/new/new.$ext" ] || cp "$root/packaging/windows/new/new.$ext" "$stage/"
done
types=$root/target/stage/$slug-types.nsh
"$root/packaging/windows/types.sh" "$slug" >"$types"
list=$root/target/stage/$slug-files.txt
Binary file not shown.
View File
Whitespace-only changes.
Binary file not shown.
Binary file not shown.
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Writes packaging/windows/new: the blank files Explorer's New makes.
set -euo pipefail
root=$(cd "$(dirname "$0")/../.." && pwd)
soffice=$root/engines/lo-src/instdir/program/soffice.com
[ -x "$soffice" ] || {
echo "templates.sh: no kernel at $soffice; run scripts/build-libreoffice.sh" >&2
exit 1
}
out=$root/packaging/windows/new
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
mkdir "$work/in"
# The kernel reads an empty file as a new document.
for ext in docx xlsx pptx; do
: >"$work/in/new.$ext"
"$soffice" --headless --norestore "-env:UserInstallation=file:///$(cygpath -m "$work/profile")" \
--convert-to "$ext" --outdir "$(cygpath -w "$out")" "$(cygpath -w "$work/in/new.$ext")"
[ -s "$out/new.$ext" ] || {
echo "templates.sh: the kernel wrote no new.$ext" >&2
exit 1
}
done
: >"$out/new.md"
+31 -1
View File
@@ -10,11 +10,16 @@ progid="ElyOffice.$name"
classes='Software\Classes'
exts=$(awk -F'\t' -v slug="$slug" '$1 == slug && $2 != "/" { print $2 }' "$root/packaging/types.tsv")
folder=$(awk -F'\t' -v slug="$slug" '$1 == slug && $2 == "/" { print "yes" }' "$root/packaging/types.tsv")
# Types Explorer's New menu makes, from packaging/windows/new.
fresh=""
for ext in $exts; do
[ ! -e "$root/packaging/windows/new/new.$ext" ] || fresh="$fresh $ext"
done
# Open With lists the app; the user's default stays theirs.
echo '!macro ElyTypesInstall'
if [ -n "$exts" ]; then
echo " WriteRegStr HKCU \"$classes\\$progid\" \"\" \"$name\""
echo " WriteRegStr HKCU \"$classes\\$progid\" \"\" \"$name Document\""
echo " WriteRegStr HKCU \"$classes\\$progid\\DefaultIcon\" \"\" \"\$INSTDIR\\$slug.ico\""
echo " WriteRegStr HKCU \"$classes\\$progid\\shell\\open\\command\" \"\" '\"\$INSTDIR\\$slug.exe\" \"%1\"'"
echo " WriteRegStr HKCU \"$classes\\Applications\\$slug.exe\" \"FriendlyAppName\" \"$name\""
@@ -23,6 +28,20 @@ if [ -n "$exts" ]; then
echo " WriteRegStr HKCU \"$classes\\Applications\\$slug.exe\\SupportedTypes\" \".$ext\" \"\""
done
fi
for ext in $fresh; do
echo " WriteRegStr HKCU \"$classes\\.$ext\\ShellNew\" \"FileName\" \"\$INSTDIR\\new.$ext\""
# New needs a class; take only a handlerless type.
echo " ReadRegStr \$0 HKCR \".$ext\" \"\""
echo " ClearErrors"
# A default naming no class handles nothing either.
echo " \${If} \$0 != \"\""
echo " EnumRegKey \$1 HKCR \"\$0\" 0"
echo " \${EndIf}"
echo " \${If} \$0 == \"\""
echo " \${OrIf} \${Errors}"
echo " WriteRegStr HKCU \"$classes\\.$ext\" \"\" \"$progid\""
echo " \${EndIf}"
done
if [ -n "$folder" ]; then
echo " WriteRegStr HKCU \"$classes\\Directory\\shell\\$progid\" \"\" \"Open in $name\""
echo " WriteRegStr HKCU \"$classes\\Directory\\shell\\$progid\" \"Icon\" \"\$INSTDIR\\$slug.ico\""
@@ -39,6 +58,17 @@ if [ -n "$exts" ]; then
echo " DeleteRegValue HKCU \"$classes\\.$ext\\OpenWithProgids\" \"$progid\""
done
fi
# Only what this install wrote.
for ext in $fresh; do
echo " ReadRegStr \$0 HKCU \"$classes\\.$ext\\ShellNew\" \"FileName\""
echo " \${If} \$0 == \"\$INSTDIR\\new.$ext\""
echo " DeleteRegKey HKCU \"$classes\\.$ext\\ShellNew\""
echo " \${EndIf}"
echo " ReadRegStr \$0 HKCU \"$classes\\.$ext\" \"\""
echo " \${If} \$0 == \"$progid\""
echo " DeleteRegValue HKCU \"$classes\\.$ext\" \"\""
echo " \${EndIf}"
done
if [ -n "$folder" ]; then
echo " DeleteRegKey HKCU \"$classes\\Directory\\shell\\$progid\""
fi