Launch on startup #187

Closed
opened 2026-01-05 14:48:50 +01:00 by adam · 13 comments
Owner

Originally created by @gldtn on GitHub (Mar 29, 2023).

Can someone help/explain and maybe @LGUG2Z can add to the readme on how to launch komorebi at startup?

Yabai does it through brew services, does scoop have anything similar?

@LGUG2Z Thanks for creating this, been looking for something alike for years to run on my work computer 😄

Originally created by @gldtn on GitHub (Mar 29, 2023). Can someone help/explain and maybe @LGUG2Z can add to the readme on how to launch komorebi at startup? Yabai does it through brew services, does scoop have anything similar? @LGUG2Z Thanks for creating this, been looking for something alike for years to run on my work computer 😄
adam closed this issue 2026-01-05 14:48:50 +01:00
Author
Owner

@hanzsalat commented on GitHub (Apr 1, 2023):

My solution was to add an shortcut into my user startup folder which opens up PowerShell with the given start command

here is my code to generate the shortcut file with the start command and other parameters:

# create shortcuts in startup for komorebi and nircmd
# path to windows startup folder
    $startupPath = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup"

# scriptblock for creating a shortcut
    $createLink = {
        param($name,$sourceExe,$argumentsExe,$destination)
        $WshShell = New-Object -comObject WScript.Shell
        $shortcut = $WshShell.CreateShortcut("$destination\$name.lnk")
        $shortcut.TargetPath = $sourceExe
        $shortcut.Arguments = $argumentsExe
        $shortcut.Save()
    }

# init $list as arraylist
    $list = [System.Collections.ArrayList]::new()

# add nircmd to list
    [void]$list.Add(@{
        name = 'nircmd'
        sourceExe = (Get-Command nircmd).Path
        argumentsExe = 'win trans class Shell_TrayWnd 255'
        destination = $startupPath
    })

# add komorebi to list
    [void]$list.Add(@{
        name = 'komorebi'
        sourceExe = "powershell.exe"
        argumentsExe = '-WindowStyle hidden -Command komorebic start --await-configuration'
        destination = $startupPath
    })

# create shortcut for every item in $list
    foreach ($item in $list) {
        if (!(Test-Path -Path "$startupPath\$($item.name).lnk")) {
            & $createLink @item
        } else {
            $null = Remove-Item -Path "$startupPath\$($item.name).lnk"
            & $createLink @item
        }
    }

then use the .config folder to add your configuration to komorebi,
its explained in the README / Install manual how to do so

@hanzsalat commented on GitHub (Apr 1, 2023): My solution was to add an shortcut into my user startup folder which opens up PowerShell with the given start command here is my code to generate the shortcut file with the start command and other parameters: ``` # create shortcuts in startup for komorebi and nircmd # path to windows startup folder $startupPath = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup" # scriptblock for creating a shortcut $createLink = { param($name,$sourceExe,$argumentsExe,$destination) $WshShell = New-Object -comObject WScript.Shell $shortcut = $WshShell.CreateShortcut("$destination\$name.lnk") $shortcut.TargetPath = $sourceExe $shortcut.Arguments = $argumentsExe $shortcut.Save() } # init $list as arraylist $list = [System.Collections.ArrayList]::new() # add nircmd to list [void]$list.Add(@{ name = 'nircmd' sourceExe = (Get-Command nircmd).Path argumentsExe = 'win trans class Shell_TrayWnd 255' destination = $startupPath }) # add komorebi to list [void]$list.Add(@{ name = 'komorebi' sourceExe = "powershell.exe" argumentsExe = '-WindowStyle hidden -Command komorebic start --await-configuration' destination = $startupPath }) # create shortcut for every item in $list foreach ($item in $list) { if (!(Test-Path -Path "$startupPath\$($item.name).lnk")) { & $createLink @item } else { $null = Remove-Item -Path "$startupPath\$($item.name).lnk" & $createLink @item } } ``` then use the .config folder to add your configuration to komorebi, its explained in the README / Install manual how to do so
Author
Owner

@devkinetic commented on GitHub (Apr 10, 2023):

You can do the same thing in task scheduler
image

@devkinetic commented on GitHub (Apr 10, 2023): You can do the same thing in task scheduler ![image](https://user-images.githubusercontent.com/123363/230966119-b1dc826a-820b-47cf-b3e6-847b684505f8.png)
Author
Owner

@gldtn commented on GitHub (Apr 11, 2023):

Thanks for the reply guys.. got it to work 😁

@gldtn commented on GitHub (Apr 11, 2023): Thanks for the reply guys.. got it to work 😁
Author
Owner

@NormTurtle commented on GitHub (Apr 19, 2023):

any easy ? way
without tweaking system internal settings?

@NormTurtle commented on GitHub (Apr 19, 2023): any easy ? way without tweaking system internal settings?
Author
Owner

@devkinetic commented on GitHub (May 7, 2023):

@omaru-ok If you can't edit settings, for example from a limited account, your best bet would be to just make a desktop shortcut.

@devkinetic commented on GitHub (May 7, 2023): @omaru-ok If you can't edit settings, for example from a limited account, your best bet would be to just make a desktop shortcut.
Author
Owner

@NormTurtle commented on GitHub (May 7, 2023):

not that one @devkinetic i mean to say , can i put
*.ps1 in shell:startup

@NormTurtle commented on GitHub (May 7, 2023): not that one @devkinetic i mean to say , can i put `*.ps1` in `shell:startup`
Author
Owner

@azinsharaf commented on GitHub (May 9, 2023):

i put a startup.bat in shell:startup folder with the following context:
komorebic start --await-configuration
It works fine. I just can't run it completely silent yet.

@azinsharaf commented on GitHub (May 9, 2023): i put a `startup.bat` in `shell:startup` folder with the following context: `komorebic start --await-configuration` It works fine. I just can't run it completely silent yet.
Author
Owner

@marad commented on GitHub (May 13, 2023):

TBH I simply added this lines to beginning of my AutoHotkey configuration:

Stop()
Run, komorebic.exe start, , Hide

The Hide option makes it completely silent @azinsharaf.
The Stop() instruction handles AHK script reloads

And the shortcut to my AHK configuration I just put into shell:startup. Works like a charm.

Sidenote for anyone wondering what the heck does shell:startup means: If you press Windows+R then the Run window will popup. If you type in shell:startup and press enter it will open your autostart directory - any executable file placed there would run at Windows startup. Pic related:
image

Maybe some hints on how to run on startup could be placed in the readme or some docs to help others?

@marad commented on GitHub (May 13, 2023): TBH I simply added this lines to beginning of my AutoHotkey configuration: ``` Stop() Run, komorebic.exe start, , Hide ``` The `Hide` option makes it completely silent @azinsharaf. The `Stop()` instruction handles AHK script reloads And the shortcut to my AHK configuration I just put into `shell:startup`. Works like a charm. Sidenote for anyone wondering what the heck does `shell:startup` means: If you press `Windows+R` then the `Run` window will popup. If you type in `shell:startup` and press enter it will open your autostart directory - any executable file placed there would run at Windows startup. Pic related: ![image](https://github.com/LGUG2Z/komorebi/assets/1618489/7f5077e2-b072-4749-bae1-fc8c8daa3680) Maybe some hints on how to run on startup could be placed in the readme or some docs to help others?
Author
Owner

@azinsharaf commented on GitHub (May 17, 2023):

not sure why auto start is not working for me. If i double click on vbs file it works but it doesn't auto start (it is in shel:startup folder)

@azinsharaf commented on GitHub (May 17, 2023): > not sure why auto start is not working for me. If i double click on vbs file it works but it doesn't auto start (it is in shel:startup folder)
Author
Owner

@QuinnCiccoretti commented on GitHub (May 23, 2023):

TBH I simply added this lines to beginning of my AutoHotkey configuration:

@marad
Are you referring to the komorebi.ahk? Or a different autohotkey configuration? Thanks.

@QuinnCiccoretti commented on GitHub (May 23, 2023): > TBH I simply added this lines to beginning of my AutoHotkey configuration: @marad Are you referring to the komorebi.ahk? Or a different autohotkey configuration? Thanks.
Author
Owner

@marad commented on GitHub (Jul 13, 2023):

Yes I have this in my hotkey configuration script at the top.
If you add Ahk code BEFORE first hotkey definition it will run at startup.

@marad commented on GitHub (Jul 13, 2023): Yes I have this in my hotkey configuration script at the top. If you add Ahk code BEFORE first hotkey definition it will run at startup.
Author
Owner

@LGUG2Z commented on GitHub (Jul 15, 2023):

v0.1.17 has been released which includes static configuration loading.

I would be interested to see feedback from you all about the reliability of autostarting when using the komorebic start --config your-config.json --whkd command.

@LGUG2Z commented on GitHub (Jul 15, 2023): `v0.1.17` has been released which includes static configuration loading. I would be interested to see feedback from you all about the reliability of autostarting when using the `komorebic start --config your-config.json --whkd` command.
Author
Owner

@LGUG2Z commented on GitHub (Aug 9, 2023):

I have verified the following method as working on a W11 VM:

  • Win + R to bring up the Run menu, then shell:startup to bring up the Startup folder in Explorer
  • Right click in Explorer, File -> New -> Shortcut
  • Set the location to C:\Users\User\scoop\apps\komorebi\current\komorebic.exe start --config C:\Users\User\komorebi.json --whkd
  • Finish creating the shortcut
  • Restart
  • 🚀

I believe this is pretty much what @hanzsalat suggested in an earlier post.

I'll be closing this and related issues, and working towards commands that automate the creation of this shortcut file for autostarting komorebi on boot, based on espanso's approach (64886ff436), which also uses the Startup folder shortcut method.

@LGUG2Z commented on GitHub (Aug 9, 2023): I have verified the following method as working on a W11 VM: * Win + R to bring up the Run menu, then `shell:startup` to bring up the Startup folder in Explorer * Right click in Explorer, File -> New -> Shortcut * Set the location to `C:\Users\User\scoop\apps\komorebi\current\komorebic.exe start --config C:\Users\User\komorebi.json --whkd` * Finish creating the shortcut * Restart * 🚀 I believe this is pretty much what @hanzsalat suggested in an earlier post. I'll be closing this and related issues, and working towards commands that automate the creation of this shortcut file for autostarting komorebi on boot, based on espanso's approach (https://github.com/espanso/espanso/commit/64886ff436c9d0af4758a0cc6f04d991b8ad0134), which also uses the Startup folder shortcut method.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#187