feat(MINE): add <<open whit>> WIP
This commit is contained in:
1 parent
b6f51a76ff
commit
f3bb6efd96
4 files changed
+124
-2
No files matched your search
+45
-2
@@ -130,6 +130,49 @@ endif()
|
||||
install(FILES resources/icons/package.svg
|
||||
DESTINATION share/icons/hicolor/scalable/apps
|
||||
RENAME org.fws.PacManager.svg)
|
||||
|
||||
# Same route for the .fwspacm plugin packages, which the entry above does not
|
||||
# cover: the Flatpak types are declared by flatpak itself, so Dolphin already
|
||||
# knows them, but nothing declares ours. The XML gives the extension a MIME
|
||||
# type (and the icon a name), mimeapps.list says which application opens it.
|
||||
#
|
||||
# update-mime-database is run at install time because the spec requires it: it
|
||||
# is what merges the XML into the shared database the file managers read. It is
|
||||
# a hard requirement for .fwspacm to be recognised at all, so a missing one
|
||||
# fails the install rather than leaving a half-configured desktop behind.
|
||||
install(FILES resources/mime/fws-pacmanager.xml
|
||||
DESTINATION share/mime/packages)
|
||||
# Beside the desktop entry, which is the location XDG_DATA_DIRS/applications
|
||||
# reads. No patching needed: it names the desktop entry, not an absolute path.
|
||||
install(FILES resources/mime/mimeapps.list
|
||||
DESTINATION share/applications)
|
||||
install(FILES resources/icons/plugin-package.svg
|
||||
DESTINATION share/icons/hicolor/scalable/apps
|
||||
RENAME application-vnd.fws.pacmanager.plugin-package.svg)
|
||||
# Refreshing the database is a system-wide side effect, so it is skipped when
|
||||
# installing into a staging root (DESTDIR set): the packager runs it against the
|
||||
# real prefix once the package is deployed. That also means a packaging build
|
||||
# never needs shared-mime-info installed on the build machine.
|
||||
install(CODE "
|
||||
if(NOT \"\$ENV{DESTDIR}\" STREQUAL \"\")
|
||||
message(STATUS \"Skipping update-mime-database (DESTDIR is set)\")
|
||||
else()
|
||||
find_program(UPDATE_MIME_DATABASE update-mime-database)
|
||||
if(NOT UPDATE_MIME_DATABASE)
|
||||
message(FATAL_ERROR
|
||||
\"update-mime-database not found: install shared-mime-info, or \"
|
||||
\".fwspacm files will not be recognised by the desktop\")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND \"\${UPDATE_MIME_DATABASE}\" \"\${CMAKE_INSTALL_PREFIX}/share/mime\"
|
||||
RESULT_VARIABLE MIME_RESULT
|
||||
OUTPUT_VARIABLE MIME_OUTPUT
|
||||
ERROR_VARIABLE MIME_OUTPUT)
|
||||
if(NOT MIME_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR \"update-mime-database failed: \${MIME_OUTPUT}\")
|
||||
endif()
|
||||
endif()
|
||||
")
|
||||
install(CODE "
|
||||
set(DESKTOP_DIR \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/share/applications\")
|
||||
file(MAKE_DIRECTORY \"\${DESKTOP_DIR}\")
|
||||
@@ -143,10 +186,10 @@ Exec=${CMAKE_INSTALL_PREFIX}/bin/PacManager %U
|
||||
Icon=org.fws.PacManager
|
||||
Terminal=false
|
||||
Categories=System;PackageManager;Qt;
|
||||
MimeType=application/vnd.flatpak.ref;application/vnd.flatpak.repo;application/vnd.flatpak;
|
||||
MimeType=application/vnd.flatpak.ref;application/vnd.flatpak.repo;application/vnd.flatpak;application/vnd.fws.pacmanager.plugin-package;
|
||||
StartupNotify=true
|
||||
\")
|
||||
")
|
||||
")
|
||||
install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})
|
||||
|
||||
# Tests
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#e2e8f0" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="24" height="24">
|
||||
<path d="M21 8l-9-5-9 5v8l9 5 9-5V8z"/>
|
||||
<path d="M3 8l9 5 9-5"/>
|
||||
<path d="M12 13v8"/>
|
||||
<path d="M14.5 9.5h1.25a.75.75 0 0 1 0 1.5H14.5a.75.75 0 0 1 0-1.5z" fill="#e2e8f0" stroke="none"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 378 B |
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
The MIME type of a plugin package (.fwspacm), the archive the packaging
|
||||
script at the repo root builds (see make-plugin-package.py).
|
||||
|
||||
Without this file the extension is unknown to the desktop, so a file manager
|
||||
never offers the application that knows how to read it: the user could only
|
||||
install a package by dropping it on an already open window. Declaring the
|
||||
type is what makes Dolphin (and any other freedesktop file manager) list
|
||||
PacManager under "Ouvrir avec" for a .fwspacm file and hand the path over on
|
||||
the command line: the desktop entry takes %U and
|
||||
MainWindow::installLocalFiles takes it from there.
|
||||
|
||||
Which of those files open with PacManager straight away is decided by
|
||||
mimeapps.list (installed next to the desktop entry), not here: the MIME
|
||||
database only says what a file *is*.
|
||||
|
||||
No <icon> element on purpose: the spec says the system database ignores it,
|
||||
and the name a file manager looks up is derived from the type by convention
|
||||
(application-vnd.fws.pacmanager.plugin-package), which is the name the
|
||||
matching icon is installed under.
|
||||
-->
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="application/vnd.fws.pacmanager.plugin-package">
|
||||
<comment xml:lang="fr">Paquet de plugin PacManager</comment>
|
||||
<comment xml:lang="en">PacManager plugin package</comment>
|
||||
<!-- An archive, so a file manager that only knows ZIP still shows something
|
||||
sensible, and so the generic archive actions stay available. -->
|
||||
<sub-class-of type="application/zip"/>
|
||||
<glob pattern="*.fwspacm"/>
|
||||
<!-- The glob alone is not enough. Content detection runs before name
|
||||
matching and a .fwspacm *is* a ZIP, so application/zip (priority 50)
|
||||
would win and the file manager would offer Archive Manager instead.
|
||||
Matching the archive layout instead of the name: the local file header
|
||||
starts with PK\x03\x04 and its 26 following bytes carry the name of the
|
||||
first entry, which a package always makes plugin.json. Priority 60 puts
|
||||
it above the generic ZIP rule while staying below a more specific type
|
||||
that would claim the file for a better reason. -->
|
||||
<magic priority="60">
|
||||
<match type="string" offset="0" value="PK\x03\x04"/>
|
||||
<match type="string" offset="30" value="plugin.json"/>
|
||||
</magic>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
@@ -0,0 +1,29 @@
|
||||
# Which files PacManager opens, and how.
|
||||
#
|
||||
# The MIME database (resources/mime/fws-pacmanager.xml) only says what a file
|
||||
# *is*; it cannot choose an application. That is this file's job, and it is the
|
||||
# reason installing the app is enough to make the association show up in a file
|
||||
# manager -- no xdg-mime call is needed afterwards.
|
||||
#
|
||||
# [Default Applications] -- a double click opens the file with PacManager.
|
||||
# Only the plugin packages are claimed outright: nothing else handles them, the
|
||||
# type is private, and a package is useless without the application that reads
|
||||
# it. The Flatpak formats are deliberately *not* here: a .flatpakref belongs to
|
||||
# the Flatpak world, and stealing the double click from it would be rude to
|
||||
# whoever installed flatpak.
|
||||
#
|
||||
# [Added Associations] -- PacManager appears in "Ouvrir avec" (and stays out of
|
||||
# the default). The user picks it when they mean it; their own default set in
|
||||
# the system settings keeps winning. This is what the desktop entry's MimeType
|
||||
# line advertises.
|
||||
#
|
||||
# Both sections are additive for the types they name and touch nothing else, so
|
||||
# a user's own choices in ~/.config/mimeapps.list still override them.
|
||||
|
||||
[Default Applications]
|
||||
application/vnd.fws.pacmanager.plugin-package=org.fws.PacManager.desktop
|
||||
|
||||
[Added Associations]
|
||||
application/vnd.flatpak.ref=org.fws.PacManager.desktop;
|
||||
application/vnd.flatpak.repo=org.fws.PacManager.desktop;
|
||||
application/vnd.flatpak=org.fws.PacManager.desktop;
|
||||
Reference in new issue
Block a user