fix(scoop): account for all shims on startup check

This commit fixes a bug with the startup check which tries to ensure
that there is only ever one instance of komorebi running at any given
time.

Previously, only one shim was being checked for, but if a user runs
'komorebic start' multiple times, multiple shims will be active, causing
the check to mistakenly pass.

The changes in this commit now account for N active shims.
This commit is contained in:
LGUG2Z
2022-07-19 09:54:15 -07:00
parent 04791f427b
commit d1b1a9e006
2 changed files with 5 additions and 5 deletions

View File

@@ -386,14 +386,14 @@ fn main() -> Result<()> {
let matched_procs: Vec<&Process> = system.processes_by_name("komorebi.exe").collect();
if matched_procs.len() > 1 {
let mut shim_is_active = false;
let mut len = matched_procs.len();
for proc in matched_procs {
if proc.root().ends_with("shims") {
shim_is_active = true;
len -= 1;
}
}
if !shim_is_active {
if len > 1 {
tracing::error!("komorebi.exe is already running, please exit the existing process before starting a new one");
std::process::exit(1);
}

View File

@@ -188,8 +188,8 @@ WorkspaceCustomLayout(monitor, workspace, path) {
Run, komorebic.exe workspace-custom-layout %monitor% %workspace% %path%, , Hide
}
WorkspaceLayoutRule(monitor, workspace, at_container_count, default_layout) {
Run, komorebic.exe workspace-layout-rule %monitor% %workspace% %at_container_count% %default_layout%, , Hide
WorkspaceLayoutRule(monitor, workspace, at_container_count, layout) {
Run, komorebic.exe workspace-layout-rule %monitor% %workspace% %at_container_count% %layout%, , Hide
}
WorkspaceCustomLayoutRule(monitor, workspace, at_container_count, path) {