mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-07-04 00:07:04 -04:00
deprecate: not need dwl ipc anymore
This commit is contained in:
parent
1725a3e2bb
commit
0182e24bc5
8 changed files with 62 additions and 643 deletions
|
|
@ -17,7 +17,12 @@ Add the following to your Waybar configuration:
|
||||||
{
|
{
|
||||||
"modules-left": [
|
"modules-left": [
|
||||||
"ext/workspaces",
|
"ext/workspaces",
|
||||||
"dwl/window"
|
"mango/layout",
|
||||||
|
"mango/window"
|
||||||
|
],
|
||||||
|
"modules-right": [
|
||||||
|
"mango/language",
|
||||||
|
"mango/keymode",
|
||||||
],
|
],
|
||||||
"ext/workspaces": {
|
"ext/workspaces": {
|
||||||
"format": "{icon}",
|
"format": "{icon}",
|
||||||
|
|
@ -26,13 +31,33 @@ Add the following to your Waybar configuration:
|
||||||
"on-click-right": "deactivate",
|
"on-click-right": "deactivate",
|
||||||
"sort-by-id": true
|
"sort-by-id": true
|
||||||
},
|
},
|
||||||
"dwl/window": {
|
"mango/keymode": {
|
||||||
"format": "[{layout}] {title}"
|
"format": "[{default}]",
|
||||||
}
|
"format-default": " Default",
|
||||||
|
"format-test": " Test",
|
||||||
|
},
|
||||||
|
"mango/window": {
|
||||||
|
"format": "{}",
|
||||||
|
"icon": true,
|
||||||
|
"on-click":"bash ~/.config/mango/scripts/screenshot.sh",
|
||||||
|
"on-click-right":"bash ~/tool/shotTranslate.sh shot",
|
||||||
|
"icon": false,
|
||||||
|
"icon-size": 20
|
||||||
|
},
|
||||||
|
"mango/layout": {
|
||||||
|
"format": "{}",
|
||||||
|
// "format-S": "Scroller",
|
||||||
|
// "format-T": "Tile",
|
||||||
|
},
|
||||||
|
"mango/language": {
|
||||||
|
"format": "{short}",
|
||||||
|
"format-us": " US",
|
||||||
|
"format-ru": " RU"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Styling
|
## Styling Example
|
||||||
|
|
||||||
You can style the tags using standard CSS in `style.css`.
|
You can style the tags using standard CSS in `style.css`.
|
||||||
|
|
||||||
|
|
@ -40,27 +65,13 @@ You can style the tags using standard CSS in `style.css`.
|
||||||
|
|
||||||
```css
|
```css
|
||||||
#workspaces {
|
#workspaces {
|
||||||
border-radius: 4px;
|
|
||||||
border-width: 2px;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: #c9b890;
|
border-color: #c9b890;
|
||||||
margin-left: 4px;
|
|
||||||
padding-left: 10px;
|
|
||||||
padding-right: 6px;
|
|
||||||
background: rgba(40, 40, 40, 0.76);
|
background: rgba(40, 40, 40, 0.76);
|
||||||
}
|
}
|
||||||
|
|
||||||
#workspaces button {
|
#workspaces button {
|
||||||
border: none;
|
|
||||||
background: none;
|
background: none;
|
||||||
box-shadow: inherit;
|
|
||||||
text-shadow: inherit;
|
|
||||||
color: #ddca9e;
|
color: #ddca9e;
|
||||||
padding: 1px;
|
|
||||||
padding-left: 1px;
|
|
||||||
padding-right: 1px;
|
|
||||||
margin-right: 2px;
|
|
||||||
margin-left: 2px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#workspaces button.hidden {
|
#workspaces button.hidden {
|
||||||
|
|
@ -79,61 +90,39 @@ You can style the tags using standard CSS in `style.css`.
|
||||||
#workspaces button.active {
|
#workspaces button.active {
|
||||||
background-color: #ddca9e;
|
background-color: #ddca9e;
|
||||||
color: #282828;
|
color: #282828;
|
||||||
margin-top: 5px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
padding-top: 1px;
|
|
||||||
padding-bottom: 0px;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#workspaces button.urgent {
|
#workspaces button.urgent {
|
||||||
background-color: #ef5e5e;
|
background-color: #ef5e5e;
|
||||||
color: #282828;
|
color: #282828;
|
||||||
margin-top: 5px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
padding-top: 1px;
|
|
||||||
padding-bottom: 0px;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#tags {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#tags button {
|
|
||||||
background-color: #fff;
|
|
||||||
color: #a585cd;
|
|
||||||
}
|
|
||||||
|
|
||||||
#tags button:not(.occupied):not(.focused) {
|
|
||||||
font-size: 0;
|
|
||||||
min-width: 0;
|
|
||||||
min-height: 0;
|
|
||||||
margin: -17px;
|
|
||||||
padding: 0;
|
|
||||||
color: transparent;
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#tags button.occupied {
|
|
||||||
background-color: #fff;
|
|
||||||
color: #cdc885;
|
|
||||||
}
|
|
||||||
|
|
||||||
#tags button.focused {
|
|
||||||
background-color: rgb(186, 142, 213);
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
#tags button.urgent {
|
|
||||||
background: rgb(171, 101, 101);
|
|
||||||
color: #fff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#window {
|
#window {
|
||||||
background-color: rgb(237, 196, 147);
|
background-color: #CA9297;
|
||||||
color: rgb(63, 37, 5);
|
color: #282828;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window#waybar.empty #window {
|
||||||
|
background: none;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#layout {
|
||||||
|
background-color: #CA9297;
|
||||||
|
color: #282828;
|
||||||
|
}
|
||||||
|
|
||||||
|
#language {
|
||||||
|
background-color: #CA9297;
|
||||||
|
color: #282828;
|
||||||
|
}
|
||||||
|
|
||||||
|
#keymode {
|
||||||
|
background-color: #CA9297;
|
||||||
|
color: #282828;
|
||||||
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Complete Configuration Example
|
## Complete Configuration Example
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,6 @@ executable('mango',
|
||||||
)
|
)
|
||||||
|
|
||||||
# build mmsg
|
# build mmsg
|
||||||
dwl_ipc_protocol = 'protocols/dwl-ipc-unstable-v2.xml'
|
|
||||||
|
|
||||||
wayland_scanner_client_header = generator(
|
wayland_scanner_client_header = generator(
|
||||||
wayland_scanner,
|
wayland_scanner,
|
||||||
|
|
@ -138,8 +137,6 @@ wayland_scanner_private_code = generator(
|
||||||
# use generator in mmsg target
|
# use generator in mmsg target
|
||||||
executable('mmsg',
|
executable('mmsg',
|
||||||
'mmsg/mmsg.c',
|
'mmsg/mmsg.c',
|
||||||
wayland_scanner_private_code.process(dwl_ipc_protocol),
|
|
||||||
wayland_scanner_client_header.process(dwl_ipc_protocol),
|
|
||||||
dependencies: [
|
dependencies: [
|
||||||
libwayland_client_dep
|
libwayland_client_dep
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -1,253 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
This is largely ripped from somebar's ipc patchset; just with some personal modifications.
|
|
||||||
I would probably just submit raphi's patchset but I don't think that would be polite.
|
|
||||||
-->
|
|
||||||
<protocol name="dwl_ipc_unstable_v2">
|
|
||||||
<description summary="inter-proccess-communication about dwl's state">
|
|
||||||
This protocol allows clients to update and get updates from dwl.
|
|
||||||
|
|
||||||
Warning! The protocol described in this file is experimental and
|
|
||||||
backward incompatible changes may be made. Backward compatible
|
|
||||||
changes may be added together with the corresponding interface
|
|
||||||
version bump.
|
|
||||||
Backward incompatible changes are done by bumping the version
|
|
||||||
number in the protocol and interface names and resetting the
|
|
||||||
interface version. Once the protocol is to be declared stable,
|
|
||||||
the 'z' prefix and the version number in the protocol and
|
|
||||||
interface names are removed and the interface version number is
|
|
||||||
reset.
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<interface name="zdwl_ipc_manager_v2" version="2">
|
|
||||||
<description summary="manage dwl state">
|
|
||||||
This interface is exposed as a global in wl_registry.
|
|
||||||
|
|
||||||
Clients can use this interface to get a dwl_ipc_output.
|
|
||||||
After binding the client will recieve the dwl_ipc_manager.tags and dwl_ipc_manager.layout events.
|
|
||||||
The dwl_ipc_manager.tags and dwl_ipc_manager.layout events expose tags and layouts to the client.
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<request name="release" type="destructor">
|
|
||||||
<description summary="release dwl_ipc_manager">
|
|
||||||
Indicates that the client will not the dwl_ipc_manager object anymore.
|
|
||||||
Objects created through this instance are not affected.
|
|
||||||
</description>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="get_output">
|
|
||||||
<description summary="get a dwl_ipc_outout for a wl_output">
|
|
||||||
Get a dwl_ipc_outout for the specified wl_output.
|
|
||||||
</description>
|
|
||||||
<arg name="id" type="new_id" interface="zdwl_ipc_output_v2"/>
|
|
||||||
<arg name="output" type="object" interface="wl_output"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<event name="tags">
|
|
||||||
<description summary="Announces tag amount">
|
|
||||||
This event is sent after binding.
|
|
||||||
A roundtrip after binding guarantees the client recieved all tags.
|
|
||||||
</description>
|
|
||||||
<arg name="amount" type="uint"/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="layout">
|
|
||||||
<description summary="Announces a layout">
|
|
||||||
This event is sent after binding.
|
|
||||||
A roundtrip after binding guarantees the client recieved all layouts.
|
|
||||||
</description>
|
|
||||||
<arg name="name" type="string"/>
|
|
||||||
</event>
|
|
||||||
</interface>
|
|
||||||
|
|
||||||
<interface name="zdwl_ipc_output_v2" version="2">
|
|
||||||
<description summary="control dwl output">
|
|
||||||
Observe and control a dwl output.
|
|
||||||
|
|
||||||
Events are double-buffered:
|
|
||||||
Clients should cache events and redraw when a dwl_ipc_output.frame event is sent.
|
|
||||||
|
|
||||||
Request are not double-buffered:
|
|
||||||
The compositor will update immediately upon request.
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<enum name="tag_state">
|
|
||||||
<entry name="none" value="0" summary="no state"/>
|
|
||||||
<entry name="active" value="1" summary="tag is active"/>
|
|
||||||
<entry name="urgent" value="2" summary="tag has at least one urgent client"/>
|
|
||||||
</enum>
|
|
||||||
|
|
||||||
<request name="release" type="destructor">
|
|
||||||
<description summary="release dwl_ipc_outout">
|
|
||||||
Indicates to that the client no longer needs this dwl_ipc_output.
|
|
||||||
</description>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<event name="toggle_visibility">
|
|
||||||
<description summary="Toggle client visibilty">
|
|
||||||
Indicates the client should hide or show themselves.
|
|
||||||
If the client is visible then hide, if hidden then show.
|
|
||||||
</description>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="active">
|
|
||||||
<description summary="Update the selected output.">
|
|
||||||
Indicates if the output is active. Zero is invalid, nonzero is valid.
|
|
||||||
</description>
|
|
||||||
<arg name="active" type="uint"/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="tag">
|
|
||||||
<description summary="Update the state of a tag.">
|
|
||||||
Indicates that a tag has been updated.
|
|
||||||
</description>
|
|
||||||
<arg name="tag" type="uint" summary="Index of the tag"/>
|
|
||||||
<arg name="state" type="uint" enum="tag_state" summary="The state of the tag."/>
|
|
||||||
<arg name="clients" type="uint" summary="The number of clients in the tag."/>
|
|
||||||
<arg name="focused" type="uint" summary="If there is a focused client. Nonzero being valid, zero being invalid."/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="layout">
|
|
||||||
<description summary="Update the layout.">
|
|
||||||
Indicates a new layout is selected.
|
|
||||||
</description>
|
|
||||||
<arg name="layout" type="uint" summary="Index of the layout."/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="title">
|
|
||||||
<description summary="Update the title.">
|
|
||||||
Indicates the title has changed.
|
|
||||||
</description>
|
|
||||||
<arg name="title" type="string" summary="The new title name."/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="appid" since="1">
|
|
||||||
<description summary="Update the appid.">
|
|
||||||
Indicates the appid has changed.
|
|
||||||
</description>
|
|
||||||
<arg name="appid" type="string" summary="The new appid."/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="layout_symbol" since="1">
|
|
||||||
<description summary="Update the current layout symbol">
|
|
||||||
Indicates the layout has changed. Since layout symbols are dynamic.
|
|
||||||
As opposed to the zdwl_ipc_manager.layout event, this should take precendence when displaying.
|
|
||||||
You can ignore the zdwl_ipc_output.layout event.
|
|
||||||
</description>
|
|
||||||
<arg name="layout" type="string" summary="The new layout"/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="frame">
|
|
||||||
<description summary="The update sequence is done.">
|
|
||||||
Indicates that a sequence of status updates have finished and the client should redraw.
|
|
||||||
</description>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<request name="set_tags">
|
|
||||||
<description summary="Set the active tags of this output"/>
|
|
||||||
<arg name="tagmask" type="uint" summary="bitmask of the tags that should be set."/>
|
|
||||||
<arg name="toggle_tagset" type="uint" summary="toggle the selected tagset, zero for invalid, nonzero for valid."/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="set_client_tags">
|
|
||||||
<description summary="Set the tags of the focused client.">
|
|
||||||
The tags are updated as follows:
|
|
||||||
new_tags = (current_tags AND and_tags) XOR xor_tags
|
|
||||||
</description>
|
|
||||||
<arg name="and_tags" type="uint"/>
|
|
||||||
<arg name="xor_tags" type="uint"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="set_layout">
|
|
||||||
<description summary="Set the layout of this output"/>
|
|
||||||
<arg name="index" type="uint" summary="index of a layout recieved by dwl_ipc_manager.layout"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="quit" since="2">
|
|
||||||
<description summary="Quit mango">This request allows clients to instruct the compositor to quit mango.</description>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="dispatch" since="2">
|
|
||||||
<description summary="Set the active tags of this output"/>
|
|
||||||
<arg name="dispatch" type="string" summary="dispatch name."/>
|
|
||||||
<arg name="arg1" type="string" summary="arg1."/>
|
|
||||||
<arg name="arg2" type="string" summary="arg2."/>
|
|
||||||
<arg name="arg3" type="string" summary="arg3."/>
|
|
||||||
<arg name="arg4" type="string" summary="arg4."/>
|
|
||||||
<arg name="arg5" type="string" summary="arg5."/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<!-- Version 2 -->
|
|
||||||
<event name="fullscreen" since="2">
|
|
||||||
<description summary="Update fullscreen status">
|
|
||||||
Indicates if the selected client on this output is fullscreen.
|
|
||||||
</description>
|
|
||||||
<arg name="is_fullscreen" type="uint" summary="If the selected client is fullscreen. Nonzero is valid, zero invalid"/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="floating" since="2">
|
|
||||||
<description summary="Update the floating status">
|
|
||||||
Indicates if the selected client on this output is floating.
|
|
||||||
</description>
|
|
||||||
<arg name="is_floating" type="uint" summary="If the selected client is floating. Nonzero is valid, zero invalid"/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="x" since="2">
|
|
||||||
<description summary="Update the x coordinates">
|
|
||||||
Indicates if x coordinates of the selected client.
|
|
||||||
</description>
|
|
||||||
<arg name="x" type="int" summary="x coordinate of the selected client"/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="y" since="2">
|
|
||||||
<description summary="Update the y coordinates">
|
|
||||||
Indicates if y coordinates of the selected client.
|
|
||||||
</description>
|
|
||||||
<arg name="y" type="int" summary="y coordinate of the selected client"/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="width" since="2">
|
|
||||||
<description summary="Update the width">
|
|
||||||
Indicates if width of the selected client.
|
|
||||||
</description>
|
|
||||||
<arg name="width" type="int" summary="width of the selected client"/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="height" since="2">
|
|
||||||
<description summary="Update the height">
|
|
||||||
Indicates if height of the selected client.
|
|
||||||
</description>
|
|
||||||
<arg name="height" type="int" summary="height of the selected client"/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="last_layer" since="2">
|
|
||||||
<description summary="last map layer.">
|
|
||||||
last map layer.
|
|
||||||
</description>
|
|
||||||
<arg name="last_layer" type="string" summary="last map layer."/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="kb_layout" since="2">
|
|
||||||
<description summary="current keyboard layout.">
|
|
||||||
current keyboard layout.
|
|
||||||
</description>
|
|
||||||
<arg name="kb_layout" type="string" summary="current keyboard layout."/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="keymode" since="2">
|
|
||||||
<description summary="current keybind mode.">
|
|
||||||
current keybind mode.
|
|
||||||
</description>
|
|
||||||
<arg name="keymode" type="string" summary="current keybind mode."/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="scalefactor" since="2">
|
|
||||||
<description summary="scale factor of monitor.">
|
|
||||||
scale factor of monitor.
|
|
||||||
</description>
|
|
||||||
<arg name="scalefactor" type="uint" summary="scale factor of monitor."/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
</interface>
|
|
||||||
|
|
||||||
</protocol>
|
|
||||||
|
|
@ -21,7 +21,6 @@ wayland_xmls = [
|
||||||
wl_protocol_dir + '/staging/ext-workspace/ext-workspace-v1.xml',
|
wl_protocol_dir + '/staging/ext-workspace/ext-workspace-v1.xml',
|
||||||
wl_protocol_dir + '/staging/tearing-control/tearing-control-v1.xml',
|
wl_protocol_dir + '/staging/tearing-control/tearing-control-v1.xml',
|
||||||
'wlr-foreign-toplevel-management-unstable-v1.xml',
|
'wlr-foreign-toplevel-management-unstable-v1.xml',
|
||||||
'dwl-ipc-unstable-v2.xml',
|
|
||||||
'wlr-layer-shell-unstable-v1.xml',
|
'wlr-layer-shell-unstable-v1.xml',
|
||||||
'wlr-output-power-management-unstable-v1.xml',
|
'wlr-output-power-management-unstable-v1.xml',
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -519,8 +519,10 @@ void client_draw_shield(Client *c, struct wlr_box clip_box) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active_capture_count > 0 && c->shield_when_capture) {
|
if (active_capture_count > 0 && c->shield_when_capture) {
|
||||||
int32_t shield_x = clip_box.x - surface_relative_geom.x + (int32_t)c->bw;
|
int32_t shield_x =
|
||||||
int32_t shield_y = clip_box.y - surface_relative_geom.y + (int32_t)c->bw;
|
clip_box.x - surface_relative_geom.x + (int32_t)c->bw;
|
||||||
|
int32_t shield_y =
|
||||||
|
clip_box.y - surface_relative_geom.y + (int32_t)c->bw;
|
||||||
wlr_scene_node_raise_to_top(&c->shield->node);
|
wlr_scene_node_raise_to_top(&c->shield->node);
|
||||||
wlr_scene_node_set_position(&c->shield->node, shield_x, shield_y);
|
wlr_scene_node_set_position(&c->shield->node, shield_x, shield_y);
|
||||||
wlr_scene_rect_set_size(c->shield, clip_box.width, clip_box.height);
|
wlr_scene_rect_set_size(c->shield, clip_box.width, clip_box.height);
|
||||||
|
|
@ -558,8 +560,10 @@ void client_draw_blur(Client *c, struct wlr_box clip_box, struct ivec2 offset) {
|
||||||
c->animation.current.height - 2 * (int32_t)c->bw;
|
c->animation.current.height - 2 * (int32_t)c->bw;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t blur_x = clip_box.x - surface_relative_geom.x + (int32_t)c->bw;
|
int32_t blur_x =
|
||||||
int32_t blur_y = clip_box.y - surface_relative_geom.y + (int32_t)c->bw;
|
clip_box.x - surface_relative_geom.x + (int32_t)c->bw;
|
||||||
|
int32_t blur_y =
|
||||||
|
clip_box.y - surface_relative_geom.y + (int32_t)c->bw;
|
||||||
wlr_scene_node_set_enabled(&c->blur->node, true);
|
wlr_scene_node_set_enabled(&c->blur->node, true);
|
||||||
wlr_scene_node_set_position(&c->blur->node, blur_x, blur_y);
|
wlr_scene_node_set_position(&c->blur->node, blur_x, blur_y);
|
||||||
wlr_scene_blur_set_size(c->blur, clip_box.width, clip_box.height);
|
wlr_scene_blur_set_size(c->blur, clip_box.width, clip_box.height);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
#include "dwl-ipc.h"
|
|
||||||
#include "ext-workspace.h"
|
#include "ext-workspace.h"
|
||||||
#include "foreign-toplevel.h"
|
#include "foreign-toplevel.h"
|
||||||
#include "hdr.h"
|
#include "hdr.h"
|
||||||
|
|
|
||||||
|
|
@ -1,309 +0,0 @@
|
||||||
#include "dwl-ipc-unstable-v2-protocol.h"
|
|
||||||
|
|
||||||
static void dwl_ipc_manager_bind(struct wl_client *client, void *data,
|
|
||||||
uint32_t version, uint32_t id);
|
|
||||||
static void dwl_ipc_manager_destroy(struct wl_resource *resource);
|
|
||||||
static void dwl_ipc_manager_get_output(struct wl_client *client,
|
|
||||||
struct wl_resource *resource,
|
|
||||||
uint32_t id, struct wl_resource *output);
|
|
||||||
static void dwl_ipc_manager_release(struct wl_client *client,
|
|
||||||
struct wl_resource *resource);
|
|
||||||
static void dwl_ipc_output_destroy(struct wl_resource *resource);
|
|
||||||
static void dwl_ipc_output_printstatus(Monitor *monitor);
|
|
||||||
static void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output);
|
|
||||||
static void dwl_ipc_output_set_client_tags(struct wl_client *client,
|
|
||||||
struct wl_resource *resource,
|
|
||||||
uint32_t and_tags,
|
|
||||||
uint32_t xor_tags);
|
|
||||||
static void dwl_ipc_output_set_layout(struct wl_client *client,
|
|
||||||
struct wl_resource *resource,
|
|
||||||
uint32_t index);
|
|
||||||
static void dwl_ipc_output_set_tags(struct wl_client *client,
|
|
||||||
struct wl_resource *resource,
|
|
||||||
uint32_t tagmask, uint32_t toggle_tagset);
|
|
||||||
static void dwl_ipc_output_quit(struct wl_client *client,
|
|
||||||
struct wl_resource *resource);
|
|
||||||
static void dwl_ipc_output_dispatch(struct wl_client *client,
|
|
||||||
struct wl_resource *resource,
|
|
||||||
const char *dispatch, const char *arg1,
|
|
||||||
const char *arg2, const char *arg3,
|
|
||||||
const char *arg4, const char *arg5);
|
|
||||||
static void dwl_ipc_output_release(struct wl_client *client,
|
|
||||||
struct wl_resource *resource);
|
|
||||||
|
|
||||||
/* global event handlers */
|
|
||||||
static struct zdwl_ipc_manager_v2_interface dwl_manager_implementation = {
|
|
||||||
.release = dwl_ipc_manager_release,
|
|
||||||
.get_output = dwl_ipc_manager_get_output};
|
|
||||||
static struct zdwl_ipc_output_v2_interface dwl_output_implementation = {
|
|
||||||
.release = dwl_ipc_output_release,
|
|
||||||
.set_tags = dwl_ipc_output_set_tags,
|
|
||||||
.quit = dwl_ipc_output_quit,
|
|
||||||
.dispatch = dwl_ipc_output_dispatch,
|
|
||||||
.set_layout = dwl_ipc_output_set_layout,
|
|
||||||
.set_client_tags = dwl_ipc_output_set_client_tags};
|
|
||||||
|
|
||||||
void dwl_ipc_manager_bind(struct wl_client *client, void *data,
|
|
||||||
uint32_t version, uint32_t id) {
|
|
||||||
struct wl_resource *manager_resource =
|
|
||||||
wl_resource_create(client, &zdwl_ipc_manager_v2_interface, version, id);
|
|
||||||
if (!manager_resource) {
|
|
||||||
wl_client_post_no_memory(client);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wl_resource_set_implementation(manager_resource,
|
|
||||||
&dwl_manager_implementation, NULL,
|
|
||||||
dwl_ipc_manager_destroy);
|
|
||||||
|
|
||||||
zdwl_ipc_manager_v2_send_tags(manager_resource, LENGTH(tags));
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < LENGTH(layouts); i++)
|
|
||||||
zdwl_ipc_manager_v2_send_layout(manager_resource, layouts[i].symbol);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dwl_ipc_manager_destroy(struct wl_resource *resource) {
|
|
||||||
/* No state to destroy */
|
|
||||||
}
|
|
||||||
|
|
||||||
void dwl_ipc_manager_get_output(struct wl_client *client,
|
|
||||||
struct wl_resource *resource, uint32_t id,
|
|
||||||
struct wl_resource *output) {
|
|
||||||
DwlIpcOutput *ipc_output;
|
|
||||||
struct wlr_output *op = wlr_output_from_resource(output);
|
|
||||||
if (!op)
|
|
||||||
return;
|
|
||||||
Monitor *monitor = op->data;
|
|
||||||
struct wl_resource *output_resource =
|
|
||||||
wl_resource_create(client, &zdwl_ipc_output_v2_interface,
|
|
||||||
wl_resource_get_version(resource), id);
|
|
||||||
if (!output_resource)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ipc_output = ecalloc(1, sizeof(*ipc_output));
|
|
||||||
ipc_output->resource = output_resource;
|
|
||||||
ipc_output->mon = monitor;
|
|
||||||
wl_resource_set_implementation(output_resource, &dwl_output_implementation,
|
|
||||||
ipc_output, dwl_ipc_output_destroy);
|
|
||||||
wl_list_insert(&monitor->dwl_ipc_outputs, &ipc_output->link);
|
|
||||||
dwl_ipc_output_printstatus_to(ipc_output);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dwl_ipc_manager_release(struct wl_client *client,
|
|
||||||
struct wl_resource *resource) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dwl_ipc_output_destroy(struct wl_resource *resource) {
|
|
||||||
DwlIpcOutput *ipc_output = wl_resource_get_user_data(resource);
|
|
||||||
wl_list_remove(&ipc_output->link);
|
|
||||||
free(ipc_output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改IPC输出函数,接受掩码参数
|
|
||||||
void dwl_ipc_output_printstatus(Monitor *monitor) {
|
|
||||||
DwlIpcOutput *ipc_output;
|
|
||||||
wl_list_for_each(ipc_output, &monitor->dwl_ipc_outputs, link)
|
|
||||||
dwl_ipc_output_printstatus_to(ipc_output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改主IPC输出函数,根据掩码发送相应事件
|
|
||||||
void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output) {
|
|
||||||
Monitor *monitor = ipc_output->mon;
|
|
||||||
Client *c = NULL, *focused = NULL;
|
|
||||||
struct wlr_keyboard *keyboard;
|
|
||||||
xkb_layout_index_t current;
|
|
||||||
int32_t tagmask, state, numclients, focused_client, tag;
|
|
||||||
const char *title, *appid, *symbol;
|
|
||||||
char kb_layout[32];
|
|
||||||
focused = focustop(monitor);
|
|
||||||
zdwl_ipc_output_v2_send_active(ipc_output->resource, monitor == selmon);
|
|
||||||
|
|
||||||
for (tag = 0; tag < LENGTH(tags); tag++) {
|
|
||||||
numclients = state = focused_client = 0;
|
|
||||||
tagmask = 1 << tag;
|
|
||||||
if ((tagmask & monitor->tagset[monitor->seltags]) != 0)
|
|
||||||
state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE;
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
|
||||||
if (c->mon != monitor)
|
|
||||||
continue;
|
|
||||||
if (!(c->tags & tagmask))
|
|
||||||
continue;
|
|
||||||
if (c == focused)
|
|
||||||
focused_client = 1;
|
|
||||||
if (c->isurgent)
|
|
||||||
state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_URGENT;
|
|
||||||
numclients++;
|
|
||||||
}
|
|
||||||
zdwl_ipc_output_v2_send_tag(ipc_output->resource, tag, state,
|
|
||||||
numclients, focused_client);
|
|
||||||
}
|
|
||||||
|
|
||||||
title = focused ? client_get_title(focused) : "";
|
|
||||||
appid = focused ? client_get_appid(focused) : "";
|
|
||||||
|
|
||||||
if (monitor->isoverview) {
|
|
||||||
symbol = overviewlayout.symbol;
|
|
||||||
} else {
|
|
||||||
symbol = monitor->pertag->ltidxs[monitor->pertag->curtag]->symbol;
|
|
||||||
}
|
|
||||||
|
|
||||||
keyboard = &kb_group->wlr_group->keyboard;
|
|
||||||
current = xkb_state_serialize_layout(keyboard->xkb_state,
|
|
||||||
XKB_STATE_LAYOUT_EFFECTIVE);
|
|
||||||
get_layout_abbr(kb_layout,
|
|
||||||
xkb_keymap_layout_get_name(keyboard->keymap, current));
|
|
||||||
|
|
||||||
zdwl_ipc_output_v2_send_layout(
|
|
||||||
ipc_output->resource,
|
|
||||||
monitor->pertag->ltidxs[monitor->pertag->curtag] - layouts);
|
|
||||||
zdwl_ipc_output_v2_send_title(ipc_output->resource, title ? title : broken);
|
|
||||||
zdwl_ipc_output_v2_send_appid(ipc_output->resource, appid ? appid : broken);
|
|
||||||
zdwl_ipc_output_v2_send_layout_symbol(ipc_output->resource, symbol);
|
|
||||||
if (wl_resource_get_version(ipc_output->resource) >=
|
|
||||||
ZDWL_IPC_OUTPUT_V2_FULLSCREEN_SINCE_VERSION) {
|
|
||||||
zdwl_ipc_output_v2_send_fullscreen(ipc_output->resource,
|
|
||||||
focused ? focused->isfullscreen : 0);
|
|
||||||
}
|
|
||||||
if (wl_resource_get_version(ipc_output->resource) >=
|
|
||||||
ZDWL_IPC_OUTPUT_V2_FLOATING_SINCE_VERSION) {
|
|
||||||
zdwl_ipc_output_v2_send_floating(ipc_output->resource,
|
|
||||||
focused ? focused->isfloating : 0);
|
|
||||||
}
|
|
||||||
if (wl_resource_get_version(ipc_output->resource) >=
|
|
||||||
ZDWL_IPC_OUTPUT_V2_X_SINCE_VERSION) {
|
|
||||||
zdwl_ipc_output_v2_send_x(ipc_output->resource,
|
|
||||||
focused ? focused->geom.x : 0);
|
|
||||||
}
|
|
||||||
if (wl_resource_get_version(ipc_output->resource) >=
|
|
||||||
ZDWL_IPC_OUTPUT_V2_Y_SINCE_VERSION) {
|
|
||||||
zdwl_ipc_output_v2_send_y(ipc_output->resource,
|
|
||||||
focused ? focused->geom.y : 0);
|
|
||||||
}
|
|
||||||
if (wl_resource_get_version(ipc_output->resource) >=
|
|
||||||
ZDWL_IPC_OUTPUT_V2_WIDTH_SINCE_VERSION) {
|
|
||||||
zdwl_ipc_output_v2_send_width(ipc_output->resource,
|
|
||||||
focused ? focused->geom.width : 0);
|
|
||||||
}
|
|
||||||
if (wl_resource_get_version(ipc_output->resource) >=
|
|
||||||
ZDWL_IPC_OUTPUT_V2_HEIGHT_SINCE_VERSION) {
|
|
||||||
zdwl_ipc_output_v2_send_height(ipc_output->resource,
|
|
||||||
focused ? focused->geom.height : 0);
|
|
||||||
}
|
|
||||||
if (wl_resource_get_version(ipc_output->resource) >=
|
|
||||||
ZDWL_IPC_OUTPUT_V2_LAST_LAYER_SINCE_VERSION) {
|
|
||||||
zdwl_ipc_output_v2_send_last_layer(ipc_output->resource,
|
|
||||||
monitor->last_open_surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wl_resource_get_version(ipc_output->resource) >=
|
|
||||||
ZDWL_IPC_OUTPUT_V2_KB_LAYOUT_SINCE_VERSION) {
|
|
||||||
zdwl_ipc_output_v2_send_kb_layout(ipc_output->resource, kb_layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wl_resource_get_version(ipc_output->resource) >=
|
|
||||||
ZDWL_IPC_OUTPUT_V2_KEYMODE_SINCE_VERSION) {
|
|
||||||
zdwl_ipc_output_v2_send_keymode(ipc_output->resource, keymode.mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wl_resource_get_version(ipc_output->resource) >=
|
|
||||||
ZDWL_IPC_OUTPUT_V2_SCALEFACTOR_SINCE_VERSION) {
|
|
||||||
zdwl_ipc_output_v2_send_scalefactor(ipc_output->resource,
|
|
||||||
monitor->wlr_output->scale * 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
zdwl_ipc_output_v2_send_frame(ipc_output->resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dwl_ipc_output_set_client_tags(struct wl_client *client,
|
|
||||||
struct wl_resource *resource,
|
|
||||||
uint32_t and_tags, uint32_t xor_tags) {
|
|
||||||
DwlIpcOutput *ipc_output;
|
|
||||||
Monitor *monitor = NULL;
|
|
||||||
Client *selected_client = NULL;
|
|
||||||
uint32_t newtags = 0;
|
|
||||||
|
|
||||||
ipc_output = wl_resource_get_user_data(resource);
|
|
||||||
if (!ipc_output)
|
|
||||||
return;
|
|
||||||
|
|
||||||
monitor = ipc_output->mon;
|
|
||||||
selected_client = focustop(monitor);
|
|
||||||
if (!selected_client)
|
|
||||||
return;
|
|
||||||
|
|
||||||
newtags = (selected_client->tags & and_tags) ^ xor_tags;
|
|
||||||
if (!newtags)
|
|
||||||
return;
|
|
||||||
|
|
||||||
selected_client->tags = newtags;
|
|
||||||
if (selmon == monitor)
|
|
||||||
focusclient(focustop(monitor), 1);
|
|
||||||
arrange(selmon, false, false);
|
|
||||||
printstatus(IPC_WATCH_ARRANGGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dwl_ipc_output_set_layout(struct wl_client *client,
|
|
||||||
struct wl_resource *resource, uint32_t index) {
|
|
||||||
DwlIpcOutput *ipc_output;
|
|
||||||
Monitor *monitor = NULL;
|
|
||||||
|
|
||||||
ipc_output = wl_resource_get_user_data(resource);
|
|
||||||
if (!ipc_output)
|
|
||||||
return;
|
|
||||||
|
|
||||||
monitor = ipc_output->mon;
|
|
||||||
if (index >= LENGTH(layouts))
|
|
||||||
index = 0;
|
|
||||||
|
|
||||||
monitor->pertag->ltidxs[monitor->pertag->curtag] = &layouts[index];
|
|
||||||
clear_fullscreen_and_maximized_state(monitor);
|
|
||||||
arrange(monitor, false, false);
|
|
||||||
printstatus(IPC_WATCH_ARRANGGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dwl_ipc_output_set_tags(struct wl_client *client,
|
|
||||||
struct wl_resource *resource, uint32_t tagmask,
|
|
||||||
uint32_t toggle_tagset) {
|
|
||||||
DwlIpcOutput *ipc_output;
|
|
||||||
Monitor *monitor = NULL;
|
|
||||||
uint32_t newtags = tagmask & TAGMASK;
|
|
||||||
|
|
||||||
ipc_output = wl_resource_get_user_data(resource);
|
|
||||||
if (!ipc_output)
|
|
||||||
return;
|
|
||||||
monitor = ipc_output->mon;
|
|
||||||
|
|
||||||
view_in_mon(&(Arg){.ui = newtags}, true, monitor, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dwl_ipc_output_quit(struct wl_client *client,
|
|
||||||
struct wl_resource *resource) {
|
|
||||||
quit(&(Arg){0});
|
|
||||||
}
|
|
||||||
|
|
||||||
void dwl_ipc_output_dispatch(struct wl_client *client,
|
|
||||||
struct wl_resource *resource, const char *dispatch,
|
|
||||||
const char *arg1, const char *arg2,
|
|
||||||
const char *arg3, const char *arg4,
|
|
||||||
const char *arg5) {
|
|
||||||
|
|
||||||
int32_t (*func)(const Arg *);
|
|
||||||
Arg arg;
|
|
||||||
func = parse_func_name((char *)dispatch, &arg, (char *)arg1, (char *)arg2,
|
|
||||||
(char *)arg3, (char *)arg4, (char *)arg5);
|
|
||||||
if (func) {
|
|
||||||
func(&arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arg.v)
|
|
||||||
free(arg.v);
|
|
||||||
if (arg.v2)
|
|
||||||
free(arg.v2);
|
|
||||||
if (arg.v3)
|
|
||||||
free(arg.v3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dwl_ipc_output_release(struct wl_client *client,
|
|
||||||
struct wl_resource *resource) {
|
|
||||||
wl_resource_destroy(resource);
|
|
||||||
}
|
|
||||||
|
|
@ -583,7 +583,6 @@ struct Monitor {
|
||||||
uint32_t resizing_count_pending;
|
uint32_t resizing_count_pending;
|
||||||
uint32_t resizing_count_current;
|
uint32_t resizing_count_current;
|
||||||
|
|
||||||
struct wl_list dwl_ipc_outputs;
|
|
||||||
int32_t gappih; /* horizontal gap between windows */
|
int32_t gappih; /* horizontal gap between windows */
|
||||||
int32_t gappiv; /* vertical gap between windows */
|
int32_t gappiv; /* vertical gap between windows */
|
||||||
int32_t gappoh; /* horizontal outer gaps */
|
int32_t gappoh; /* horizontal outer gaps */
|
||||||
|
|
@ -3438,8 +3437,6 @@ void createmon(struct wl_listener *listener, void *data) {
|
||||||
m->wlr_output = wlr_output;
|
m->wlr_output = wlr_output;
|
||||||
m->wlr_output->data = m;
|
m->wlr_output->data = m;
|
||||||
|
|
||||||
wl_list_init(&m->dwl_ipc_outputs);
|
|
||||||
|
|
||||||
for (i = 0; i < LENGTH(m->layers); i++)
|
for (i = 0; i < LENGTH(m->layers); i++)
|
||||||
wl_list_init(&m->layers[i]);
|
wl_list_init(&m->layers[i]);
|
||||||
|
|
||||||
|
|
@ -6105,7 +6102,6 @@ void handle_print_status(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
dwl_ext_workspace_printstatus(m);
|
dwl_ext_workspace_printstatus(m);
|
||||||
dwl_ipc_output_printstatus(m);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6470,9 +6466,6 @@ void setup(void) {
|
||||||
wlr_log(WLR_INFO, "VR will not be available.");
|
wlr_log(WLR_INFO, "VR will not be available.");
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_global_create(dpy, &zdwl_ipc_manager_v2_interface, 2, NULL,
|
|
||||||
dwl_ipc_manager_bind);
|
|
||||||
|
|
||||||
// 创建顶层管理句柄
|
// 创建顶层管理句柄
|
||||||
foreign_toplevel_manager = wlr_foreign_toplevel_manager_v1_create(dpy);
|
foreign_toplevel_manager = wlr_foreign_toplevel_manager_v1_create(dpy);
|
||||||
struct wlr_xdg_foreign_registry *foreign_registry =
|
struct wlr_xdg_foreign_registry *foreign_registry =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue