LGUG2Z / komorebi

A tiling window manager for Windows 🍉
https://lgug2z.github.io/komorebi/
Other
9.59k stars 198 forks source link

Komorebi should open on startup #161

Closed johnnaaron closed 9 months ago

johnnaaron commented 2 years ago

Since Komorebic doesn't have an associated startup service and Komorebi.exe does not start Komorebic upon execution, there isn't a great way to enable dynamic tiling on startup like Yabai does (brew service).

Current solutions appear to involve running Powershell scripts (disabled by default) via a startup .cmd, or via task scheduler. My current setup doesn't actually start correctly through scripting though, but it does show Start-Process komorebi -WindowStyle hidden as expected.

~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\komorebic-start.cmd --> powerShell -windowstyle hidden "C:\Users\Aaron\komorebic-start.ps1"

C:\Users\Aaron\komorebic-start.ps1 --> komorebic start

What solution do you all use?

calendulish commented 2 years ago

I'm using a .bat script and nircmd, like that:

@echo off
title startup script
nircmd win hide title "startup script"
komorebic start

:: "komorebic start" currently is not waiting for everything be ready before return, so the
:: following lines prevent running commands bellow on startup before komorebi is ready to accept them
:wait_komorebi
komorebic state >nul 2>&1 || goto wait_komorebi

...
<your config, rules, etc>
e.g:
komorebic watch-configuration disable
komorebic invisible-borders 7 0 14 7
komorebic float-rule class WixStdBA
komorebic float-rule class MsiDialogCloseClass
...

:: optional, if you want to keep this script running for some reason
:: e.g.: I use this to auto restart my startup script if komorebi exit
nircmd waitprocess komorebi.exe

you can put it on startup folder or as a task on task scheduler

tsingakbar commented 2 years ago

I setup the autohotkey script following thre README, insert these code at the beginning to launch komorebi and wait it until ready. Then generate a symbolic link to this script, place it to windows's start folder. Hope this helps.

Process, Exist, komorebi.exe
If ErrorLevel = 0
    RunWait, komorebic.exe start, , Hide

Loop
{
    RunWait, komorebic.exe state, , Hide UseErrorLevel
    If ErrorLevel = 0
    {
        Break
    }
    Else
    {
        Sleep 1000
    }
}
rickywu commented 10 months ago

Autohotkey v2: RunWait('komorebic.exe start -c komorebi.json --whkd', , "Hide")