[CLI] ahk fails if there's a space in the path #486

Closed
opened 2026-01-05 14:51:02 +01:00 by adam · 6 comments
Owner

Originally created by @DovieW on GitHub (Oct 11, 2024).

Summary

I made the dumb mistake of putting a space in my username. When trying to use the --ahk option and the KOMOREBI_CONFIG_HOME is set somewhere in my user directory, I get a popup from AHK saying it can't find the file and the listed path is cut off at the space.

Version Information

0.1.29

Komorebi Configuration

{
    "$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/v0.1.29/schema.json",
    "app_specific_configuration_path": "C:/Users/Dovie Weinstock/repos/files/programs/komorebi/g14/applications.yaml",
    "window_hiding_behaviour": "Cloak",
    "focus_follows_mouse": "Windows",
    "cross_monitor_move_behaviour": "Insert",
    "default_workspace_padding": 5,
    "default_container_padding": 5,
    "mouse_follows_focus": true,
    "border": false,
    "border_width": 1,
    "border_offset": -1,
    "border_style": "System",
    "border_colours": {
      "single": "#42a5f5",
      "stack": "#00a542",
      "monocle": "#ff3399",
      "unfocused": "#808080"
    },
    "animation": {
      "enabled": false,
      "duration": 100,
      "style": "Linear",
      "fps": 60
    },
    "theme": {
      "palette": "Base16",
      "name": "Ashes",
      "unfocused_border": "Base03",
      "bar_accent": "Base0D"
    },
    "stackbar": {
      "height": 40,
      "mode": "OnStack",
      "tabs": {
        "width": 300,
        "focused_text": "#00a542",
        "unfocused_text": "#b3b3b3",
        "background": "#141414"
      }
    },
    "float_rules": [
      {
        "kind": "Title",
        "id": "Media Player",
        "matching_strategy": "Equals"
      }
    ],
    "manage_rules": [
      {
        "kind": "Title",
        "id": "Media Player",
        "matching_strategy": "Equals"
      }
    ],
    "tray_and_multi_window_applications": [
      {
        "kind": "Class",
        "id": "SDL_app",
        "matching_strategy": "Equals"
      }
    ],
    "monitors": [
      {
        "workspaces": [
          {
            "name": "I",
            "layout": "BSP"
          },
          {
            "name": "II",
            "layout": "VerticalStack"
          },
          {
            "name": "III",
            "layout": "HorizontalStack"
          },
          {
            "name": "IV",
            "layout": "UltrawideVerticalStack"
          },
          {
            "name": "V",
            "layout": "Rows"
          },
          {
            "name": "VI",
            "layout": "Grid"
          },
          {
            "name": "VII",
            "layout": "RightMainVerticalStack"
          }
        ]
      }
    ]
  }

Hotkey Configuration

#Requires AutoHotkey v2.0.2
#SingleInstance Force

Komorebic(cmd) {
RunWait(format("komorebic.exe {}", cmd), , "Hide")
}

!q::Komorebic("close")
!m::Komorebic("minimize")

; Focus windows
!h::Komorebic("focus left")
!j::Komorebic("focus down")
!k::Komorebic("focus up")
!l::Komorebic("focus right")

!+[::Komorebic("cycle-focus previous")
!+]::Komorebic("cycle-focus next")

; Move windows
!+h::Komorebic("move left")
!+j::Komorebic("move down")
!+k::Komorebic("move up")
!+l::Komorebic("move right")

; Stack windows
!Left::Komorebic("stack left")
!Down::Komorebic("stack down")
!Up::Komorebic("stack up")
!Right::Komorebic("stack right")
!;::Komorebic("unstack")
![::Komorebic("cycle-stack previous")
!]::Komorebic("cycle-stack next")

; Resize
!=::Komorebic("resize-axis horizontal increase")
!-::Komorebic("resize-axis horizontal decrease")
!+=::Komorebic("resize-axis vertical increase")
!+_::Komorebic("resize-axis vertical decrease")

; Manipulate windows
!t::Komorebic("toggle-float")
!f::Komorebic("toggle-monocle")

; Window manager options
!+r::Komorebic("retile")
!p::Komorebic("toggle-pause")

; Layouts
!x::Komorebic("flip-layout horizontal")
!y::Komorebic("flip-layout vertical")

; Workspaces
!1::Komorebic("focus-workspace 0")
!2::Komorebic("focus-workspace 1")
!3::Komorebic("focus-workspace 2")
!4::Komorebic("focus-workspace 3")
!5::Komorebic("focus-workspace 4")
!6::Komorebic("focus-workspace 5")
!7::Komorebic("focus-workspace 6")
!8::Komorebic("focus-workspace 7")

; Move windows across workspaces
!+1::Komorebic("move-to-workspace 0")
!+2::Komorebic("move-to-workspace 1")
!+3::Komorebic("move-to-workspace 2")
!+4::Komorebic("move-to-workspace 3")
!+5::Komorebic("move-to-workspace 4")
!+6::Komorebic("move-to-workspace 5")
!+7::Komorebic("move-to-workspace 6")
!+8::Komorebic("move-to-workspace 7")

Output of komorebic check

KOMOREBI_CONFIG_HOME detected: C:/tools/komorebi

Looking for configuration files in C:/tools/komorebi

Found komorebi.json; this file can be passed to the start command with the --config flag

Found C:\Users\Dovie Weinstock.config\whkdrc; key bindings will be loaded from here when whkd is started, and you can start it automatically using the --whkd flag

Originally created by @DovieW on GitHub (Oct 11, 2024). ### Summary I made the dumb mistake of putting a space in my username. When trying to use the `--ahk` option and the `KOMOREBI_CONFIG_HOME` is set somewhere in my user directory, I get a popup from AHK saying it can't find the file and the listed path is cut off at the space. ### Version Information 0.1.29 ### Komorebi Configuration ```json { "$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/v0.1.29/schema.json", "app_specific_configuration_path": "C:/Users/Dovie Weinstock/repos/files/programs/komorebi/g14/applications.yaml", "window_hiding_behaviour": "Cloak", "focus_follows_mouse": "Windows", "cross_monitor_move_behaviour": "Insert", "default_workspace_padding": 5, "default_container_padding": 5, "mouse_follows_focus": true, "border": false, "border_width": 1, "border_offset": -1, "border_style": "System", "border_colours": { "single": "#42a5f5", "stack": "#00a542", "monocle": "#ff3399", "unfocused": "#808080" }, "animation": { "enabled": false, "duration": 100, "style": "Linear", "fps": 60 }, "theme": { "palette": "Base16", "name": "Ashes", "unfocused_border": "Base03", "bar_accent": "Base0D" }, "stackbar": { "height": 40, "mode": "OnStack", "tabs": { "width": 300, "focused_text": "#00a542", "unfocused_text": "#b3b3b3", "background": "#141414" } }, "float_rules": [ { "kind": "Title", "id": "Media Player", "matching_strategy": "Equals" } ], "manage_rules": [ { "kind": "Title", "id": "Media Player", "matching_strategy": "Equals" } ], "tray_and_multi_window_applications": [ { "kind": "Class", "id": "SDL_app", "matching_strategy": "Equals" } ], "monitors": [ { "workspaces": [ { "name": "I", "layout": "BSP" }, { "name": "II", "layout": "VerticalStack" }, { "name": "III", "layout": "HorizontalStack" }, { "name": "IV", "layout": "UltrawideVerticalStack" }, { "name": "V", "layout": "Rows" }, { "name": "VI", "layout": "Grid" }, { "name": "VII", "layout": "RightMainVerticalStack" } ] } ] } ``` ### Hotkey Configuration #Requires AutoHotkey v2.0.2 #SingleInstance Force Komorebic(cmd) { RunWait(format("komorebic.exe {}", cmd), , "Hide") } !q::Komorebic("close") !m::Komorebic("minimize") ; Focus windows !h::Komorebic("focus left") !j::Komorebic("focus down") !k::Komorebic("focus up") !l::Komorebic("focus right") !+[::Komorebic("cycle-focus previous") !+]::Komorebic("cycle-focus next") ; Move windows !+h::Komorebic("move left") !+j::Komorebic("move down") !+k::Komorebic("move up") !+l::Komorebic("move right") ; Stack windows !Left::Komorebic("stack left") !Down::Komorebic("stack down") !Up::Komorebic("stack up") !Right::Komorebic("stack right") !;::Komorebic("unstack") ![::Komorebic("cycle-stack previous") !]::Komorebic("cycle-stack next") ; Resize !=::Komorebic("resize-axis horizontal increase") !-::Komorebic("resize-axis horizontal decrease") !+=::Komorebic("resize-axis vertical increase") !+_::Komorebic("resize-axis vertical decrease") ; Manipulate windows !t::Komorebic("toggle-float") !f::Komorebic("toggle-monocle") ; Window manager options !+r::Komorebic("retile") !p::Komorebic("toggle-pause") ; Layouts !x::Komorebic("flip-layout horizontal") !y::Komorebic("flip-layout vertical") ; Workspaces !1::Komorebic("focus-workspace 0") !2::Komorebic("focus-workspace 1") !3::Komorebic("focus-workspace 2") !4::Komorebic("focus-workspace 3") !5::Komorebic("focus-workspace 4") !6::Komorebic("focus-workspace 5") !7::Komorebic("focus-workspace 6") !8::Komorebic("focus-workspace 7") ; Move windows across workspaces !+1::Komorebic("move-to-workspace 0") !+2::Komorebic("move-to-workspace 1") !+3::Komorebic("move-to-workspace 2") !+4::Komorebic("move-to-workspace 3") !+5::Komorebic("move-to-workspace 4") !+6::Komorebic("move-to-workspace 5") !+7::Komorebic("move-to-workspace 6") !+8::Komorebic("move-to-workspace 7") ### Output of komorebic check KOMOREBI_CONFIG_HOME detected: C:/tools/komorebi Looking for configuration files in C:/tools/komorebi Found komorebi.json; this file can be passed to the start command with the --config flag Found C:\Users\Dovie Weinstock\.config\whkdrc; key bindings will be loaded from here when whkd is started, and you can start it automatically using the --whkd flag
adam added the bug label 2026-01-05 14:51:02 +01:00
adam closed this issue 2026-01-05 14:51:02 +01:00
Author
Owner

@LGUG2Z commented on GitHub (Oct 11, 2024):

26a8912fc3/komorebic/src/main.rs (L2000-L2005)

I would have thought that enclosing the config path argument with single quotes here would have handled spaces in paths. Open to ideas from people who know more about how PowerShell and AHK interact to make this more robust.

@LGUG2Z commented on GitHub (Oct 11, 2024): https://github.com/LGUG2Z/komorebi/blob/26a8912fc3d99ef39278a808dbc621515aee586c/komorebic/src/main.rs#L2000-L2005 I would have thought that enclosing the config path argument with single quotes here would have handled spaces in paths. Open to ideas from people who know more about how PowerShell and AHK interact to make this more robust.
Author
Owner

@CtByte commented on GitHub (Oct 11, 2024):

@LGUG2Z would it work with double quotes?

@CtByte commented on GitHub (Oct 11, 2024): @LGUG2Z would it work with [double quotes](https://learn.microsoft.com/en-us/answers/questions/803872/how-to-deal-with-space-in-the-path)?
Author
Owner

@LGUG2Z commented on GitHub (Oct 11, 2024):

21a5be0404

Apparently the single quotes were supposed to have fixed it but if someone can try this out with double quotes and see if it works we can make the change (I don't have spaces in my username 😅 )

@LGUG2Z commented on GitHub (Oct 11, 2024): https://github.com/LGUG2Z/komorebi/commit/21a5be040448548f1e641d5d6a9e9b080ec63504 Apparently the single quotes were supposed to have fixed it but if someone can try this out with double quotes and see if it works we can make the change (I don't have spaces in my username 😅 )
Author
Owner

@CtByte commented on GitHub (Oct 11, 2024):

I don't use AHK, but what if you just move the config to a folder with spaces in its name, then you can test without spaces in the username.

@CtByte commented on GitHub (Oct 11, 2024): I don't use AHK, but what if you just move the config to a folder with spaces in its name, then you can test without spaces in the username.
Author
Owner

@DovieW commented on GitHub (Oct 11, 2024):

I don't use AHK, but what if you just move the config to a folder with spaces in its name, then you can test without spaces in the username.

Yeah that triggers it too. I would test it but have never compiled a rust program and would need a second to look into it. Maybe someone can tell me what command to run to compile komorebic.

@DovieW commented on GitHub (Oct 11, 2024): > I don't use AHK, but what if you just move the config to a folder with spaces in its name, then you can test without spaces in the username. Yeah that triggers it too. I would test it but have never compiled a rust program and would need a second to look into it. Maybe someone can tell me what command to run to compile komorebic.
Author
Owner

@LGUG2Z commented on GitHub (Oct 11, 2024):

https://lgug2z.github.io/komorebi/installation.html#building-from-source

You can follow the build from source guide here ^

@LGUG2Z commented on GitHub (Oct 11, 2024): https://lgug2z.github.io/komorebi/installation.html#building-from-source You can follow the build from source guide here ^
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#486