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

consistent way of managing apps that don't follow normal window behavior #105

Open
es183923 opened this issue Aug 20, 2022 · 4 comments
Open

Comments

@es183923
Copy link

Could it be possible to integrate https://github.com/LGUG2Z/komorebi-application-specific-configuration into GlazeWM? This way, we can have a guaranteed and easy way to make sure all the apps are treated properly and function correctly.

Mainly, the problem is with apps not respecting the window dimensions correctly.

Related issues:
#73
#33
#62

@lars-berger
Copy link
Collaborator

I'm a little bit torn on whether to incorporate this config into GlazeWM - it feels a little weird IMO to pull in the config from another WM. A few of the properties in the config I'm not 100% sure what they do. Would you happen to know what these ones do: object_name_change, force, and layered?

Something I'm noticing though is a lot of these rules are actually redundant because GlazeWM makes some assumptions that Komorebi does not. From taking a look at the config, these differences seem to be:

  • GlazeWM initializes windows as floating if they aren't resizable (ie. no WS_THICKFRAME window style).
  • GlazeWM will always shrink borders if the window is an Electron app. This is the equivalent to the border_overflow rule in Komorebi.
  • GlazeWM hooks into EVENT_OBJECT_HIDE window events, which takes care of apps that minimize to tray. This means there's no need for the tray_and_multi_window rule.

There's of course cases that this doesn't cover, but it means there's way less overlap with the Komorebi config.

@es183923
Copy link
Author

I'm not sure what object_name_change and layered are, but force is for when the window isn't able to be controlled normally, and needs to be forcefully controlled.

Even though some of these are not used by GlazeWM, its still a very general list of what applications and application windows, so maybe just use the border_overflow for now.

@LGUG2Z
Copy link

LGUG2Z commented Aug 28, 2022

Hi guys 👋

object_name_change is to identify applications that send EVENT_OBJECT_NAMECHANGE on launch instead of EVENT_OBJECT_SHOW, there aren't many of them, but these do include common apps like Firefox and IntelliJ IDEs. If this event isn't handled, in komorebi at least, the window will not be tiled until the next event for that application is fired, which typically only comes after some manual interaction with one of the app's windows.

layered is for applications that have WS_EX_LAYERED but should be still be tiled (generally windows with this extended style should not be tiled because they result in ghost tiles or other weird behaviour).

force is really just an override of last resort for applications that have an unholy combination of window styles or extended styles.

komorebi doesn't actually consume the configuration repository directly; it's optionally used to generate komorebic commands from (generator code here), so in theory anyone can use any language that is able to read YAML to generate configuration output for any other tiling window manager.

In the example of GlazeWM, since it already handles a lot of stuff as @lars-berger described above, you could just parse the YAML file and discard things that are already handled while just generating configuration output for things that are needed. Anyone can write and maintain a configuration generator for any twm using that big old YAML file as an input. 🎉

@lyze237
Copy link
Contributor

lyze237 commented Sep 2, 2022

Here's a very basic dotnet script which downloads and converts the yml to the yml format glazewm uses for all the floating rules:

#r "nuget: YamlDotNet, 12.0.0"
using System;
using System.Linq;
using System.Net.Http;
using YamlDotNet.Serialization;

var response = await new HttpClient().GetAsync("https://raw.githubusercontent.com/LGUG2Z/komorebi-application-specific-configuration/master/applications.yaml");
var responseString = await response.Content.ReadAsStringAsync();

var entities = new Deserializer().Deserialize<List<dynamic>>(new StringReader(responseString));

var outputs = new List<Dictionary<string, string>>();

foreach (var entity in entities.Where(e => e.ContainsKey("float_identifiers")))
{
    foreach (var identifier in entity["float_identifiers"])
    {
        (var kind, var id) = (identifier["kind"], identifier["id"]);

        (var outputType, var outputId) = kind switch {
            "exe" => ("match_process_name", id.Split(".exe")[0]),
            "class" => ("match_class_name", id),
            "title" => ("match_title", id),
            _ => throw new ArgumentException(kind)
        };

        var output = new Dictionary<string, string>();
        output["command"] = "set floating";
        output[outputType] = outputId;
        outputs.Add(output);
    }
}

Console.WriteLine(new Serializer().Serialize(outputs));

dotnet script main.csx

- command: set floating
  match_process_name: 1Password
- command: set floating
  match_title: Window Spy
- command: set floating
  match_title: Calculator
- command: set floating
  match_process_name: CredentialUIBroker
- command: set floating
  match_class_name: Chrome_RenderWidgetHostHWND
- command: set floating
  match_class_name: TApplication
- command: set floating
  match_class_name: TWizardForm
- command: set floating
  match_class_name: SunAwtDialog
- command: set floating
  match_process_name: LogiBolt
- command: set floating
  match_process_name: LogiTune
- command: set floating
  match_process_name: LogiOptionsUI
- command: set floating
  match_class_name: _WwB
- command: set floating
  match_class_name: _WwB
- command: set floating
  match_class_name: _WwB
- command: set floating
  match_title: Microsoft Teams Notifications
- command: set floating
  match_class_name: _WwB
- command: set floating
  match_class_name: MozillaTaskbarPreviewClass
- command: set floating
  match_process_name: NohBoard
- command: set floating
  match_process_name: Paradox Launcher
- command: set floating
  match_process_name: PowerToys.ColorPickerUI
- command: set floating
  match_process_name: PowerToys.ImageResizer
- command: set floating
  match_process_name: ProcessHacker
- command: set floating
  match_class_name: SunAwtDialog
- command: set floating
  match_process_name: QuickLook
- command: set floating
  match_process_name: RepoZ
- command: set floating
  match_process_name: RoundedTB
- command: set floating
  match_class_name: Chrome_RenderWidgetHostHWND
- command: set floating
  match_class_name: Chrome_RenderWidgetHostHWND
- command: set floating
  match_class_name: Shell_Dialog
- command: set floating
  match_class_name: TaskManagerWindow
- command: set floating
  match_process_name: tcconfig
- command: set floating
  match_process_name: TranslucentTB
- command: set floating
  match_class_name: OperationStatusWindow
- command: set floating
  match_title: Control Panel
- command: set floating
  match_class_name: MsiDialogCloseClass
- command: set floating
  match_title: Hotkey sink
- command: set floating
  match_process_name: Zoom
- command: set floating
  match_process_name: ueli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants