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

[BUG]: Minimizing out of focus application leaves ghost tile #1231

Closed
tobiasbeiser opened this issue Jan 17, 2025 · 10 comments
Closed

[BUG]: Minimizing out of focus application leaves ghost tile #1231

tobiasbeiser opened this issue Jan 17, 2025 · 10 comments
Labels
bug Something isn't working

Comments

@tobiasbeiser
Copy link

Summary

When minimizing a window/application that is not in focus, a ghost tile is left behind. I have tested this with various applications, such as Powershell, Explorer, VSCode, Settings, etc.
When closing these applications, instead of minimizing, while out of focus, komorebi behaves as expected.

komorebi_minimize_unfocused_application_compressed.mp4

Version Information

systeminfo | findstr /B /C:"OS Name" /B /C:"OS Version"
OS Name: Microsoft Windows 11 Pro
OS Version: 10.0.22631 N/A Build 22631

komorebic --version
komorebic 0.1.33
tag:v0.1.33
commit_hash:cc51f62c
build_time:2025-01-11 22:30:30 +00:00
build_env:rustc 1.84.0 (9fc6b4312 2025-01-07),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",
  "alt_focus_hack": false,
  "animation": {
    "enabled": true,
    "style": "EaseInOutElastic",
    "duration": 150
  },
  "default_workspace_padding": 5,
  "default_container_padding": 5,
  "border": false,
  "border_colours": {
    "single": {
      "r": 66,
      "g": 165,
      "b": 245
    },
    "stack": {
      "r": 256,
      "g": 165,
      "b": 66
    },
    "monocle": {
      "r": 255,
      "g": 51,
      "b": 153
    }
  },
  "border_width": 0,
  "border_offset ": 0,
  "monitors": [
    {
      "workspaces": [
        {
          "name": "I",
          "layout": "BSP"
        },
        {
          "name": "II",
          "layout": "BSP"
        },
        {
          "name": "III",
          "layout": "BSP"
        },
        {
          "name": "IV",
          "layout": "BSP"
        },
        {
          "name": "V",
          "layout": "BSP"
        }
      ]
    },
    {
      "workspaces": [
        {
          "name": "I",
          "layout": "BSP"
        },
        {
          "name": "II",
          "layout": "BSP"
        },
        {
          "name": "III",
          "layout": "BSP"
        },
        {
          "name": "IV",
          "layout": "BSP"
        },
        {
          "name": "V",
          "layout": "BSP"
        }
      ]
    }
  ],
  "transparency": true,
  "transparency_alpha": 250,
  "ignore_rules": [
    {
      "kind": "Title",
      "id": "WindowsFormsParkingWindow",
      "matching_strategy": "Equals"
    },
    {
      "kind": "Exe",
      "id": "ServiceHub.ThreadedWaitDialog.exe",
      "matching_strategy": "Equals"
    }

  ]
}

Hotkey Configuration

#Requires AutoHotkey v2.0.2
#SingleInstance Force

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

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

; Applications
#t::RunWait("C:\Users\Tobias\AppData\Local\Microsoft\WindowsApps\Microsoft.PowerShell_8wekyb3d8bbwe\pwsh.exe","C:\Users\Tobias" , )
#f::RunWait("firefox.exe","C:\Program Files\Mozilla Firefox" , )
#c::RunWait("code","C:\Users\Tobias" , "Hide" )

; Focus windows
#Left::Komorebic("focus left")
#Down::Komorebic("focus down")
#Up::Komorebic("focus up")
#Right::Komorebic("focus right")

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

; Move windows
#+^Left::Komorebic("move left")
#+^Down::Komorebic("move down")
#+^Up::Komorebic("move up")
#+^Right::Komorebic("move right")

; Stack windowsf
; #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
#+Right::Komorebic("resize-axis horizontal increase")
#+Left::Komorebic("resize-axis horizontal decrease")
#+Up::Komorebic("resize-axis vertical increase")
#+Down::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:\Users\Tobias.config\komorebi

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

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

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

@tobiasbeiser tobiasbeiser added the bug Something isn't working label Jan 17, 2025
@tobiasbeiser
Copy link
Author

Upon further investigation, it seems that this bug was introduced with version 0.1.31 as it seems to work as expected in version 0.1.30

@LGUG2Z
Copy link
Owner

LGUG2Z commented Jan 17, 2025

I can't reproduce this on the master branch with my configuration:

{
  "$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/master/schema.json",
  "app_specific_configuration_path": "$Env:KOMOREBI_CONFIG_HOME/applications.json",
  "window_hiding_behaviour": "Cloak",
  "cross_monitor_move_behaviour": "Insert",
  "cross_boundary_behaviour": "Monitor",
  "default_workspace_padding": 14,
  "default_container_padding": 14,
  "resize_delta": 200,
  "stackbar": {
    "height": 40,
    "mode": "Never",
    "label": "Title",
    "tabs": {
      "width": 300,
      "font_family": "JetBrains Mono",
      "font_size": 34
    }
  },
  "animation": {
    "enabled": true,
    "duration": 250,
    "fps": 120,
    "style": {
      "movement": "EaseOutBack",
      "transparency": "Linear"
    }
  },
  "border": true,
  "border_implementation": "Komorebi",
  "border_width": 10,
  "border_offset": -1,
  "border_style": "System",
  "theme": {
    "palette": "Base16",
    "name": "Ashes",
    "unfocused_border": "Base03",
    "bar_accent": "Base0D"
  },
  "transparency": false,
  "transparency_alpha": 240,
  "transparency_ignore_rules": [
    {
      "kind": "Title",
      "id": "YouTube",
      "matching_strategy": "Contains"
    }
  ],
  "display_index_preferences": {
    "0": "DEL4310-5&1a6c0954&0&UID209155",
    "1": "HJW1836-5&1a6c0954&0&UID209152"
  },
  // "remove_titlebar_applications": [
  //   {
  //     "kind": "Exe",
  //     "id": "zed.exe",
  //     "matching_strategy": "Equals"
  //   }
  // ],
  "ignore_rules": [
    {
      "kind": "Exe",
      "id": "shadPS4.exe",
      "matching_strategy": "Equals"
    },
    {
      "kind": "Title",
      "id": "Media Player",
      "matching_strategy": "Equals"
    },
    [
      {
        "kind": "Exe",
        "id": "UnrealEditor.exe",
        "matching_strategy": "Equals"
      },
      {
        "kind": "Title",
        "id": "SplashScreenGuard",
        "matching_strategy": "Equals"
      }
    ],
    [
      {
        "kind": "Exe",
        "id": "balabolka.exe",
        "matching_strategy": "Equals"
      },
      {
        "kind": "Class",
        "id": "TBalabolkaForm",
        "matching_strategy": "DoesNotEqual"
      }
    ]
  ],
  "floating_applications": [
    {
      "kind": "Exe",
      "id": "explorer.exe",
      "matching_strategy": "Equals"
    },
    [
      {
        "kind": "Exe",
        "id": "UnrealEditor.exe",
        "matching_strategy": "Equals"
      },
      {
        "kind": "Title",
        "id": "Open Asset",
        "matching_strategy": "Equals"
      }
    ],
    {
      "kind": "Exe",
      "id": "amaran Desktop.exe",
      "matching_strategy": "Equals"
    }
  ],
  "slow_application_identifiers": [
    {
      "kind": "Exe",
      "id": "zen.exe",
      "matching_strategy": "Equals"
    },
    {
      "kind": "Exe",
      "id": "UnrealEditor.exe",
      "matching_strategy": "Equals"
    }
  ],
  "manage_rules": [
    {
      "kind": "Exe",
      "id": "foobar2000.exe",
      "matching_strategy": "Equals"
    }
  ],
  "bar_configurations": [
    "$Env:KOMOREBI_CONFIG_HOME/komorebi.bar.json"
    // "$Env:USERPROFILE/with spaces/komorebi.bar.json"
    // "$Env:KOMOREBI_CONFIG_HOME/komorebi.bar.2.json"
  ],
  "monitors": [
    {
      "window_based_work_area_offset_limit": 1,
      "window_based_work_area_offset": {
        "left": 750,
        "top": 0,
        "right": 1500,
        "bottom": 0
      },
      "workspaces": [
        {
          "name": "personal",
          "layout": "UltrawideVerticalStack"
        },
        {
          "name": "chat",
          "layout": "Columns",
          "initial_workspace_rules": [
            {
              "kind": "Exe",
              "id": "Beeper.exe",
              "matching_strategy": "Equals"
            },
            {
              "kind": "Exe",
              "id": "Discord.exe",
              "matching_strategy": "Equals"
            }
          ]
        },
        {
          "name": "editing",
          "layout": "UltrawideVerticalStack",
          "apply_window_based_work_area_offset": false
        }
      ]
    },
    {
      "workspaces": [
        {
          "name": "obs",
          "layout": "BSP"
        }
      ]
    }
  ]
}

@LGUG2Z
Copy link
Owner

LGUG2Z commented Jan 17, 2025

These sorts of non-reproducible bugs are a bit tricky. I think the next step should be for users to try and reproduce bugs that I am not able to reproduce in a Hyper-V VM with the example komorebi quickstart configuration file. (I'll update the bug report template soon to mention this soon)

@LGUG2Z
Copy link
Owner

LGUG2Z commented Jan 17, 2025

Upon further investigation, it seems that this bug was introduced with version 0.1.31 as it seems to work as expected in version 0.1.30

Also it would be a big help if you could bisect the commits between the two releases to find the commit which introduced this change in behavior for you

@tobiasbeiser
Copy link
Author

the bug does not occur with your provided configuration. I have narrowed it down to the transparency flag. When setting the value to true the bug can be reproduced

@tobiasbeiser
Copy link
Author

i checked the commits and it seems like the bug was introduced with this one: 449ccac

@LGUG2Z
Copy link
Owner

LGUG2Z commented Jan 17, 2025

Next question: If transparency is enabled but animations are disabled, do you still have the same behavior?

@tobiasbeiser
Copy link
Author

I tested all possible combinations on the latest master commit:

transparency animations correct behaviour Notes
true true N
true false Y Error when restoring
false true Y Error when restoring
false false Y Error when restoring

When restoring the minimized application this error was displayed in the log:

2025-01-17T21:09:05.021108Z  INFO process_event{event="FocusChange" winevent="SystemForeground" hwnd=1904448}:update_focused_workspace{follow_focus=true trigger_focus=false}: komorebi::window_manager: updating
2025-01-17T21:09:05.022854Z  INFO process_event{event="FocusChange" winevent="SystemForeground" hwnd=1904448}:focus_window{idx=0}: komorebi::container: focusing window
2025-01-17T21:09:05.023607Z  INFO process_event{event="FocusChange" winevent="SystemForeground" hwnd=1904448}:focus_container{idx=1}: komorebi::workspace: focusing container
2025-01-17T21:09:05.025814Z  INFO process_event{event="FocusChange" winevent="SystemForeground" hwnd=1904448}: komorebi::process_event: processed: (hwnd: 1904448, title: komorebi.json - .config - Visual Studio Code, exe: Code.exe, class: Chrome_WidgetWin_1)
2025-01-17T21:09:05.170698Z  INFO process_event{event="Minimize" winevent="SystemMinimizeStart" hwnd=1904448}:focus_window{idx=0}: komorebi::container: focusing window
2025-01-17T21:09:05.170977Z  INFO process_event{event="Minimize" winevent="SystemMinimizeStart" hwnd=1904448}:focus_container{idx=0}: komorebi::workspace: focusing container
2025-01-17T21:09:05.171227Z  INFO process_event{event="Minimize" winevent="SystemMinimizeStart" hwnd=1904448}:update_focused_workspace{follow_focus=false trigger_focus=false}: komorebi::window_manager: updating
2025-01-17T21:09:05.204662Z  INFO process_event{event="Minimize" winevent="SystemMinimizeStart" hwnd=1904448}: komorebi::process_event: processed: (hwnd: 1904448, title: komorebi.json - .config - Visual Studio Code, exe: Code.exe, class: Chrome_WidgetWin_1)
2025-01-17T21:09:05.209085Z  INFO process_event{event="FocusChange" winevent="SystemForeground" hwnd=396118}:update_focused_workspace{follow_focus=true trigger_focus=false}: komorebi::window_manager: updating
2025-01-17T21:09:05.210202Z  INFO process_event{event="FocusChange" winevent="SystemForeground" hwnd=396118}:focus_window{idx=0}: komorebi::container: focusing window
2025-01-17T21:09:05.210413Z  INFO process_event{event="FocusChange" winevent="SystemForeground" hwnd=396118}:focus_container{idx=0}: komorebi::workspace: focusing container
2025-01-17T21:09:05.213857Z  INFO process_event{event="FocusChange" winevent="SystemForeground" hwnd=
2025-01-17T21:09:06.492979Z  INFO process_event{event="FocusChange" winevent="SystemForeground" hwnd=1904448}:update_focused_workspace{follow_focus=true trigger_focus=false}: komorebi::window_manager: updating
2025-01-17T21:09:06.495280Z ERROR komorebi::process_event:
   0: there is no container/window

Location:
   komorebi\src\workspace.rs:522

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 11 frames hidden ⋮
  12: komorebi::workspace::impl$1::focus_container_by_window::closure$0<unknown>
      at C:\Users\Tobias\Dev\komorebi\komorebi\src\workspace.rs:522
  13: enum2$<core::option::Option<usize> >::ok_or_else<usize,eyre::Report,komorebi::workspace::impl$1::focus_container_by_window::closure_env$0><unknown>
      at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library\core\src\option.rs:1277
  14: komorebi::workspace::Workspace::focus_container_by_window<unknown>
      at C:\Users\Tobias\Dev\komorebi\komorebi\src\workspace.rs:520
  15: komorebi::window_manager::WindowManager::process_event<unknown>
      at C:\Users\Tobias\Dev\komorebi\komorebi\src\process_event.rs:268
  16: komorebi::process_event::listen_for_events::closure$0<unknown>
      at C:\Users\Tobias\Dev\komorebi\komorebi\src\process_event.rs:51                              exe, class: CASCADIA_HOSTING_WINDOW_CLASS)ed: (hwnd: 396118, title: PowerShell, exe: WindowsTerminal.e
  17: core::hint::black_box<unknown>
      at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library\core\src\hint.rs:389
  18: std::sys::backtrace::__rust_begin_short_backtrace<komorebi::process_event::listen_for_events::closure_env$0,tuple$<> ><unknown>
      at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library\std\src\sys\backtrace.rs:154
  19: std::thread::impl$0::spawn_unchecked_::closure$1::closure$0<komorebi::process_event::listen_for_events::closure_env$0,tuple$<> ><unknown>
      at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library\std\src\thread\mod.rs:561
  20: core::panic::unwind_safe::impl$25::call_once<tuple$<>,std::thread::impl$0::spawn_unchecked_::closure$1::closure_env$0<komorebi::process_event::listen_for_events::closure_env$0,tuple$<> > ><unknown>
      at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library\core\src\panic\unwind_safe.rs:272
  21: std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::impl$0::spawn_unchecked_::closure$1::closure_env$0<komorebi::process_event::listen_for_events::closure_env$0,tuple$<> > >,tuple$<> ><unknown>
      at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library\std\src\panicking.rs:557
  22: std::thread::impl$7::drop::closure$0<enum2$<core::result::Result<tuple$<>,eyre::Report> > ><unknown>
      at <unknown source file>:<unknown line>
  23: std::panicking::try<unknown>
      at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library\std\src\panicking.rs:520
  24: std::panic::catch_unwind<unknown>
      at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library\std\src\panic.rs:358
  25: std::thread::impl$0::spawn_unchecked_::closure$1<komorebi::process_event::listen_for_events::closure_env$0,tuple$<> ><unknown>
      at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library\std\src\thread\mod.rs:559
  26: core::ops::function::FnOnce::call_once<std::thread::impl$0::spawn_unchecked_::closure_env$1<komorebi::process_event::listen_for_events::closure_env$0,tuple$<> >,tuple$<> ><unknown>
      at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library\core\src\ops\function.rs:250
  27: alloc::boxed::impl$28::call_once<unknown>
      at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/alloc\src\boxed.rs:1972
  28: alloc::boxed::impl$28::call_once<unknown>
      at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/alloc\src\boxed.rs:1972
  29: std::sys::pal::windows::thread::impl$0::new::thread_start<unknown>
      at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/std\src\sys\pal\windows\thread.rs:55
  30: BaseThreadInitThunk<unknown>
      at <unknown source file>:<unknown line>
  31: RtlUserThreadStart<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.

@LGUG2Z
Copy link
Owner

LGUG2Z commented Jan 17, 2025

Thank you! The table is very helpful, I can probably look into this over the weekend. Hopefully you can use one of the alternative configuration combinations without any issue until I untangle this.

@LGUG2Z LGUG2Z closed this as completed in 77ef259 Jan 18, 2025
@LGUG2Z
Copy link
Owner

LGUG2Z commented Jan 18, 2025

This is fixed on master and will be part of the next nightly release tomorrow 🚀

If you plan to use komorebi in your day job in the future please remember to purchase a commercial use license 🙏

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

2 participants