Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DovieW opened this issue Oct 10, 2024 · 6 comments
Closed

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

DovieW opened this issue Oct 10, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@DovieW
Copy link
Contributor

DovieW commented Oct 10, 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

@DovieW DovieW added the bug Something isn't working label Oct 10, 2024
@LGUG2Z
Copy link
Owner

LGUG2Z commented Oct 10, 2024

komorebi/komorebic/src/main.rs

Lines 2000 to 2005 in 26a8912

let script = format!(
r#"
Start-Process '{ahk}' '{config}' -WindowStyle hidden
"#,
config = config_ahk.display()
);

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 LGUG2Z changed the title ahk fails if there's a space in the path [CLI] ahk fails if there's a space in the path Oct 11, 2024
@CtByte
Copy link
Contributor

CtByte commented Oct 11, 2024

@LGUG2Z would it work with double quotes?

@LGUG2Z
Copy link
Owner

LGUG2Z commented Oct 11, 2024

21a5be0

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 😅 )

@CtByte
Copy link
Contributor

CtByte commented 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.

@DovieW
Copy link
Contributor Author

DovieW commented 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.

@LGUG2Z
Copy link
Owner

LGUG2Z commented Oct 11, 2024

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

You can follow the build from source guide here ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants