abenz1267 / walker

Application launcher similar to Rofi etc. . Wayland native.
MIT License
263 stars 12 forks source link

External module configuration #13

Closed BlitzBanana closed 5 months ago

BlitzBanana commented 5 months ago

Hey, thanks for this tool, this is great.

However, I'm encountering a config problem. If I understand correctly, in the README you state that we can define external modules in two ways :

That said, I have the following config, trying the first way :

"external": [
        {
            "name": "code",
            "prefix": ">",
            "src": "nu ~/.config/walker/ext_code.nu"
        }
]

and a script that returns a list of JSON entries :

#!/usr/bin/env nu
def main [] {
    ls `~/.config/Code - OSS/User/workspaceStorage/**/workspace.json`
    | each {|f| (
        open --raw $f.name
        | from json
        | update folder {|row| $row.folder | str replace 'file://' '' }
        | insert label {|row| $row.folder | path basename }
        | insert sub {|row| $row.folder }
        | insert exec {|row| 'code-oss ' + $row.folder }
        | insert terminal {|row| false }
        | insert icon {|row| 'com.visualstudio.code.oss' }
        | insert history {|row| true }
        | insert searchable {|row| $row.label | path basename }
    )}
    | to json
    | print
}
[
  {
    "folder": "/home/blitz/.config",
    "label": ".config",
    "sub": "/home/blitz/.config",
    "exec": "code-oss /home/blitz/.config",
    "terminal": false,
    "icon": "com.visualstudio.code.oss",
    "history": true,
    "searchable": ".config"
  }
]

But reading your source code, it seems that most of the Entry properties are ignored or overwritten by the external module. https://github.com/abenz1267/walker/blob/f8c4eeedd779f3551123bcbece97be5e42096b95/modules/external.go#L115-L119

So I have my list displaying (ignoring the custom sub), doing nothing on item selection (no cmd defined, exec ignored).

abenz1267 commented 5 months ago
[
  {
    "folder": "/home/blitz/.config",                                 // not  valid prop, ignored
    "label": ".config",
    "sub": "/home/blitz/.config",                                    // should work now
    "exec": "code-oss /home/blitz/.config",                 // should work now
    "terminal": false, // default, can remove
    "icon": "com.visualstudio.code.oss",
    "history": true,
    "searchable": ".config"
  }
]

Can you checkout the latest version and try again?

BlitzBanana commented 5 months ago

@abenz1267 it works as intended with the latest AUR version, thank you :+1: