Getting Started
Getting started with CwC.
Basic concept
Tag system
In CwC, every window can have multiple tags. Tags are implemented as a 32 bit field (similar to dwm) which means there can be at most 30 tags. Since tags are tied to specific screens / monitors, tag operations happen on the screen objects when using the lua or C API. In this guide the words tag and workspace may be used interchangeably.
Layout system
CwC's layout system is similar to Awesome but in CwC, layouts are grouped into multiple layout modes.
In a single layout mode there are multiple strategys.
Currently there are three: layout modes with varying strategys:
floating(Traditional): Currently there are no strategies of this mode.master(Awesome layout style): Tiled [left], monocle, fullscreen (via flayout plugin).bsp: (bspwm tiling mode): Longest side scheme insertion.
The layout mode can be changed at runtime by pressing Super + Space and
the strategy can be changed by pressing Super + Control + Space.
The client
Every window or client (or toplevel in wayland terms) is a surface that can be transformed by the user. These transformations are things like full screening, 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
A container is a group of clients which live inside of a single rectangular area.
Only one client out of the group is displayed at a time. Cycle to the next / previous client in the group by pressing
Super + Tab or Super + Shift + Tab.
This can be used to simulate window swallowing or a tabbed layout. Every client operation like resizing
will be applied to every client in the container.
To try it, use Super + T to mark currently focused container, then open any application.
The new client will be inserted to the marked container.
Signals
The compositor may emit a signal when an event occurs. CwC doesn't have per object signals like
Awesome. This makes it simpler to coordinate between lua script and C plugins.
One can subscribe to a signal by using cwc.connect_signal, to unsubscribe use cwc.disconnect_signal,
and to notify use cwc.emit_signal. To mimic per object signals, CwC uses the following format: object::eventname
object will be passed as the first argument to the callback function. For example when
a client is mapped to the screen, it emits a client::map signal.
Lua configuration
CwC will search for lua files 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 is located at defconfig/rc.lua from the project root directory.
There are code comments that explain how things work.
If the comments are 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 keybindings, use cwc.kbd.bind; for mouse buttons, use cwc.pointer.bind.
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 have functions 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, keyboard repeat rate to 30hz, and set the normal client border to dark grey.
cwc.pointer.set_cursor_size(24) -- how quickly additional keypress event are send when holding down a key 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
Or better yet using the declarative config like so. The script below is equivalent to the one above.
---- ./conf.lua ---- local gears = require("gears") local conf = { cursor_size = 24, repeat_rate = 30, border_color_normal = gears.color(gears.color("#423e44")) border_color_raised = gears.color(gears.color("#d2d6f9")) } return conf ---- ./rc.lua ---- local config = require("config") -- config.init should go first before anything else config.init(require("conf")) -- rest of script...
Before starting CwC run cwc --check to check if there are any errors in your configuration,
so your not staring at a confusing blank screen.
If there is ever a problem and you cant exit CwC with Super + CTRL + Delete,
you can switch to a different tty by pressing CTRL + ALT + (F1-F6) where N is the tty number.
Default Keybindings
cwc
Super + CTRL + Deleteexit cwcSuper + CTRL + rreload configurationSuper + Deletetrigger lua garbage collectionSuper + Escapereset leftover server state
layout
Super + ALT + hdecrease master/bsp width factorSuper + ALT + lincrease master/bsp width factorSuper + CTRL + SHIFT + spacecycle to previous strategy in focused screenSuper + CTRL + hincrease the number of columnsSuper + CTRL + ldecrease the number of columnsSuper + CTRL + spacecycle to next strategy in focused screenSuper + SHIFT + hincrease the number of master clientsSuper + SHIFT + ldecrease the number of master clientsSuper + etoggle bsp splitSuper + equalincrease gapsSuper + minusdecrease gapsSuper + spacecycle to next layout mode in focused screen
screen
Super + bracketleftfocus the previous screenSuper + bracketrightfocus the next screen
keymap
Super + wactivate client vim movement keymap
client
ALT + SHIFT + Tabcycle previous clientALT + Tabcycle next clientSuper + CTRL + 0toggle client always visibleSuper + CTRL + Returnpromote focused client to masterSuper + CTRL + jfocus next client relative by indexSuper + CTRL + kfocus previous client by indexSuper + CTRL + mmaximize horizontallySuper + CTRL + nrestore minimized clientSuper + CTRL + qclose client forcefullySuper + Downmove client downwardSuper + Leftmove client to the leftSuper + Rightmove client to the rightSuper + SHIFT + Downincrease client heightSuper + SHIFT + Leftreduce client widthSuper + SHIFT + Rightincrease client widthSuper + SHIFT + Tabcycle prev to toplevel inside containerSuper + SHIFT + Upreduce client heightSuper + SHIFT + bracketleftcycle move focused client to previous screenSuper + SHIFT + bracketrightcycle move focused client to next screenSuper + SHIFT + equalincrease opacitySuper + SHIFT + jswap with next client by indexSuper + SHIFT + kswap with previous client by indexSuper + SHIFT + mmaximize verticallySuper + SHIFT + minusdecrease opacitySuper + SHIFT + qclose client respectfullySuper + SHIFT + spacetoggle floatingSuper + Tabcycle next to toplevel inside containerSuper + Upmove client upwardSuper + ftoggle fullscreenSuper + hfocus leftSuper + itoggle client above normal toplevelSuper + jfocus downSuper + kfocus upSuper + lfocus rightSuper + mtoggle maximizeSuper + nminimize clientSuper + otoggle client always on topSuper + tmark insert container from the focused clientSuper + utoggle client under normal toplevel
launcher
Super + F1open a web browserSuper + Printscreenshot entire screenSuper + btoggle waybarSuper + papplication launcher (default is rofi)Super + RETURNopen a terminalSuper + vclipboard history
tag
Super + 0deactivate all tags on all screenSuper + 1view tag #1Super + 2view tag #2Super + 3view tag #3Super + 4view tag #4Super + 5view tag #5Super + 6view tag #6Super + 7view tag #7Super + 8view tag #8Super + 9view tag #9Super + CTRL + 1toggle tag #1Super + CTRL + 2toggle tag #2Super + CTRL + 3toggle tag #3Super + CTRL + 4toggle tag #4Super + CTRL + 5toggle tag #5Super + CTRL + 6toggle tag #6Super + CTRL + 7toggle tag #7Super + CTRL + 8toggle tag #8Super + CTRL + 9toggle tag #9Super + CTRL + SHIFT + 1toggle focused client on tag #1Super + CTRL + SHIFT + 2toggle focused client on tag #2Super + CTRL + SHIFT + 3toggle focused client on tag #3Super + CTRL + SHIFT + 4toggle focused client on tag #4Super + CTRL + SHIFT + 5toggle focused client on tag #5Super + CTRL + SHIFT + 6toggle focused client on tag #6Super + CTRL + SHIFT + 7toggle focused client on tag #7Super + CTRL + SHIFT + 8toggle focused client on tag #8Super + CTRL + SHIFT + 9toggle focused client on tag #9Super + SHIFT + 1move focused client to tag #1Super + SHIFT + 2move focused client to tag #2Super + SHIFT + 3move focused client to tag #3Super + SHIFT + 4move focused client to tag #4Super + SHIFT + 5move focused client to tag #5Super + SHIFT + 6move focused client to tag #6Super + SHIFT + 7move focused client to tag #7Super + SHIFT + 8move focused client to tag #8Super + SHIFT + 9move focused client to tag #9Super + commaview next workspace/tagSuper + graveactivate last activated tagsSuper + periodview prev workspace/tag