LGUG2Z / komorebi

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

[BUG]: enable-autostart runs with CMD not Powershell #881

Open gzachariadis opened 3 months ago

gzachariadis commented 3 months ago

Describe the bug

I followed the video guide from Youtube and copied the commands from Common Workflows - KOMOREBI_CONFIG_HOME trying to switch my config folder from the C:\Users\Username (home folder) to C:\Users\Username\.config\komorebi at minute 4:20 in the video, a change to the app_specific_configuration_path is displayed from $Env:USERPROFILE/applications.yaml to $Env:KOMOREBI_CONFIG_HOME.

That seems to work when running manually the instance from Powershell, but the enable-autostart command had problems with my configuration. After playing around with it for a bit, I managed to fix the .ink shortcut, but switching back to the $Env:USERPROFILE/applications.yaml inside my komorebi.json.

The execution of this command is now C:\Users\Username\scoop\apps\komorebi\current\komorebic-no-console.exe start --config C:\Users\Username\.config\komorebi\komorebi.json --ahk this seems to work for me.

In case anyone else has a problem with the autostart, try running the command inside the .ink using Command Prompt, if it runs, that means next time you login, chances are it will work. Tinker with your configuration if it doesn't.

On the same point, running Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser or setting it to something like Set-ExecutionPolicy -ExecutionPolicy Restricted -Scope LocalMachine had no difference to me, both run the `.ink shortcut perfectly, on my computer startup.

To Reproduce Steps to reproduce the behavior:

  1. Setting "app_specific_configuration_path" to $Env:KOMOREBI_CONFIG_HOME instead of $Env:USERPROFILE/applications.yaml.
  2. Execute using Command Prompt, the following command C:\Users\Username\scoop\apps\komorebi\current\komorebic-no-console.exe start --config C:\Users\Username\.config\komorebi\komorebi.json --ahk.
  3. Won't launch...

Expected behavior

I was not sure how to set the KOMOREBI_CONFIG_HOME Environment variable for Command Prompt, aka the whole Computer, by using the GUI for Environment Variables through Windows, so I am guessing that was my fault.

In case someone can provide another way to set an Environment Variable both for Powershell and Command Prompt, without using the $PROFILE that would be ideal.

Operating System

OS Name: Microsoft Windows 10 Pro N

SVendittelli commented 1 week ago

Hey @gzachariadis, maybe this will help you. You can set the KOMOREBI_CONFIG_HOME environment variable for your user in a number of ways.

Firstly, run the following from a PowerShell terminal:

[System.Environment]::SetEnvironmentVariable('KOMOREBI_CONFIG_HOME',"$Env:USERPROFILE\.config\komorebi", 'User')

Note: that this will store the expanded form of your user home folder in the variable. This is required because windows (at least on cmd) evaluates environment variables in alphabetical (lexicographical) order. This means that a value like %USERPROFILE%/.config/komorebi won't expand correctly because KOMOREBI_CONFIG_HOME comes before USERPROFILE alphabetically.

Secondly, as you mentioned, from the windows GUI. This is not the best solution, as it cannot be scripted easily. Here is an article on how to do it.

Finally, you can use a third party program like Rapid Environment Editor for a different GUI.

Don't forget to restart any terminals after applying those changes.

After doing any of those, you shouldn't need to add the --config flag to the .lnk in the start folder. I also believe that setting "app_specific_configuration_path": "$Env:KOMOREBI_CONFIG_HOME/applications.yaml" in your komorebi.json should also work after doing this.