62 pointsby philocalyst12 hours ago11 comments
  • badmonster20 minutes ago
    Would you consider adding support for domain-specific overrides (e.g., open *.notion.site links with Chrome but other URLs with Safari) in future versions?
  • goranmoomin5 hours ago
    This is a bit tangent, but does anyone know how to block an app from ever deciding to become a file handler on macOS?

    Every time I install Chrome on my machine (for testing purposes), macOS decides that Chrome is going to be the default file handler for a bunch of file associations, including HTML, WebP, and so on… and I have to figure out which was which for all of the mappings (which is super frustrating).

    I can read Info.plist from the bundle of the specific app (in this case, Google Chrome) that declares all of the UTIs, and then figure out which file associations that Chrome has messed up, but I don’t know how to get the default file associations (if it was not Chrome) before it.

    • AdieuToLogic2 hours ago
      > This is a bit tangent, but does anyone know how to block an app from ever deciding to become a file handler on macOS?

      The information below does not "block an app" from taking over file handler associations. It may be beneficial on its own and/or provide a starting point for further exploration.

      > Every time I install Chrome on my machine (for testing purposes), macOS decides that Chrome is going to be the default file handler for a bunch of file associations, including HTML, WebP, and so on… and I have to figure out which was which for all of the mappings (which is super frustrating).

      The following command can display current file extension associations for a user account:

        plutil -convert xml1 \
          ~/Library/Preferences/com.apple.LaunchServices.plist \
          -o -
      
      In the XML output of the above should be the associations. As for determining changes, if Time Machine has been enabled, then changes to this plist can be identified.

      Also regarding a Chrome OS-X/macOS installation - it installs plists for unconditional background updates. This may not be a desirable feature.

    • philocalyst4 hours ago
      MacOS doesn't give any way to block an association from happening, I'm assuming they're using the same API's under the hood that Duti is using, and the only way you could block that from being accessed is by disabling the Launch services API.

      In the next release of Infat, I'm introducing listing the openers from the plist (As you're doing now). If you record these values, then get their set defaults through infat, you could put those into your config and load from you config whenever they're overriden!

      Best I got... Shameless promotion

  • mlenz12 hours ago
    Great to see this, thanks for sharing! Do you have plans to make it available in nixpkgs and potentially as a home-manager or nix-darwin module? Then I could add it to my config and have everything set up automatically.
    • philocalyst11 hours ago
      I don't use nixpkgs personally but would love to give it a shot, check the repo in a day or two to give me some time to learn to ropes! I'll shoot you an email if I need any help :)
  • hk13376 hours ago
    Is there a way to pass arguments or some other options? For example, TextEdit can be opened in plain text or rich text mode.
    • philocalyst5 hours ago
      There is not, infat is subject to the limitations of Apple's API for setting handlers, which do not support passing in any data that an application could work with. If you wanted to, and have the time, I would recommend setting up a wrapper with https://github.com/sveinbjornt/Platypus with applescript. Then you could make an alternate for whichever mode you please and set it as an opener using infat. Clunky but functional.
  • dmwood10 hours ago
    Shell dependencies for install? Got: bash-3.2# just package && mv dist/infat* /usr/local/bin/infat # Wildcard because output name includes platform bash: just: command not found
    • philocalyst10 hours ago
      No dependencies for install, just is the command runner I use to keep things organized, it's a replacement for make(1). If it hurts to download just, you can build using SPM:

      swift build -c release

      mv .build/PLATFORM/release/infat /usr/local/bin

    • alkh10 hours ago
      just is a great command runner[1], not a shell script. Looks like it is needed if you build from source or install from Github releases. Alternatively, use `brew install philocalyst/tap/infat`(haven't done it myself but I bet it has just as a dependency anyway) [1] https://github.com/casey/just
  • stinger11 hours ago
    Running into this error - "Error: Failed to set default application: The file couldn’t be opened." This seems to be happening for extensions that I haven't opened yet (md, json, mailto, etc.) For a new laptop, this might not be available yet. Once I `touch` a file with those extensions, the config works!. FYI, I am using a config.toml file btw.
    • philocalyst11 hours ago
      Okay, confusing -- just tried to replicate on my machine and couldn't get that error. When you say touch, you mean creating a file with that extension, or any interaction period?

      Could you please try to replicate with verbosity enabled (-v) and email me the output or file an issue at the repo with the results and full summary? It's helpful for tracking. Sorry this isn't a quick fix :(

  • alkh10 hours ago
    That's great, I've struggled with this problem a lot. To double-check, this essentially allows you to specify a default app that is being opened when you click on a file via Finder or via terminal's `open` program, correct? I haven't seen this exact clarification in README
  • timenova9 hours ago
    This is amazing! I set a few extensions manually.

    However, does anyone know a way to set all text-like documents to open with a single editor (for example Zed) on Mac? Even text files without any extensions?

    • philocalyst9 hours ago
      It wouldn't be possible with the current interface, but I have a feeling it's possible. I'm thinking it's part of a new configuration option "type" that allows you to define openers for categories of files (text,video,etc.)

      I can get it out in a week ;)

      • timenova7 hours ago
        That would be amazing honestly!
  • deeThrow9412 hours ago
    Oh this is very exciting! I do have a request, though—I want to list all file extensions an application can open, specifically so I can use this to ensure xcode isn't the default for anything but xcode-specific files.
    • philocalyst11 hours ago
      Have an idea of how I would do this already, give me until the end of the week. To be clear, an interface like this?

      Infat list [--identifier] [--application] Where identifier and application are mutually exclusive, and application lists the openers it is capable of opening by default? Merging the application flag for simplicities sake, so either returns a list with both their possibilities *and* the assigned apps.

      Thoughts?

      • deeThrow9411 hours ago
        Love it! Seems like it'd be easy to filter out extensions I wanna keep and switch them all to emacs or whatever.
  • gitroom12 hours ago
    Pretty slick honestly, swapping machines on Mac is usually a pain for me so this feels like a lifesaver.
  • sangpugogogo11 hours ago
    [dead]