Skip to content
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

Add ability to use custom icons for shortcuts. #1378

Closed
tech4him1 opened this issue Mar 17, 2017 · 4 comments
Closed

Add ability to use custom icons for shortcuts. #1378

tech4him1 opened this issue Mar 17, 2017 · 4 comments

Comments

@tech4him1
Copy link

This is necessary if the shortcut points to a script instead of a executable. It should be fairly simple, just adding an IconLocation to the $wsShell object before you save it.

Example:

function startmenu_shortcut($target, $shortcutName, $icon) {
    ...
    $wsShell.TargetPath = "$target"
    $wsShell.IconLocation = "$icon"
    $wsShell.Save()
}
@tech4him1
Copy link
Author

I found a workaround. You can simply create a link in your project, then, add a shortcut to the shortcut.

...
    "shortcuts": [
        [
            "program.lnk",
            "Program"
        ]
    ]
...

@lukesampson
Copy link
Member

Nice one!

@gitolicious
Copy link
Contributor

It is rather cumbersome, but it works...

    "shortcuts": [
        [
            "idea.lnk",
            "IntelliJ IDEA Ultimate"
        ]
    ],
    "pre_install": "
        $wsShell = New-Object -ComObject WScript.Shell
        $wsShell = $wsShell.CreateShortcut(\"$dir\\idea.lnk\")
        $wsShell.TargetPath = \"$dir\\bin\\idea.bat\"
        $wsShell.IconLocation  = \"$dir\\bin\\idea.exe\"
        $wsShell.Save()
    ",

Hint: You need to use pre_install here because scoop tries to create the start menu shortcut before the post_install step runs, which would fail.

r15ch13 added a commit that referenced this issue Jan 8, 2018
* Solves #1319, #1320, #1378, #1757, #1846, #1867
* Add WorkingDirectory
* Add Icon
* Add Arguments
* Use FileInfo and DirectoryInfo
@r15ch13
Copy link
Member

r15ch13 commented Jan 8, 2018

Added with 83b8238

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

No branches or pull requests

4 participants