Replies: 14 comments 14 replies
|
This could be the general tree structure that would hold all the dispatch functions. Names and branches are open to discussions ! Dispatcher tree main branches CLICK-METhe current and some new functions of Dispatchers populating the proposed tree. It would be great to have a good naming convention that :
Dispatcher tree functions CLICK-MEDispatcher tree functions with descriptionsCLICK-ME |
|
makes no sense to make such a breaking change. If anything, we could sort the dispatchers better in the docs. |
|
There are some inconsistent parts in the naming scheme for the API. I'll try to illustrate it with an example. Exemple 1, we have activewindow and clients. How should the active window be called : activewindow, activeclient, currentclient, selectedclient, focusedclient ? Active, current and focused are used in an interchangeable way across dispatcher calls, or that's how it seems to me. Calling both In a way, activewindow is the same as clients parsed to include only the "active" or "focuse" or "current" client. This exemple could be implemented as getting a list of clients with specific search :
The thing is, how specific should hyprctl be ? Should it just output all connected clients and let the user script lots of functions to get a specific value or should hyprctl just output the desired information ? Any of those can be done by parsing the json and manipulating it (or is it?). But it's not efficient nor concise. Having hyprctl respond in a concise way could prevent having to pool multiple query to hyprctl and process it's data to get a simple result that could be easier to get if the API where more elaborated. Also the project should have a guideline to decide on what terms should be used. Hyprland uses the term client or window, while Wayland talks about client. Should we just go with only clients ? Do we query for the active client or the focused client ? Is an active client/window a client that is currently on a visible workspace on display on a monitor, or is it the only client/window that has focus ? Should we differentiate clients that are displayed on a monitor from those on workspaces that are not "displayed" on a monitor ? I hope this can illustrate how the naming can be confusing for users in it's present state. |
|
Hi,
In short, I'm not sure - at this point in time - hyprland requires a sophisticated query language. The main points in my view are:
Edit: pattern matching would be nice too indeed, maybe with a syntax like: Edit 2: I think there are two options here on how to proceed:
|
|
Firsly, I'll look on the names of the dispatchers. For now, the term window is used even if we talk about clients. My findings where : The function name may or may not contain the subject of the action, on what the action is to be performed. If the action is directed to current|focused|active window, it should be implicit in the function's name. Also, should we change all functions so they can accept "current" as target of the action if they can ? I identified 22 actions and the number of occurences : There are 7 functions that don't have an action : There are 25 other terms that may reference to the target or subject of the action : I will give some comments on the dispatcher's name and even recommend a more fitting name. The recommended name is just to conform to current naming practice, it may not be the best name as I still think the subject of action should be under a group (like workspace->action)
|
|
Mhm, I am not against a gradual move. We could add a config option akin to However, I'd rather step back from the discussion here:
If my input is absolutely necessary feel free to ping me, or when you all come to a consensus with a full proposal for a new system. |
|
I'm fine with current system, and am pretty against rewriting all of my config files. May just be me though. |
|
As long as old syntax would exist (don't break the userspace!) or some transition period would be applied I don't mind it. |
|
I can confidently suggest a scheme that does: These are the names I have chosen for socket event: {
### WINDOWS ###
windowFocus = {
event = "activewindow";
vars = [ "WINDOW_CLASS" "WINDOW_TITLE" ];
};
windowFocusV2 = {
event = "activewindowv2";
vars = [ "WINDOW_ADDRESS" ];
};
windowOpen = {
event = "openwindow";
vars =
[ "WINDOW_ADDRESS" "WORKSPACE_NAME" "WINDOW_CLASS" "WINDOW_TITLE" ];
};
windowClose = {
event = "movewindow";
vars = [ "WINDOW_ADDRESS" ];
};
windowMove = {
event = "movewindow";
vars = [ "WINDOW_ADDRESS" "WORKSPACE_NAME" ];
};
windowFloat = {
event = "changefloatingmode";
vars = [ "WINDOW_ADDRESS" "FLOAT_STATE" ];
};
windowFullscreen = {
event = "fullscreen";
vars = [ "FULLSCREEN_STATE" ];
};
windowMinimize = {
event = "minimize";
vars = [ "WINDOW_ADDRESS" "MINIMIZE_STATE" ];
};
windowUrgent = {
event = "urgent";
vars = [ "WINDOW_ADDRESS" ];
};
windowTitle = {
event = "windowtitle";
vars = [ "WINDOW_ADDRESS" ];
};
### LAYERS ###
layerOpen = {
event = "openlayer";
vars = [ "LAYER_NAMESPACE" ];
};
layerClose = {
event = "closelayer";
vars = [ "LAYER_NAMESPACE" ];
};
### WORKSPACES ###
workspaceFocus = {
event = "workspace";
vars = [ "WORKSPACE_NAME" ];
};
workspaceCreate = {
event = "createworkspace";
vars = [ "WORKSPACE_NAME" ];
};
workspaceDestroy = {
event = "destroyworkspace";
vars = [ "WORKSPACE_NAME" ];
};
workspaceMove = {
event = "moveworkspace";
vars = [ "WORKSPACE_NAME" "MONITOR_NAME" ];
};
### MONITORS ###
monitorFocus = {
event = "focusedmon";
vars = [ "MONITOR_NAME" "WORKSPACE_NAME" ];
};
monitorAdd = {
event = "monitoradded";
vars = [ "MONITOR_NAME" ];
};
monitorRemove = {
event = "monitorremoved";
vars = [ "MONITOR_NAME" ];
};
### MISCELLANEOUS ###
layoutChange = {
event = "activelayout";
vars = [ "KEYBOARD_NAME" "LAYOUT_NAME" ];
};
submapChange = {
event = "submap";
vars = [ "SUBMAP_NAME" ];
};
screencastChange = {
event = "screencast";
vars = [ "SCREENCAST_STATE" "SCREENCAST_OWNER" ];
};
} |
|
Messing with hyprctl is by far the best way to interact with Hyprland's API if your programming knowledge is not sufficient to make your own plugins - which I think is the case for a large majority of the userbase. As long as the old structure is somewhat supported (but discouraged), the new structure gradually making its way in is only an improvement, nothing else. |
|
Thanks for your input everyone. I understand that compatibility with current implementation is mandatory for an extended period of time, let's say until version 1.0 or 1.5. I like the idea of @spikespaz of nounVerb, but since an action may need precision, I'd propose nounVerbVariation. Having a variation could prevent most case of needing more than 2 param for a function. Like The term dispatch is to carry out (a duty or task) promptly (Collins) and has execute and perform as synonym. So for implementing a new revision of the API, it needs to work from bind and hyprctl. Since we have
While in bind's config, it would be (the example from wiki) : Also For hyprctl, we could allow spacing or not between noun and verb for shell completition but no space for bind commands.
We could also always use shorts for names : focus:fs workspace:ws monitor:m client:cl ? |
|
Finally I have a proposition for a V2 API. Open to changes and comments ! It's almost all new dispatcher's names and they do not conflict with the old ones, so it could be implemented without breaking compatibility ! I made it in a wiki format and you may view the PR as it contains lots of information and view the wiki-page. It went down from 53 to 38 functions and should keep all the same functionality. Thanks for your time in giving your feedback. P.S. I failed at squashing the merge, sorry. |
|
What if I contributed a bash script that sed's your config files? Could be deployed on upgrade in AUR and stuff. My thinking is that if it were a seamless automatic transition (easily toggled off), it offers a good compromise. IMO the current names are very arbitrarily chosen without any style 😎. |
|
That's why it is a must to implement a major change as a separate socket and maintain both for a while, this extra workload & planification has to be considered. One fun & stil professional way of doing it it implementing it as a hidden unsupported unstable feature, so there could be a period where some plugin maintainers & other crazy people would give it a try, provide feedback, iterate over the API until it's great - it doesn't prevent from decent preparation & draft documents of course but it could still be developped incrementally with breaking change, since people would be warned - once it looks stable there is a final review & it becomes frozen / official / extend only. So that was my 2cents, it doesn't have to impact current user base, and once the new API is published we can give users some time to migrate (a year+ ?) providing them nice migration documents & correspondance tables. Once it's ready it will be a strong point for Hyprland to have the nicest API on top of having the best & smoothest animations ;) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I would like to propose a rewrite of the Dispatchers functions.
Currently, there are many functions (edit: 53 functions as v0.31.0) bundled without a coherent hierarchy.
This makes it :
Dispatcher functions are important and having a good map of what functions are needed could lower the need for users to write custom hyprctl scripts for simple things that could be done easily with bind keys.
Proposition:
I hope to have a constructive discussion here and hopefully that collectively we could submit something to the developers for review.
Implementing will break compatibility with older versions of hyprwm unless we provide a deprecated interface that will be removed later on.
This is a discussion for users and developers to participate in.
How to proceed :
8.1 Have hyprctl dispatch --help display the tree of available functions
8.2 Have hyprctl dispatch branch,function --help display function's desctiption
Thanks and let's keep working hard to make hyprwm the best it can be !
All reactions