[PR #1269] Use Windows API to spawn processes instead of powershell #1288

Open
opened 2026-01-05 14:54:46 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/LGUG2Z/komorebi/pull/1269
Author: @Dethada
Created: 2/9/2025
Status: 🔄 Open

Base: masterHead: pwsh-to-winapi


📝 Commits (10+)

  • 4007425 perf(komorebic): use std::process::Command to spawn process instead of powershell (bar)
  • 8273aff perf(komorebic): switch komorebi, ahk, masir to be spawned directly
  • 8bc0867 perf(komorebic): switch kill and stop cases to use winapi, except for ahk
  • 8a371fc perf(komorebic): change to winapi for terminating komorebi
  • da102ab fix(komorebic): use winapi for AHK termination
  • af2d04f refactor(komorebic): change error printing to stderr
  • 9e4448f refactor(komorebic): use constants for exe names
  • 58637c2 refactor(komorebic): change macro to function
  • 7ac816a perf(komorebic): only retrieve process related info with sysinfo instead of retrieving all
  • d57e5ec fix(bar): try to reconnect at an interval instead of crashing when unable to connect to komorebi

📊 Changes

4 files changed (+337 additions, -239 deletions)

View changed files

📝 Cargo.lock (+0 -7)
📝 komorebi-bar/src/main.rs (+18 -3)
📝 komorebic/Cargo.toml (+0 -1)
📝 komorebic/src/main.rs (+319 -228)

📄 Description

  • Switched to use win api for both process creation and termination for all cases except spawning of whkd, as it will spawn a visible console window if we use win api for its process creation. I suspect this can be solved on whkd side but I'll leave it as is for now
  • Addresses #1174 now that we don't have powershell adding trailing space to the commandline
  • Startup time has a very noticeable improvement, on my machine it dropped from about 2s to < 1s
  • Modified error printing to print to stderr

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/LGUG2Z/komorebi/pull/1269 **Author:** [@Dethada](https://github.com/Dethada) **Created:** 2/9/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `pwsh-to-winapi` --- ### 📝 Commits (10+) - [`4007425`](https://github.com/LGUG2Z/komorebi/commit/400742502913de147240cd2644fc9bb91348b6be) perf(komorebic): use std::process::Command to spawn process instead of powershell (bar) - [`8273aff`](https://github.com/LGUG2Z/komorebi/commit/8273aff67519e36a78427d4a4af6c8df89edac54) perf(komorebic): switch komorebi, ahk, masir to be spawned directly - [`8bc0867`](https://github.com/LGUG2Z/komorebi/commit/8bc08672090f55f71ff60579c98b6e19a91ce4bc) perf(komorebic): switch kill and stop cases to use winapi, except for ahk - [`8a371fc`](https://github.com/LGUG2Z/komorebi/commit/8a371fcf8cd4856a948d14265b105aa7549d9520) perf(komorebic): change to winapi for terminating komorebi - [`da102ab`](https://github.com/LGUG2Z/komorebi/commit/da102abcd0730f14dd62f268e2b72e3ef674b7ff) fix(komorebic): use winapi for AHK termination - [`af2d04f`](https://github.com/LGUG2Z/komorebi/commit/af2d04f94ea7ad5c633a8dc349bcaef6c66d1c1d) refactor(komorebic): change error printing to stderr - [`9e4448f`](https://github.com/LGUG2Z/komorebi/commit/9e4448f54ddf947a354a33f625e4612016c4563a) refactor(komorebic): use constants for exe names - [`58637c2`](https://github.com/LGUG2Z/komorebi/commit/58637c269ded50330cff97195c617e51afa236f3) refactor(komorebic): change macro to function - [`7ac816a`](https://github.com/LGUG2Z/komorebi/commit/7ac816afd307c5cfc848be4a79cf3f3049f0f65d) perf(komorebic): only retrieve process related info with sysinfo instead of retrieving all - [`d57e5ec`](https://github.com/LGUG2Z/komorebi/commit/d57e5ec71a1b737734ec5ddc6bf247de05231acf) fix(bar): try to reconnect at an interval instead of crashing when unable to connect to komorebi ### 📊 Changes **4 files changed** (+337 additions, -239 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+0 -7) 📝 `komorebi-bar/src/main.rs` (+18 -3) 📝 `komorebic/Cargo.toml` (+0 -1) 📝 `komorebic/src/main.rs` (+319 -228) </details> ### 📄 Description <!-- Please follow the Conventional Commits specification. If you need to update your PR with changes from `master`, please run `git rebase master`. By opening this PR, you confirm that you have read and understood this project's `CONTRIBUTING.md`. --> - Switched to use win api for both process creation and termination for all cases except spawning of `whkd`, as it will spawn a visible console window if we use win api for its process creation. I suspect this can be solved on `whkd` side but I'll leave it as is for now - Addresses #1174 now that we don't have powershell adding trailing space to the commandline - Startup time has a very noticeable improvement, on my machine it dropped from about 2s to < 1s - Modified error printing to print to stderr --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-01-05 14:54:46 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#1288