glzr-io / glazewm

GlazeWM is a tiling window manager for Windows inspired by i3wm.
GNU General Public License v3.0
6.01k stars 172 forks source link

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

Open es183923 opened 2 years ago

es183923 commented 2 years ago

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 commented 2 years ago

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:

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

es183923 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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