-
Notifications
You must be signed in to change notification settings - Fork 7
CCSMB-11: Desktop Application Discovery #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tomodachi94
wants to merge
22
commits into
CCSMB:master
Choose a base branch
from
tomodachi94:ccsmb-desktop
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1cf7891
propose CCSMB-11
tomodachi94 3a97c18
rename ManagesOwnWindows to CompliantWindowManagement
tomodachi94 175b9a7
add Icon field
tomodachi94 af434b7
fix error
tomodachi94 ce55041
CompliantWindowManagement implied true if Terminal true
tomodachi94 fa92507
use emdash
tomodachi94 5c8a9f4
define behavior for target programs where no path found
tomodachi94 33dabd7
reorder suggested dirs
tomodachi94 ecdb963
be more explicit about ccsmb_desktop module
tomodachi94 68e64c6
define keywords
tomodachi94 d8ff672
define behavior for app launchers when no search paths
tomodachi94 3bb8e4e
specify that funcs shouldn't be present
tomodachi94 1918d06
add examples
tomodachi94 6374ff7
allow all deterministic functions in specs
tomodachi94 0cc31ce
permit icons to be multiple sizes
tomodachi94 dee8c89
Icon -> Icons
tomodachi94 6c2bb0c
X- -> Extra array
tomodachi94 b821fba
Make Icons into an array format
tomodachi94 18237ce
rename settings options to be consistent
tomodachi94 3cddd24
rework Icons again
tomodachi94 787b717
add Icons[Format]
tomodachi94 6fbf8b2
remove Type in favor of Format
tomodachi94 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Syntax highlighting for .desktop files uses XDG syntax, not CCSMB syntax | ||
| Standards/CCSMB-11/*.desktop linguist-language=Lua |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # *CCSMB-11*: Desktop Application Discovery | ||
|
|
||
| *Author: Tomodachi94* | ||
|
|
||
| *Version:* | ||
|
|
||
| *Last revised:* | ||
|
|
||
| The words MUST, MUST NOT, SHOULD, SHOULD NOT, and MAY are defined in [RFC 2119](https://www.rfc-editor.org/rfc/rfc2119). | ||
|
|
||
| ## Rationale | ||
|
|
||
| Currently, most ComputerCraft graphical operating systems, windowing and desktop management systems, and application launchers (collectively "target software") define their own method of discovering and launching applications. The behavior and expectations for each piece of target software vary wildly; for example, some target software expects programs to manage their own windowing through system-specific APIs, while other target software manages it entirely for all programs. Additionally, installation scripts and package managers ("software management tooling") contains wildly inconsistent behavior, varying from not defining any sort of application discovery, containing support for one or two specific target softwares, or attempting to maintain support for *all* target software. | ||
|
|
||
| The purpose of this specification is to standardize behavior for installing, discovering, and launching graphical applications, enabling greater interoperability in all target software and software management tooling. | ||
|
|
||
| ## Application specifications | ||
|
|
||
| Central to the specification are "application specifications". Each application specification MUST be a Lua file with valid syntax. Each application specification SHOULD NOT call non-builtin functions in their source (as well as functions introducing [non-determinism](https://en.wikipedia.org/wiki/Deterministic_system)). Each specification MUST return a table. The table specified in each application specification MUST contain the following fields: | ||
|
|
||
| | Field | Type | Description | | ||
| |---------------------------|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| | Name | str | A human-readable name of the application. | | ||
| | Type | str ("Application") | The type of the entry. Compliant software SHOULD ignore the whole entry if this is set to an unknown value. | | ||
| | Exec | str | The path to the file to execute, including arguments. The full path MAY be omitted if it is present in `shell.getPath`. | | ||
| | Terminal | bool | Whether to run the application in a terminal or not. | | ||
| | CompliantWindowManagement | bool | Whether the application manages its own windows through a system-specific API. If set to `false`, compliant specifications SHOULD define `ShowIn` (see below). If `Terminal` is set to `true`, this is implied to be `true`. | | ||
|
|
||
| Compliant application specifications MAY define the following additional fields: | ||
|
|
||
| | Field | Type | Description | | ||
| |-------------|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| | Icons | number-indexed array of array with fields | An array representing a set of icons for an application. Compliant application specifications SHOULD have at least one square image (where width and height are identical). Please see the below section for the format of this array. | | ||
| | GenericName | str | The "generic name" of the application. For example, for a file browser, this should be "File Browser". | | ||
| | Categories | number-indexed array of str | Categories in which the application should be shown in application launchers. For a list of valid values, see the [FreeDesktop Desktop Menu specification](https://www.freedesktop.org/wiki/Specifications/menu-spec/). | | ||
| | Keywords | number-indexed array of str | Keywords which, when combined with Name and GenericName, are useful for searching valid applications. | | ||
| | ShowIn | number-indexed array of str | A list of target software that the application specification should be listed in. Compliant target software SHOULD ignore the specification if this field is set and the target software is not listed here. | | ||
| | Extra | str-indexed array of str | An array containing extra fields not specified in this document. Software SHOULD ignore this field's values if it does not recognize them. | | ||
|
|
||
| ### `Icons` array | ||
|
|
||
| | Field | Type | Description | | ||
| |--------|-----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| | Format | str (e.g. `image/paint` or `image/nft`) | The MIME type of the format of the icon, as [assigned by the IANA](https://www.iana.org/assignments/media-types/media-types.xhtml) or CCSMB. Software SHOULD ignore icon arrays that have an unrecognized MIME type. Software MAY accept unassigned MIME types. | | ||
| | Width | number | The width of the icon, in pixels. | | ||
| | Height | number | The height of the icon, in pixels. | | ||
| | Path | str | The full path to the image file. | | ||
|
|
||
| ## Global variables | ||
|
|
||
| Compliant graphical OSes and desktop managers MUST set the `CCSMB_DESKTOP_CURRENT_DESKTOP` global variable, a string containing the name or path of the file executed that launched the OS or desktop manager. The variable MAY contain the command-line arguments that the graphical OS or desktop manager was started with, but this is optional and SHOULD NOT be expected by software. | ||
|
|
||
| Software MAY use this variable when determining what graphical OS or desktop manager is running. | ||
|
|
||
| Compliant graphical OSes and desktop managers SHOULD set this variable to `nil` when exiting. | ||
|
|
||
| ## Module | ||
|
|
||
| Compliant graphical OSes and desktop managers MAY define the `ccsmb_desktop` module. The module MAY be loaded through `require`; it MAY also be defined in the `ccsmb_desktop` global, but this is strongly discouraged. | ||
|
|
||
| The `ccsmb_desktop` module MUST contain the `ccsmb_desktop.run` function. The function MUST open a new window. The function MUST accept arguments in the same way that `shell.run` does: | ||
| > All arguments are concatenated together and then parsed as a command line. As a result, shell.run("program a b") is the same as shell.run("program", "a", "b"). | ||
| > — [CC: Tweaked documentation](https://tweaked.cc/module/shell.html#v:run) | ||
|
|
||
| The function MAY fail if the application fails to launch or continue running for any reason. | ||
|
|
||
| The `ccsmb_desktop` module MUST NOT contain any functions not specified above. | ||
|
|
||
| ## Settings | ||
|
|
||
| This section defines variables that SHOULD be defined through the `settings` API ("settings"). | ||
|
|
||
| ### `ccsmb.desktop.search_targets` | ||
|
|
||
| This setting MUST be an array of absolute directories. Each directory SHOULD contain valid application specifications. | ||
|
|
||
| Compliant software MUST search all directories (in the order listed). Compliant software MUST NOT assume the filenames in each directory are the same as the application names; however, software management tooling SHOULD install application specifications with a sensible filename. Application specifications SHOULD use the extension `.desktop`; `.lua` SHOULD also be allowed, but software management tooling SHOULD avoid installing specifications with this extension, to avoid confusion with actual programs. | ||
|
|
||
| If this setting is not set, compliant software MAY search in the following directories in the order listed: | ||
| 1. `/Application Specifications` | ||
| 2. `/AppSpecs` | ||
| 3. `/etc/ccsmb/applications` | ||
| 4. `/usr/share/ccsmb/applications` | ||
| 5. `/Applications` | ||
| 6. `/etc/applications` | ||
| 7. `/usr/share/applications` | ||
| 8. `/Library/Application Specifications` | ||
|
|
||
| If none of the directories listed above exist, compliant software MAY create a directory of its choice, provided it sets this setting and `ccsmb.desktop.install_target` (defined below). | ||
|
|
||
| If none of the directories listed aboove exist, application launchers MAY choose to abort launching themselves or to remain open and empty. | ||
|
|
||
| ### `ccsmb.desktop.install_target` | ||
|
|
||
| This setting MUST be a string containing a path to a directory. The directory MUST be created. Compliant software management tooling MUST install applications in this directory. | ||
|
|
||
| If the setting is not specified, software management tooling MUST search for all of the following directories and place specifications into them if the first match exists: | ||
| 1. `/Application Specifications` | ||
| 2. `/AppSpecs` | ||
| 3. `/etc/ccsmb/applications` | ||
| 4. `/usr/share/ccsmb/applications` | ||
| 5. `/Applications` | ||
| 6. `/etc/applications` | ||
| 7. `/usr/share/applications` | ||
| 8. `/Library/Application Specifications` | ||
|
|
||
| Software management tooling MAY create a directory of its choosing from the above list if none exist. If software management tooling chooses to do this, the `ccsmb.desktop.install_target` and `ccsmb.desktop.search_targets` settings MUST be set by the tooling. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| return { | ||
| Name = "pain"; | ||
| Type = "Application"; | ||
| Exec = "pain -n"; | ||
| Terminal = true; | ||
| CompliantWindowManagement = true; | ||
| GenericName = "Image Editor"; | ||
| Categories = { "Graphics", "RasterGraphics", "ImageProcessing" }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| return { | ||
| Name = "My Game With Noncompliant Windowing"; | ||
| Type = "Application"; | ||
| Icons = { | ||
| { Format = "image/paint"; Width = 16; Height = 16; Path = "/MyPartiallyCompliantOS/MyIcon16x16" }; | ||
| { Format = "image/paint"; Width = 32; Height = 32; Path = "/MyPartiallyCompliantOS/MyIcon32x32" }; | ||
| { Format = "image/paint"; Width = 60; Height = 32; Path = "/MyPartiallyCompliantOS/MyWordmark" }; | ||
| }; | ||
| Exec = "/MyPartiallyCompliantOS/myfungame"; | ||
| Terminal = false; | ||
| CompliantWindowManagement = false; | ||
| ShowIn = { "/MyPartiallyCompliantOS/start" }; | ||
| Categories = { "Game", "Amusement" }; | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you should mention that the path must start with a
/and must not end with a/, the same way as in ccsmb-10