Getting Started
Getting started with cwc.
Basic concept
Tag system
CwC is using dwm tag model rather than like in Awesome where the tag is a 32 bit bitfield which mean it's limited to 30 tags but it should be enough for most people I think. The tags is integrated to the screen so the tags is independent across screens and since it's integrated, all the tag operation is on the screen object when using lua or C api. The tag and workspace in this guide may be used interchangeably.
Layout system
The layout system is similar like in Awesome with the difference in cwc is that it's grouped.
The grouping is called layout mode
with the layout options is called strategy
,
there are 3 modes which is floating
, master/stack
, and bsp
.
This allow cwc to act like traditional floating/stacking window manager,
Awesome layout style, and bspwm tiling mode.
Strategy:
Floating
- Currently there are none.Master/stack
- Tiled [left], monocle, fullscreen (via flayout plugin).BSP
- Longest side scheme insertion.
The layout mode
can be changed at runtime by pressing Super + Space
and
to change the strategy
is by pressing Super + Control + Space
.
The client
The client or window or toplevel in wayland terms is a surface that can be transformed by the user such as fullscreen, maximizing, minimizing, resizing, etc.
The screen
The screen or output in wayland terms is a device that describes part of the compositor geometry.
The container
The container basically a group of client overlapping each other inside a rectangular area. It's can be used to simulate window swallowing or tabbed layout. Every client operation like resizing will be reflected to every client in the container.
To try it, use Super + T
to mark current focused container then open any application it
will be inserted to the marked container. To switch view between clients in the container
press Super + Tab
and Super + Shift + Tab
, this concept is taken from tabbing in browser.
Signals
The compositor may emit a signal when an event occurs. CwC doesn't have per object signal like in
Awesome because it's simpler to manage between lua script and C plugins so every signal is need
to be subscribed by using cwc.connect_signal, to unsubscribe use cwc.disconnect_signal,
and to notify use cwc.emit_signal. To mimic per object signal cwc use format like object::eventname
where object will be passed as first argument in the callback function. For example when
a client is mapped to the screen, it emits client::map
signal.
Lua configuration
CwC will search lua configuration in $XDG_CONFIG_HOME/cwc/rc.lua
or ~/.config/cwc/rc.lua
,
if both path are not exist or contain an error cwc will load the default lua configuration.
The default configuration is the best way to learn the lua API.
The entry point located at defconfig/rc.lua
from the project root directory,
there's explanation how things working.
If the comments still unclear or wrong feel free to open an issue.
Here is some highlight of common things in the lua configuration.
Configuration can be reloaded by calling cwc.reload, to check whether the configuration is triggered by cwc.reload, use cwc.is_startup.
-- execute oneshot.lua once, cwc.is_startup() mark that the configuration is loaded for the first time if cwc.is_startup() then require("oneshot") end
To create a keybinding, use cwc.pointer.bind for mouse buttons and use cwc.kbd.bind for keyboard buttons.
local cful = require("cuteful") local MODKEY = cful.enum.modifier.LOGO -- mouse pointer.bind({ MODKEY }, button.LEFT, pointer.move_interactive) -- keyboard kbd.bind({ MODKEY }, "j", function() local c = cwc.client.focused() if c then local near = c:get_nearest(direction.DOWN) if near then near:focus() end end end, { description = "focus down" })
Some of the object has function for configuration, to set a configuration just call the function with value you want to set. Here is an example when user want to set mouse sensitivity to very low with keyboard repeat rate to 30hz and set the normal client border to dark grey.
cwc.pointer.set_sensitivity(-0.75) -- between -1 and 1 cwc.kbd.set_repeat_rate(30) local gears = require("gears") cwc.client.set_border_color_normal(gears.color("#423e44")) -- plugin specific settings config, check if such a plugin exist first if cwc.cwcle then cwc.cwcle.set_border_color_raised(gears.color("#d2d6f9")) end
Default Keybinding
cwc
Super + Control + Delete
exit cwcSuper + Control + r
reload configurationSuper + Delete
trigger lua garbage collectionSuper + Escape
reset leftover server state
client
Alt + Shift + Tab
cycle previous clientAlt + Tab
cycle next clientSuper + Control + 0
toggle client always visibleSuper + Control + j
focus next client relative by indexSuper + Control + k
focus previous client by indexSuper + Control + m
maximize horizontallySuper + Control + n
restore minimized clientSuper + Control + q
close client forcefullySuper + Control + Return
promote focused client to masterSuper + Down
move client downwardSuper + f
toggle fullscreenSuper + h
focus leftSuper + i
toggle client above normal toplevelSuper + j
focus downSuper + k
focus upSuper + Left
move client to the leftSuper + l
focus rightSuper + m
toggle maximizeSuper + n
minimize clientSuper + o
toggle client always on topSuper + Right
move client to the rightSuper + Shift + Down
increase client heightSuper + Shift + j
swap with next client by indexSuper + Shift + k
swap with previous client by indexSuper + Shift + Left
reduce client widthSuper + Shift + m
maximize verticallySuper + Shift + q
close client respectfullySuper + Shift + Right
increase client widthSuper + Shift + space
toggle floatingSuper + Shift + Tab
cycle prev to toplevel inside containerSuper + Shift + Up
reduce client heightSuper + Tab
cycle next to toplevel inside containerSuper + t
mark insert container from the focused clientSuper + Up
move client upwardSuper + u
toggle client under normal toplevel
launcher
Super + F1
open a web browserSuper + p
application launcherSuper + Print
screenshot entire screenSuper + Return
open a terminalSuper + Shift + s
snipping toolSuper + v
clipboard history
layout
Super + Control + Shift + space
cycle to previous strategy in focused screenSuper + Control + space
cycle to next strategy in focused screenSuper + equal
increase gapsSuper + e
toggle bsp splitSuper + minus
decrease gapsSuper + space
cycle to next layout mode in focused screen
tag
Super + 1
view tag #1Super + 2
view tag #2Super + 3
view tag #3Super + 4
view tag #4Super + 5
view tag #5Super + 6
view tag #6Super + 7
view tag #7Super + 8
view tag #8Super + 9
view tag #9Super + comma
view next workspace/tagSuper + period
view prev workspace/tagSuper + Control + 1
toggle tag #1Super + Control + 2
toggle tag #2Super + Control + 3
toggle tag #3Super + Control + 4
toggle tag #4Super + Control + 5
toggle tag #5Super + Control + 6
toggle tag #6Super + Control + 7
toggle tag #7Super + Control + 8
toggle tag #8Super + Control + 9
toggle tag #9Super + Control + Shift + 1
toggle focused client on tag #1Super + Control + Shift + 2
toggle focused client on tag #2Super + Control + Shift + 3
toggle focused client on tag #3Super + Control + Shift + 4
toggle focused client on tag #4Super + Control + Shift + 5
toggle focused client on tag #5Super + Control + Shift + 6
toggle focused client on tag #6Super + Control + Shift + 7
toggle focused client on tag #7Super + Control + Shift + 8
toggle focused client on tag #8Super + Control + Shift + 9
toggle focused client on tag #9Super + Shift + 1
move focused client to tag #1Super + Shift + 2
move focused client to tag #2Super + Shift + 3
move focused client to tag #3Super + Shift + 4
move focused client to tag #4Super + Shift + 5
move focused client to tag #5Super + Shift + 6
move focused client to tag #6Super + Shift + 7
move focused client to tag #7Super + Shift + 8
move focused client to tag #8Super + Shift + 9
move focused client to tag #9