Jump to content

cwc

From ArchWiki


cwc is an extensible Wayland compositor with dynamic window management based on wlroots. Highly influenced by Awesome window manager, cwc use Lua for its configuration and C plugin for extension.

Installation

Install the cwcAUR package. The development version is cwc-gitAUR

Starting

Select cwc from the menu in a display manager of choice.

LXQT

LXQt#Wayland_Session


Configuration

System-wide cwc configuration files are in /usr/share/cwc/defconfig/ while user configuration files are in ~/.config/cwc:

  • rc.lua — the main cwc resource configuration file.
  • keybindings.lua — cwc keybindings
  • oneshot.lua — where to launch startup apps


Creating the configuration file

First, run the following to create the directory needed in the next step:

$ mkdir -p ~/.config/cwc/

Whenever compiled, cwc will attempt to use whatever custom settings are contained in ~/.config/cwc/rc.lua. This file is not created by default, so we must copy the template file first:

$ cp /usr/share/cwc/defconfig/* ~/.config/cwc/


Autostart

autostarting is done by

~/.config/cwc/oneshot.lua


for example:

cwc.spawn_with_shell("swaybg --output '*' --color '#222222'")


Wallpaper

you can use a wallpaper setter such as feh or swww

Tips and tricks

Screenshot

See Keyboard input to ensure the PrtSc button is assigned correctly. Then install a screen capturing program such as flameshot

Add to the globalkeys array:

kbd.bind({ MODKEY }, "Print", function()
   cwc.spawn_with_shell("flameshot full")


Removing window gaps

it is possible to remove the small gaps between windows; in the screen/tag config table there is a properties section, add to it

 cwc.screen.set_useless_gaps(3)






].

Media Controls

It is possible to control both volume and media playback via a combination of amixer(1) (available via the alsa-utils package) and playerctl. The following can be added to the relevant key binding section of your rc.lua configuration file:

  ------------ Audio Media Keys
   kbd.bind({}, "XF86AudioLowerVolume", function()
       local cmd = string.format("pactl set-sink-volume @DEFAULT_SINK@ %s%%", "-3")
       cwc.spawn_with_shell(cmd)
   end, { exclusive = true, repeated = true })
   kbd.bind({}, "XF86AudioRaiseVolume", function()
       local cmd = string.format("pactl set-sink-volume @DEFAULT_SINK@ %s%%", "+3")
       cwc.spawn_with_shell(cmd)
   end, { exclusive = true, repeated = true })
   kbd.bind({}, "XF86AudioMute", function()
       cwc.spawn_with_shell("pactl set-sink-mute @DEFAULT_SINK@ toggle")
   end, { exclusive = true })
   kbd.bind({}, "XF86AudioMicMute", function()
       cwc.spawn_with_shell("pactl set-source-mute @DEFAULT_SOURCE@ toggle")
   end, { exclusive = true })
   -------------- Media Player Keys
   kbd.bind({}, "XF86AudioPlay", function()
       cwc.spawn_with_shell("playerctl play-pause")
   end, { exclusive = true })
   kbd.bind({}, "XF86AudioNext", function()
       cwc.spawn_with_shell("playerctl next")
   end, { exclusive = true })
   kbd.bind({}, "XF86AudioPrev", function()
       cwc.spawn_with_shell("playerctl previous")
   end, { exclusive = true })
   kbd.bind({}, "XF86AudioStop", function()
       cwc.spawn_with_shell("playerctl stop")
   end, { exclusive = true })
   kbd.bind({}, "XF86AudioRewind", function()
       cwc.spawn_with_shell("playerctl position 5-")
   end, { exclusive = true })
   kbd.bind({}, "XF86AudioForward", function()
       cwc.spawn_with_shell("playerctl position 5+")
   end, { exclusive = true })


Troubleshooting

Fix Java (GUI appears gray only)

See Java#Gray window, applications not resizing with WM, menus immediately closing and [1].




See also