Module: cwc.screen
Low-Level API to manage output and the tag/workspace system
See also:
Info:
- Copyright: 2024
- License: GPLv3
-
Originally authored by: Dwi Asmoro Bangun
(Full contributors list available on our github project)
Static module functions
cwc.screen.get () -> cwc_screen[] | Get all screen in the server. | |
cwc.screen.focused () -> cwc_screen | Get current focused screen. | |
cwc.screen.at (x, y) -> cwc_screen | Get screen at specified coordinates. | |
cwc.screen.get_max_workspace () -> integer | Get maximum workspace the compositor can handle. |
Config functions
cwc.screen.set_useless_gaps () | Set useless gaps width. |
Object properties
geometry | table | The screen coordinates in the global position. | Read only |
width | integer | The screen width. | Read only |
height | integer | The screen height. | Read only |
refresh | integer | The screen refresh rate in mHz (may be zero). | Read only |
phys_width | integer | The screen physical width in mm. | Read only |
phys_height | integer | The screen physical height in mm. | Read only |
scale | number | The screen scale. | Read only |
name | string | The name of the screen. | Read only |
description | string | The description of the screen (may be empty). | Read only |
make | string | The make of the screen (may be empty). | Read only |
model | string | The model of the screen (may be empty). | Read only |
serial | string | The serial of the screen (may be empty). | Read only |
enabled | boolean | The screen enabled state. | Read only |
non_desktop | boolean | The screen is non desktop or not. | Read only |
restored | boolean | The screen is restored or not. | Read only |
selected_tag | cwc_tag | The current selected tag of the screen. | Read only |
workarea | table | The workarea/usable area of the screen. | Read only |
allow_tearing | boolean | Whether to allow screen to tear or not. | |
active_tag | integer | Bitfield of currently activated tags. | |
active_workspace | integer | The index of the selected_tag. | |
max_general_workspace | integer | Maximum general workspace (workspaces that will be shown in the bar). |
Object methods
:get_containers (visible) -> cwc_container[] | Get containers in this screen. | |
:get_clients (visible) -> cwc_client[] | Get toplevels/clients in this screen. | |
:get_focus_stack (visible) -> cwc_client[] | get focus stack in the output | |
:get_minimized (visible) -> cwc_client[] | get minimized stack in the output. | |
:get_tag (idx) -> cwc_tag | Get tag with using the specified index. | |
:get_nearest (direction) -> cwc_screen | Get nearest screen relative to this screen. | |
:set_position (x, y) | Set the screen position in the global coordinate. | |
:set_mode (width, height, refresh) | Set the screen mode (commit to apply). | |
:set_adaptive_sync (enable) | Set adaptive sync (commit to apply). | |
:set_enabled (enable) | Set output enabled state (commit to apply). | |
:set_scale (scale) | Set output scale (commit to apply). | |
:set_transform (enum) | Set output transform rotation (commit to apply). | |
:commit () -> boolean | Commit pending state. | |
:focus () | Focus this screen. |
Signals
screen::new | Emitted when a screen is added. | |
screen::destroy | Emitted when a screen is about to be removed. | |
screen::prop::active_tag | Property signal. | |
screen::prop::active_workspace | Property signal. | |
screen::prop::selected_tag | Property signal. |
Static module functions
- 🔗 cwc.screen.get () -> cwc_screen[]
-
Get all screen in the server.
Returns:
-
cwc_screen[]
- 🔗 cwc.screen.focused () -> cwc_screen
-
Get current focused screen.
Returns:
-
cwc_screen
- 🔗 cwc.screen.at (x, y) -> cwc_screen
-
Get screen at specified coordinates.
Parameters:
Name Type(s) Description x integer X coordinates y integer Y coordinates Returns:
-
cwc_screen
- 🔗 cwc.screen.get_max_workspace () -> integer
-
Get maximum workspace the compositor can handle.
Returns:
-
integer
count
Config functions
- 🔗 cwc.screen.set_useless_gaps ()
- Set useless gaps width.
Object properties
- 🔗 geometry table · read only
-
The screen coordinates in the global position.
Constraints:
Table keys: x (integer) y (integer) width (integer) height (integer) - 🔗 width integer · read only
-
The screen width.
Constraints:
Default value : Extracted from wlr_output. Negative allowed : false - 🔗 height integer · read only
-
The screen height.
Constraints:
Default value : Extracted from wlr_output. Negative allowed : false - 🔗 refresh integer · read only
-
The screen refresh rate in mHz (may be zero).
Constraints:
Default value : Extracted from wlr_output. Negative allowed : false - 🔗 phys_width integer · read only
-
The screen physical width in mm.
Constraints:
Default value : Extracted from wlr_output. Negative allowed : false - 🔗 phys_height integer · read only
-
The screen physical height in mm.
Constraints:
Default value : Extracted from wlr_output. Negative allowed : false - 🔗 scale number · read only
-
The screen scale.
Constraints:
Default value : Extracted from wlr_output. Negative allowed : false - 🔗 name string · read only
-
The name of the screen.
Constraints:
Default value : screen name extracted from wlr_output. - 🔗 description string · read only
-
The description of the screen (may be empty).
Constraints:
Default value : screen description extracted from wlr_output. - 🔗 make string · read only
-
The make of the screen (may be empty).
Constraints:
Default value : screen make extracted from wlr_output. - 🔗 model string · read only
-
The model of the screen (may be empty).
Constraints:
Default value : screen model extracted from wlr_output. - 🔗 serial string · read only
-
The serial of the screen (may be empty).
Constraints:
Default value : screen serial extracted from wlr_output. - 🔗 enabled boolean · read only
-
The screen enabled state.
Constraints:
Default value : screen enabled state extracted from wlr_output. Valid values : true
orfalse
. - 🔗 non_desktop boolean · read only
-
The screen is non desktop or not.
Constraints:
Default value : Extracted from wlr_output. Valid values : true
orfalse
. - 🔗 restored boolean · read only
-
The screen is restored or not.
Constraints:
Default value : false
Valid values : true
orfalse
. - 🔗 selected_tag cwc_tag · read only
-
The current selected tag of the screen.
If there are 2 or more activated tags, the compositor will use this tag to get information such as gaps, layout mode or master factor.
Constraints:
Default value : the last tag that set by view_only. See also:
active_workspace The index of the selected_tag. object properties cwc_tag:view_only Set this tag as the only selected tag. (cwc_tag) object methods - 🔗 workarea table · read only
-
The workarea/usable area of the screen.
Constraints:
Default value : screen dimension. Table keys: x (integer) y (integer) width (integer) height (integer) Negative allowed : false - 🔗 allow_tearing boolean
-
Whether to allow screen to tear or not.
Constraints:
Default value : false
Valid values : true
orfalse
.See also:
cwc.client.allow_tearing Allow the client to tear when in fullscreen. (cwc.client) object properties - 🔗 active_tag integer
-
Bitfield of currently activated tags.
Constraints:
Default value : Current active tags. Negative allowed : false - 🔗 active_workspace integer
-
The index of the selected_tag.
Constraints:
Default value : Current active workspace. Negative allowed : false See also:
selected_tag The current selected tag of the screen. object properties - 🔗 max_general_workspace integer
-
Maximum general workspace (workspaces that will be shown in the bar).
Constraints:
Default value : 9 Minimum value : 1
Object methods
- 🔗 :get_containers (visible) -> cwc_container[]
-
Get containers in this screen.
Ordered by time the container created (first item is newest to oldest).
Parameters:
Name Type(s) Description Default value visible Optional bool Whether get only the visible containers false
Returns:
-
cwc_container[]
array of container
- 🔗 :get_clients (visible) -> cwc_client[]
-
Get toplevels/clients in this screen.
Ordered by time the toplevel mapped (first item is newest to oldest).
Parameters:
Name Type(s) Description Default value visible Optional bool Whether get only the visible toplevel false
Returns:
-
cwc_client[]
array of toplevels
- 🔗 :get_focus_stack (visible) -> cwc_client[]
-
get focus stack in the output
Parameters:
Name Type(s) Description Default value visible Optional bool Whether get only the visible toplevel false
Returns:
-
cwc_client[]
array of toplevels
- 🔗 :get_minimized (visible) -> cwc_client[]
-
get minimized stack in the output.
The order is newest minimized to oldest.
Parameters:
Name Type(s) Description Default value visible Optional bool Whether to use active_tag as filter false
Returns:
-
cwc_client[]
array of toplevels
- 🔗 :get_tag (idx) -> cwc_tag
-
Get tag with using the specified index.
Parameters:
Name Type(s) Description idx integer Index of the tag. Returns:
-
cwc_tag
- 🔗 :get_nearest (direction) -> cwc_screen
-
Get nearest screen relative to this screen.
Parameters:
Name Type(s) Description direction integer Direction enum Returns:
-
cwc_screen
See also:
cuteful.enum.direction Extracted from wlr_direction wlr_output_layout.h
(cuteful.enum)tables - 🔗 :set_position (x, y)
-
Set the screen position in the global coordinate.
Parameters:
Name Type(s) Description x integer Horizontal position y integer Vertical position - 🔗 :set_mode (width, height, refresh)
-
Set the screen mode (commit to apply).
Parameters:
Name Type(s) Description Default value width integer Not applicable height integer Not applicable refresh Optional integer Monitor refresh rate in hz 0
See also:
commit Commit pending state. object methods - 🔗 :set_adaptive_sync (enable)
-
Set adaptive sync (commit to apply).
Parameters:
Name Type(s) Description enable boolean True to enable See also:
commit Commit pending state. object methods - 🔗 :set_enabled (enable)
-
Set output enabled state (commit to apply).
Parameters:
Name Type(s) Description enable boolean True to enable See also:
commit Commit pending state. object methods - 🔗 :set_scale (scale)
-
Set output scale (commit to apply).
Parameters:
Name Type(s) Description scale number See also:
commit Commit pending state. object methods - 🔗 :set_transform (enum)
-
Set output transform rotation (commit to apply).
Parameters:
Name Type(s) Description enum integer Output transform enum See also:
cuteful.enum.output_transform Extracted from wayland-server-protocol.h
(cuteful.enum)tables commit Commit pending state. object methods - 🔗 :commit () -> boolean
-
Commit pending state.
Returns:
-
boolean
success Commit result.
- 🔗 :focus ()
- Focus this screen.
Signals
- 🔗 screen::new
-
Emitted when a screen is added.
Arguments:
Name Type(s) Description s cwc_screen The screen object. - 🔗 screen::destroy
-
Emitted when a screen is about to be removed.
Arguments:
Name Type(s) Description s cwc_screen The screen object. - 🔗 screen::prop::active_tag
-
Property signal.
Arguments:
Name Type(s) Description s cwc_screen The screen object. - 🔗 screen::prop::active_workspace
-
Property signal.
Arguments:
Name Type(s) Description s cwc_screen The screen object. - 🔗 screen::prop::selected_tag
-
Property signal.
Arguments:
Name Type(s) Description s cwc_screen The screen object.