Is there any way to run powershell (for Windows) / [ba]sh (for Linux) from Logseq?

I don’t know javascript/python to be able to use it as a way to do some useful stuff from CLI so I am wondering if something like custom.ps1 or custom.sh is possible or if there is any other way to be able to call some code from a macro or have it automatically run at logseq start?

Some practical examples:

  1. Every time Logseq starts I would like to remove all collapsed::true from all Pages and Journals;
  2. I want to create a symlink in /pages for today’s journal and insert it’s name in :default-home section of config.edn so that G H would work in Logseq;
  1. I want to be able to perform a Global Regex Search and Replace without resorting to VSCode;
  2. I want to replace :default-templates template with a template for each day of the week, Holyday, vacation, first day of Month, etc;
  1. I want to be able to “link” Scheduled/Deadline Tasks with the OS Notification System and also add Reminders in the OS, maybe even sync the Logseq Calendar with the OS Calendar;
    … etc.

I have encountered many more situations where I would have liked to be able to either have a CLI function run at Logseq start or be able to call such a function from a Macro.

I only wish that such a thing was available in Logseq so that it can be more tightly interconnected with the OS.

  • There is a way, which:
  • If you:
    • understand the risks
    • are willing to move step-by-step
  • then:
    • Ensure that:
      • the above kit works
      • can make actual changes to your file system
    • Describe here a very short first goal.

I see that the above kit requires a modification for preload.js, which will be overwritten at each Logseq update?

Yes, as modifying preload.js is not officially supported.