Module: cwc.client
Low-level API to manage toplevel/window/client.
If a client is in container with more than one client only topfront client that will emit property signal.
See also: cuteful.client
Info:
- Copyright: 2024
- License: GPLv3
-
Originally authored by: Dwi Asmoro Bangun
(Full contributors list available on our github project)
Static module functions
cwc.client.get (screen, skip_unmanaged) -> cwc_client[] | Get all clients into a table. | |
cwc.client.at (x, y) -> cwc_client | Get client at x y coordinates. | |
cwc.client.focused () -> cwc_client | Get currently focused client. |
Config functions
cwc.client.set_border_width (width) | Set the default border thickness. | |
cwc.client.set_border_color_focus (cairo_pattern_t) | Set the default border color for focused client. | |
cwc.client.set_border_color_normal (cairo_pattern_t) | Set the default border color for toplevel. | |
cwc.client.set_border_color_rotation (degree) | Set the border color rotation config in degree |
Object properties
mapped | boolean | The client is mapped on the screen or not. | Read only |
visible | boolean | The client is visible/rendered on the screen or not. | Read only |
x11 | boolean | The client is xwayland or not. | Read only |
unmanaged | boolean | The client is unmanaged or not. | Read only |
fullscreen | boolean | The client fullscreen state. | |
maximized | boolean | The client maximized state. | |
floating | boolean | The client floating state. | |
minimized | boolean | The client minimized state. | |
sticky | boolean | Set the client sticky (Available on all tags). | |
ontop | boolean | The client is on top of every other window. | |
above | boolean | The client is above normal window. | |
below | boolean | The client is below normal window. | |
allow_tearing | boolean | Allow the client to tear when in fullscreen. | |
geometry | table | Geometry of the client (border not included). | |
tag | integer | The client tag. | |
workspace | integer | The client workspace. | |
opacity | number | The client opacity. | |
parent | cwc_client | The client parent. | Read only |
screen | cwc_screen | The screen where the client stay. | Read only |
pid | string | The client pid. | Read only |
title | string | The client title. | Read only |
appid | string | The client app_id. | Read only |
container | cwc_container | The client container. | Read only |
Object methods
:resize (width, height) | Resize client relative to current size. | |
:resize_to (width, width) | Resize client to specified size. | |
:move (x, y) | Move client relative to current position. | |
:move_to (x, y) | Move client to the x y coordinates. | |
:close () | Request to close a client. | |
:kill () | Kill a client without any question asked. | |
:raise () | Raise toplevel to top of other toplevels. | |
:lower () | Lower toplevel to bottom of other toplevels. | |
:focus () | Set a keyboard focus for a client. | |
:swap () | Swap client with another client. | |
:center () | Centerize the client according to the screen workarea. | |
:move_to_tag (tag) | Move client to specified tag index. | |
:get_nearest (enum) -> cwc_client | Get nearest client relative to this client. | |
:toggle_split () | Toggle vsplit to hsplit or otherwise for bsp layout. | |
:toggle_tag (idx) | Toggle enable or disable a tag. |
Signals
client::new | Emitted when a client is created. | |
client::destroy | Emitted when a client is about to be destroyed. | |
client::map | Emitted when a client is mapped to the screen. | |
client::unmap | Emitted when a client is about to be unmapped from the screen. | |
client::focus | Emitted when a client gains focus. | |
client::unfocus | Emitted when a client lost focus. | |
client::swap | Emitted when a client is swapped. | |
client::mouse_enter | Emitted when the mouse enters a client. | |
client::mouse_leave | Emitted when the mouse leaves a client. | |
client::raised | Emitted when the client is raised within its layer. | |
client::lowered | Emitted when the client is lowered within its layer. | |
client::property::fullscreen | Property signal. | |
client::property::maximized | Property signal. | |
client::property::minimized | Property signal. | |
client::property::floating | Property signal. |
Static module functions
- 🔗 cwc.client.get (screen, skip_unmanaged) -> cwc_client[]
-
Get all clients into a table.
Parameters:
Name Type(s) Description Default value screen Optional cwc_screen A screen to filter clients on. Undefined skip_unmanaged Optional boolean Skip unmanaged client (xwayland popup etc.). true
Returns:
-
cwc_client[]
- 🔗 cwc.client.at (x, y) -> cwc_client
-
Get client at x y coordinates.
Parameters:
Name Type(s) Description x integer X coordinate y integer Y coordinate Returns:
-
cwc_client
- 🔗 cwc.client.focused () -> cwc_client
-
Get currently focused client.
Returns:
-
cwc_client
Config functions
- 🔗 cwc.client.set_border_width (width)
-
Set the default border thickness.
Parameters:
Name Type(s) Description width integer Width in pixels - 🔗 cwc.client.set_border_color_focus (cairo_pattern_t)
-
Set the default border color for focused client.
Parameters:
Name Type(s) Description cairo_pattern_t pattern Cairo pattern object from gears.color See also:
gears.color This module simplifies the creation of cairo pattern objects. module - 🔗 cwc.client.set_border_color_normal (cairo_pattern_t)
-
Set the default border color for toplevel.
Parameters:
Name Type(s) Description cairo_pattern_t pattern Cairo pattern object from gears.color See also:
gears.color This module simplifies the creation of cairo pattern objects. module - 🔗 cwc.client.set_border_color_rotation (degree)
-
Set the border color rotation config in degree
Parameters:
Name Type(s) Description degree integer Rotation in degree
Object properties
- 🔗 mapped boolean · read only
-
The client is mapped on the screen or not.
Constraints:
Default value : Depends on the client state. Valid values : true
orfalse
. - 🔗 visible boolean · read only
-
The client is visible/rendered on the screen or not.
Constraints:
Default value : true
Valid values : true
orfalse
. - 🔗 x11 boolean · read only
-
The client is xwayland or not.
Constraints:
Default value : Depends on the client. Valid values : true
orfalse
. - 🔗 unmanaged boolean · read only
-
The client is unmanaged or not.
Constraints:
Default value : Depends on the client. Valid values : true
orfalse
. - 🔗 fullscreen boolean
-
The client fullscreen state.
Constraints:
Default value : false
Valid values : true
orfalse
.See also:
maximized The client maximized state. object properties - 🔗 maximized boolean
-
The client maximized state.
Constraints:
Default value : false
Valid values : true
orfalse
.See also:
fullscreen The client fullscreen state. object properties - 🔗 floating boolean
-
The client floating state.
Always return true if the layout mode is floating.
Constraints:
Default value : false
Valid values : true
orfalse
. - 🔗 minimized boolean
-
The client minimized state.
Constraints:
Default value : false
Valid values : true
orfalse
. - 🔗 sticky boolean
-
Set the client sticky (Available on all tags).
Constraints:
Default value : false
Valid values : true
orfalse
. - 🔗 ontop boolean
-
The client is on top of every other window.
Constraints:
Default value : false
Valid values : true
orfalse
. - 🔗 above boolean
-
The client is above normal window.
Constraints:
Default value : false
Valid values : true
orfalse
. - 🔗 below boolean
-
The client is below normal window.
Constraints:
Default value : false
Valid values : true
orfalse
. - 🔗 allow_tearing boolean
-
Allow the client to tear when in fullscreen.
Constraints:
Default value : false
Valid values : true
orfalse
.See also:
cwc.screen.allow_tearing Whether to allow screen to tear or not. (cwc.screen) object properties - 🔗 geometry table
-
Geometry of the client (border not included).
Constraints:
Default value : current client geometry with structure {x,y,width,height}. Table keys: x (integer) y (integer) width (integer) height (integer) See also:
cwc.container.geometry Geometry of the container. (cwc.container) object properties - 🔗 tag integer
-
The client tag.
Constraints:
Default value : the active tag when the client is mapped. Negative allowed : false - 🔗 workspace integer
-
The client workspace.
Constraints:
Default value : the active workspace when the client is mapped. Negative allowed : false - 🔗 opacity number
-
The client opacity.
Constraints:
Default value : 1.0
Minimum value : 0.0 Maximum value : 1.0 - 🔗 parent cwc_client · read only
-
The client parent.
Constraints:
Default value : nil
. - 🔗 screen cwc_screen · read only
-
The screen where the client stay.
Constraints:
Default value : The screen where the top left corner client placed. - 🔗 pid string · read only
-
The client pid.
Constraints:
Default value : This is provided by the application. - 🔗 title string · read only
-
The client title.
Constraints:
Default value : This is provided by the application. - 🔗 appid string · read only
-
The client app_id.
Constraints:
Default value : This is provided by the application. - 🔗 container cwc_container · read only
-
The client container.
Constraints:
Default value : the container that client attached to.
Object methods
- 🔗 :resize (width, height)
-
Resize client relative to current size.
Parameters:
Name Type(s) Description width integer Current width + specified width height integer Current height + specified height - 🔗 :resize_to (width, width)
-
Resize client to specified size.
Parameters:
Name Type(s) Description width number Desired height width number Desired height - 🔗 :move (x, y)
-
Move client relative to current position.
Parameters:
Name Type(s) Description x integer X coordinate y integer Y coordinate - 🔗 :move_to (x, y)
-
Move client to the x y coordinates.
Parameters:
Name Type(s) Description x integer X coordinate y integer Y coordinate - 🔗 :close ()
- Request to close a client.
- 🔗 :kill ()
- Kill a client without any question asked.
- 🔗 :raise ()
- Raise toplevel to top of other toplevels.
- 🔗 :lower ()
- Lower toplevel to bottom of other toplevels.
- 🔗 :focus ()
- Set a keyboard focus for a client.
- 🔗 :swap ()
- Swap client with another client.
- 🔗 :center ()
- Centerize the client according to the screen workarea.
- 🔗 :move_to_tag (tag)
-
Move client to specified tag index.
Equivalent as setting the workspace property.
Parameters:
Name Type(s) Description tag integer Tag index See also:
workspace The client workspace. object properties - 🔗 :get_nearest (enum) -> cwc_client
-
Get nearest client relative to this client.
Parameters:
Name Type(s) Description enum integer Direction Returns:
-
cwc_client
See also:
cuteful.enum.direction Extracted from wlr_direction wlr_output_layout.h
(cuteful.enum)tables - 🔗 :toggle_split ()
- Toggle vsplit to hsplit or otherwise for bsp layout.
- 🔗 :toggle_tag (idx)
-
Toggle enable or disable a tag.
Parameters:
Name Type(s) Description idx integer Tag position
Signals
- 🔗 client::new
-
Emitted when a client is created.
Client operation such as moving, resizing, etc. is not yet possible at this stage and will trigger segfault, only read only property may be available. If you want to do client transformation with the client wait for map signal to appear.
Arguments:
Name Type(s) Description c cwc_client The client object. See also:
map Emitted when a client is mapped to the screen. signals - 🔗 client::destroy
-
Emitted when a client is about to be destroyed.
Arguments:
Name Type(s) Description c cwc_client The client object. - 🔗 client::map
-
Emitted when a client is mapped to the screen.
Arguments:
Name Type(s) Description c cwc_client The client object. - 🔗 client::unmap
-
Emitted when a client is about to be unmapped from the screen.
Arguments:
Name Type(s) Description c cwc_client The client object. - 🔗 client::focus
-
Emitted when a client gains focus.
Unmanaged client won't emit.
Arguments:
Name Type(s) Description c cwc_client The client object. - 🔗 client::unfocus
-
Emitted when a client lost focus.
Unmanaged client won't emit.
Arguments:
Name Type(s) Description c cwc_client The client object. - 🔗 client::swap
-
Emitted when a client is swapped.
Arguments:
Name Type(s) Description c1 cwc_client The client object. c2 cwc_client The client object. - 🔗 client::mouse_enter
-
Emitted when the mouse enters a client.
Arguments:
Name Type(s) Description c cwc_client The client object. - 🔗 client::mouse_leave
-
Emitted when the mouse leaves a client.
Arguments:
Name Type(s) Description c cwc_client The client object. - 🔗 client::raised
-
Emitted when the client is raised within its layer.
Arguments:
Name Type(s) Description c cwc_client The client object. - 🔗 client::lowered
-
Emitted when the client is lowered within its layer.
Arguments:
Name Type(s) Description c cwc_client The client object. - 🔗 client::property::fullscreen
-
Property signal.
Arguments:
Name Type(s) Description c cwc_client The client object. - 🔗 client::property::maximized
-
Property signal.
Arguments:
Name Type(s) Description c cwc_client The client object. - 🔗 client::property::minimized
-
Property signal.
Arguments:
Name Type(s) Description c cwc_client The client object. - 🔗 client::property::floating
-
Property signal.
Arguments:
Name Type(s) Description c cwc_client The client object.