Operating system specific versions of shell commands + shell selection #38
Replies: 1 comment
-
An ability to select a shellI have realised at some point that there needs to be a way to select in which shell a specific shell command will be run. For example, Windows has (at least) two shells: CMD.exe (the age-old legacy shell) and PowerShell/PowerShell Core, not even mentioning alternative shells. For Linux, the default shell is Bash. Mac uses Bash or Zsh by default. Global shell definitionsIn settings, there will be section for defining available shells. Each operating system will have a subsection, under which there will be a list of shells available for that particular OS, and a radio button for selecting the default shell for the OS. At the beginning, there will be no way to add other shells than the four ones mentioned above. A later update will add support for user defined shells. Command specific shell selectionReferring to the above Solution candidate B, each shell command will have fields for OS specific commands. For each OS specific command, there will also be a choice for which shell to execute this particular command in.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
I have an Obsidian vault for my school stuff, that I use on two machines: on a Windows desktop computer and on a Linux laptop. I use the Linux laptop when I'm on site at shool during lectures, and the Windows PC when on remote lectures or doing homework etc.
I use Git and a private GitHub repository to sync the vault on both machines. In addition to syncing notes, I also sync all settings (except latest workspace (I mean
.obsidian/workspace
file), because it changes all the time).Currently I have two shell commands in the vault, both tied to Windows:
The problem
When I use my vault on the Linux machine, I cannot use my shell commands to do Git stuff. I could add a third command which would open Linux terminal (and I certainly will), but that just adds one more command that works one one OS but not on the other.
One issue comes from hotkeys, too: Even if I just ignore the Windows specific commands, I have hotkeys assigned to them, and I cannot use those hotkeys for Linux specific commands, because Obsidian would not know which command to fire if two commands have the same hotkey.
One solution could also be not to include Shell commands settings in git. Pros and cons:
Solution candidate AEach command could have a quite simple option regarding operating system. For each command, a user could select one of the following options:All platforms. (Command can be executed on whatever OS. Default).WindowsMacintoshLinuxMacintosh and Linux (because they share partly similar commands, and similar file paths)For example, if a user is currently using Linux:All shell commands that are defined Windows only, are exluded from Obsidian's command palette. Their execution is also blocked via hotkeys, too. Instead, a user can define the same hotkey to a Linux shell command.The settings panel shows all shell commands regardless of the OS restriction definition. Obviously, a user must be able to manage all shell commands.This allows a user to customise all shell command properties separately in each OS: alias, whether to confirm before execution, and possible future settings.This is technically simple, and I guess it should be simple for the user.Solution candidate B
For each shell command, define OS specific command fields - plus the current "OS agnostic" command field.
echo
can be used in both Windows, Linux and Mac. But most often, the "OS agnostic" command could be shared by Linux and Mac, and Windows would have its own OS specific command.Beta Was this translation helpful? Give feedback.
All reactions