LGUG2Z / komorebi

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

[BUG]: `--ahk` flag in `komorebic stop --bar --ahk` doesn't stop the autohotkey #1103

Closed azinsharaf closed 3 weeks ago

azinsharaf commented 3 weeks ago

Summary

--ahk flag in komorebic stop --bar --ahk doesn't stop the autohotkey. it seems the process name is different on my machine.

❯ tasklist | grep Auto
AutoHotkeyUX.exe             20980 Console                    1     13,872 K
Stop-Process -Name:komorebi-bar -ErrorAction SilentlyContinue

if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue) {
    (Get-CimInstance Win32_Process | Where-Object {
        ($_.CommandLine -like '*komorebi.ahk"') -and
        ($_.Name -in @('AutoHotkey.exe', 'AutoHotkey64.exe', 'AutoHotkey32.exe'))
    } | Select-Object -First 1) | ForEach-Object {
        Stop-Process -Id $_.ProcessId -ErrorAction SilentlyContinue
    }
} else {
    (Get-WmiObject Win32_Process | Where-Object {
        ($_.CommandLine -like '*komorebi.ahk"') -and
        ($_.Name -in @('AutoHotkey.exe', 'AutoHotkey64.exe', 'AutoHotkey32.exe'))
    } | Select-Object -First 1) | ForEach-Object {
        Stop-Process -Id $_.ProcessId -ErrorAction SilentlyContinue
    }
}

Version Information

OS Name: Microsoft Windows 11 Pro OS Version: 10.0.26100 N/A Build 26100

komorebic 0.1.30 tag:v0.1.30 commit_hash:9a3dbccc build_time:2024-11-03 23:49:52 +00:00 build_env:rustc 1.82.0 (f6e511eec 2024-10-15),stable-x86_64-pc-windows-msvc

Komorebi Configuration

{
  "$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/master/schema.json",
  "app_specific_configuration_path": "$Env:USERPROFILE/.config/komorebi/applications.json",
  "window_hiding_behaviour": "Cloak",
  "cross_monitor_move_behaviour": "Insert",
  "default_workspace_padding": 10,
  "default_container_padding": 10,
  "mouse_follows_focus": false,
  "border": true,
  "border_implementation": "Komorebi",
  "border_width": 3,
  "border_offset": -1,
  "border_style": "Square",
  "border_colours": {
    "single": "#42a5f5",
    "stack": "#00a542",
    "monocle": "#ff3399",
    "unfocused": "#808080"
  },
  "stackbar": {
    "height": 40,
    "mode": "OnStack",
    "label": "Title",
    "tabs": {
      "width": 300,
      "focused_text": "#42a5f5",
      "unfocused_text": "#bd93f9",
      "background": "#141414",
      "font_family": "JetBrains Mono",
      "font_size": 20
    }
  },

  "transparency" : true,
  "transparency_alpha" : 250,
  "border_overflow_applications": [],
  "global_work_area_offset": {
    "top": 30,
    "bottom": 15,
    "left": 0,
    "right": 0
  },

  "object_name_change_applications": [
    {
      "kind": "Exe",
      "id": "RemoteDesktopManager.exe",
      "matching_strategy": "Equals"
    }
  ],
  "ignore_rules": [
    {
      "kind": "Exe",
      "id": "zebar.exe",
      "matching_strategy": "Equals"
    },
    {
      "kind": "Exe",
      "id": "python.exe",
      "matching_strategy": "Equals"
    },
    [
      {
        "kind": "Exe",
        "id": "olk.exe",
        "matching_strategy": "Equals"
      },
      {
        "kind": "Title",
        "id": "Reminders",
        "matching_strategy": "StartsWith"
      }
    ],
    {
        "kind": "Title",
        "id": "Arc extension popup",
        "matching_strategy": "Equals"
    },
    {
        "kind": "Title",
        "id": "ActiproWindowChromeShadow",
        "matching_strategy": "Equals"
    },
    {
      "kind": "Title",
      "id": "komorebi-gui",
      "matching_strategy": "Equals"
    },
    {
      "kind": "Title",
      "id": "Workspot",
      "matching_strategy": "Equals"
    }
  ],

  "manage_rules": [
    {
      "kind": "Exe",
      "id": "Survey123",
      "matching_strategy": "Contains"
    },
    [
    {
      "kind": "Title",
      "id": "[",
      "matching_strategy": "Contains"
    }
    ]
  ],
  "monitors": [
    {
      "window_based_work_area_offset_limit": 1,
      // "window_based_work_area_offset": {
      //   "left": 700,
      //   "top": 0,
      //   "right": 1400,
      //   "bottom": 10
      // },

      "workspaces": [
        {
          "name": "I chat",
          "layout": "UltrawideVerticalStack",
          "initial_workspace_rules": [
            {
              "kind": "Exe",
              "id": "ms-teams.exe"
            },
            {
              "kind": "Exe",
              "id": "olk.exe"
            },
            {
              "kind": "Exe",
              "id": "thunderbird.exe"
            }
          ]
        },
        {
          "name": "II seconed brain",
          "layout": "UltrawideVerticalStack",
          "initial_workspace_rules": [
            {
              "kind": "Exe",
              "id": "Morgen.exe"
            },
            {
              "kind": "Exe",
              "id": "Todoist.exe"
            },
            {
              "kind": "Exe",
              "id": "Obsidian.exe"
            }
          ] 
        },
        {
          "name": "III",
          "layout": "UltrawideVerticalStack",
          "initial_workspace_rules": [
            {
              "kind": "Exe",
              "id": "ArcGISPro.exe"
            },
            {
              "kind": "Exe",
              "id": "RemoteDesktopManager.exe"
            },
            {
              "kind": "Exe",
              "id": "WorkspotClient.exe"
            },
            {
              "kind": "Exe",
              "id": "Spotify.exe"
            }
          ]
        },
        {
          "name": "IV",
          "layout": "UltrawideVerticalStack",
          "initial_workspace_rules": [
          ]
        },
        {
          "name": "V",
          "layout": "UltrawideVerticalStack",
          "initial_workspace_rules": [
          ]
        }
      ]
    }
  ]
}

Hotkey Configuration

Requires AutoHotkey v2.0.2

SingleInstance Force

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

!+s::Komorebic("start --config '$Env:USERPROFILE.config\komorebi\komorebi.json' --ahk --bar")

!+e::{ Komorebic("stop") ExitApp }

!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")

; Cycle Workspaces !a::Komorebic("cycle-workspace previous") !s::Komorebic("focus-last-workspace") !d::Komorebic("cycle-workspace next")

; 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")

; 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")

Output of komorebic check

KOMOREBI_CONFIG_HOME detected: C:\Users\azin.config\komorebi

Looking for configuration files in C:\Users\azin.config\komorebi

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

No ~/.config/whkdrc found; you may not be able to control komorebi with your keyboard

LGUG2Z commented 3 weeks ago

AutoHotkeyUX.exe

How many different variants of the AHK executable are there? 😞