Skip to content

Instantly share code, notes, and snippets.

@dherman
Last active June 26, 2018 00:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dherman/87736c8d68cb60c17bc1ac439f6225e4 to your computer and use it in GitHub Desktop.
Save dherman/87736c8d68cb60c17bc1ac439f6225e4 to your computer and use it in GitHub Desktop.
Notion strategy for Windows

Goal: Per-User Installation Model

  • install Notion executables in user path
  • install Notion files in user profile
  • install Notion registry settings in HKCU

Goal: Per-Console Env Mutation

  • Notion command is a pair of .cmd and .ps1 wrapper scripts
    • cmd.exe sees the .cmd script
    • PowerShell sees the .ps1 script
  • Both .cmd and .ps1 scripts run in-process and can mutate console's environment
  • Exit script
    • Boot sequence creates temp path for a "exit script"
    • Boot sequence passes exit script's path to the Notion executable
    • Notion executable optionally puts source into the exit script
    • Wrapper script executes the script to perform environment mutations on behalf of Notion

Goal: Override System Node

  • Installation detects presence of System Node
  • If a System Node exists:
    • Add a Notion cmd.exe autorun script to HKCU\Software\Microsoft\Command Processor\AutoRun
      • Create the reg key if it doesn't exist
      • If it does exist, && it with the existing command
      • AutoRun script should ensure it's only run once per process with an up-front flag
      • Script prepends Notion path entries to front of %Path%
    • Add a Notion PowerShell profile that does similarly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment