komorebi icon indicating copy to clipboard operation
komorebi copied to clipboard

[BUG]: Initial Workspace Rule Doesnt Apply Immediately

Open logicsec opened this issue 7 months ago • 2 comments

Summary

I have the following rule:

"initial_workspace_rules": [
  {
    "kind": "Exe",
    "id": "WindowsTerminal.exe"
  }
]

I am finding that when I open the app, I have to select another window, this minimizes the app, then when I re-open the app, the rule runs. Please see the video below:

https://github.com/user-attachments/assets/d1371ce2-ff6c-4543-850a-7f7d9bc0a750

Version Information

komorebic --version
komorebic 0.1.36
tag:v0.1.36
commit_hash:8ef1bcf2
build_time:2025-04-13 03:10:57 +00:00
build_env:rustc 1.86.0 (05f9846f8 2025-03-31),stable-x86_64-pc-windows-msvc

Komorebi Configuration

{
  "$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/v0.1.36/schema.json",
  "app_specific_configuration_path": "$Env:USERPROFILE/applications.json",
  "window_hiding_behaviour": "Cloak",
  "cross_monitor_move_behaviour": "Insert",
  "default_workspace_padding": 8,
  "default_container_padding": 8,
  "animation": {
    "style": "EaseInOutBack",
    "enabled": true,
    "fps": 60,
    "duration": 500
  },
  "border": false,
  "border_colours": {
    "monocle": "#ffffff",
    "stack": "#ffffff",
    "single": "#ffffff",
    "unfocused": "#ffffff"
  },
  "border_implementation": "Komorebi",
  "border_offset": -1,
  "border_style": "System",
  "border_width": 0,
  "theme": {
    "palette": "Base16",
    "name": "AyuMirage",
    "unfocused_border": "Base03",
    "bar_accent": "Base0D"
  },
  "mouse_follows_focus": true,
  "stackbar": {
    "tabs": {
      "font_family": "Segoe UI",
      "background": "#ffffff",
      "unfocused_text": "#ffffff",
      "font_size": 0,
      "width": 300,
      "focused_text": "#ffffff"
    },
    "label": "Process",
    "mode": "OnStack",
    "height": 40
  },
  "transparency": false,
  "transparency_alpha": 225,
  "display_index_preferences": {
    "0": "ACR0B79-4&34026bf3&0&UID8263",
    "1": "ACR0B79-4&34026bf3&0&UID12615",
    "2": "SAM7590-9&1a74fd61&0&UID256"
  },
  "manage_rules": [
    {
      "kind": "Path",
      "id": "C:\\Program Files\\WindowsApps\\Microsoft.WindowsTerminal_1.22.11141.0_x64__8wekyb3d8bbwe\\WindowsTerminal.exe",
      "matching_strategy": "Equals"
    }
  ],
  "monitors": [
    {
      "workspaces": [
        {
          "name": "1",
          "layout": "VerticalStack"
        },
        {
          "name": "2",
          "layout": "VerticalStack",
          "initial_workspace_rules": [
            {
              "kind": "Exe",
              "id": "WindowsTerminal.exe"
            }
          ]
        },
        {
          "name": "3",
          "layout": "VerticalStack"
        }
      ]
    },
    {
      "workspaces": [
        {
          "name": "4",  
          "layout": "VerticalStack"
        },
        {
          "name": "5",
          "layout": "VerticalStack"
        },
        {
          "name": "6",
          "layout": "VerticalStack"
        }
      ]
    },
    {
      "workspaces": [
        {
          "name": "7",
          "layout": "VerticalStack"
        },
        {
          "name": "8",
          "layout": "VerticalStack"
        },
        {
          "name": "9",
          "layout": "VerticalStack"
        }
      ]
    }
  ]
}

Hotkey Configuration

.shell powershell

# App shortcuts - these require shell to be pwsh / powershell
# The apps will be focused if open, or launched if not open
alt + 1 : $wshell = New-Object -ComObject wscript.shell; $proc = Get-Process | Where-Object { $_.ProcessName -like '*Zen*' }; if ($proc) { $wshell.AppActivate($proc.Id) } else { Start-Process 'shell:AppsFolder\\F0A0572A24289C2D' }
alt + 2 : $wshell = New-Object -ComObject wscript.shell; $proc = Get-Process | Where-Object { $_.ProcessName -like '*teams*' -and $_.MainWindowHandle -ne 0 } | Select-Object -First 1; if ($proc) { $wshell.AppActivate($proc.Id) } else { Start-Process 'shell:AppsFolder\\MSTeams_8wekyb3d8bbwe!MSTeams' }
alt + 3 : if ($wshell.AppActivate('Outlook') -eq $False) { start olk }
alt + return : start "C:\\Program Files\\WindowsApps\\Microsoft.WindowsTerminal_1.22.11141.0_x64__8wekyb3d8bbwe\\WindowsTerminal.exe";

# Reload whkd configuration
# alt + o                 : taskkill /f /im whkd.exe && start /b whkd # if shell is cmd
alt + o                 : taskkill /f /im whkd.exe; Start-Process whkd -WindowStyle hidden # if shell is pwsh / powershell
alt + shift + o         : komorebic stop && komorebic start --whkd

alt + q                 : komorebic close
alt + m                 : komorebic minimize

# Focus windows
alt + left              : komorebic focus left
alt + down              : komorebic focus down
alt + up                : komorebic focus up
alt + right             : komorebic focus right

# Move windows
alt + shift + left       : komorebic move left
alt + shift + down       : komorebic move down
alt + shift + up         : komorebic move up
alt + shift + right      : komorebic move right

# Manipulate windows
alt + t                 : komorebic toggle-float
alt + f                 : komorebic toggle-monocle

# Monitors
alt + shift + ctrl + left              : komorebic cycle-send-to-monitor previous
alt + shift + ctrl + right             : komorebic cycle-send-to-monitor next

# Workspaces
alt + ctrl + left      : komorebic cycle-workspace previous
alt + ctrl + right     : komorebic cycle-workspace next

Output of komorebic check

# komorebic check
No KOMOREBI_CONFIG_HOME detected, defaulting to C:\Users\nicholas.knight

Looking for configuration files in C:\Users\nicholas.knight

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

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

logicsec avatar May 09 '25 13:05 logicsec

what I would suggest right away is to always use the matching_strategy just like you do here

  "manage_rules": [
    {
      "kind": "Path",
      "id": "C:\\Program Files\\WindowsApps\\Microsoft.WindowsTerminal_1.22.11141.0_x64__8wekyb3d8bbwe\\WindowsTerminal.exe",
      "matching_strategy": "Equals"
    }
  ],

CtByte avatar May 09 '25 14:05 CtByte

i am also having this same issue.

        {
          "name": "1",
          "custom_layout": "./test1.json",
          "initial_workspace_rules": [
            {
              "id": "brave.exe",
              "kind": "Exe",
              "matching_strategy": "Equals"
            }
          ]
        },

rsa17826 avatar Aug 15 '25 13:08 rsa17826