LGUG2Z / komorebi

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

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

Open DovieW opened 12 hours ago

DovieW commented 12 hours ago

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

LGUG2Z commented 12 hours ago

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.