Tutorial: Application.setJumpList

Application.setJumpList

Sets or removes a custom JumpList for the application. Only applicable in Windows OS.

If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).

The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's shortcut.name and uses shortcut.company as a fallback. Clicking that item will launch the app from its current manifest.

Note: If the "name" property is omitted it defaults to "tasks".

Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the uuid or shortcut.name is changed.

Example

    const app = fin.Application.getCurrentSync();
    const appName = 'My App'; 
    const jumpListConfig = [ // array of JumpList categories
        {   
            // has no name and no type so `type` is assumed to be "tasks"
            items: [ // array of JumpList items
            {
                type: 'task',
                title: `Launch ${appName}`,
                description: `Runs ${appName} with the default configuration`,
                deepLink: 'fins://path.to/app/manifest.json',
                iconPath: 'https://path.to/app/icon.ico',
                iconIndex: 0
            },
            { type: 'separator' },
            {
                type: 'task',
                title: `Restore ${appName}`,
                description: 'Restore to last configuration',
                deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
                iconPath: 'https://path.to/app/icon.ico',
                iconIndex: 0
            },
            ]
        },
        {
            name: 'Tools',
            items: [ // array of JumpList items
            {
                type: 'task',
                title: 'Tool A',
                description: 'Runs Tool A',
                deepLink: 'fins://path.to/tool-a/manifest.json',
                iconPath: 'https://path.to/tool-a/icon.ico',
                iconIndex: 0
            },
            {
                type: 'task',
                title: 'Tool B',
                description: 'Runs Tool B',
                deepLink: 'fins://path.to/tool-b/manifest.json',
                iconPath: 'https://path.to/tool-b/icon.ico',
                iconIndex: 0
            }]
        }
    ];

    app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));

To handle deeplink args:

    function handleUseLastConfiguration() {
        // this handler is called when the app is being launched
        app.on('run-requested', event => {
            if(event.userAppConfigArgs['use-last-configuration']) {
                // your logic here
            }
        });
        // this handler is called when the app was already running when the launch was requested
        fin.desktop.main(function(args) { 
            if(args && args['use-last-configuration']) {
                // your logic here
            }
        });
    }