Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tudurom/windowchef
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.3.2
Choose a base ref
...
head repository: tudurom/windowchef
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Mar 23, 2017

  1. Verified

    This commit was signed with the committer’s verified signature.
    phodal Fengda Huang
    Copy the full SHA
    d2a700e View commit details

Commits on Apr 7, 2017

  1. Little bit of refactoring.

    tudurom committed Apr 7, 2017
    Copy the full SHA
    18b5ff3 View commit details

Commits on May 7, 2017

  1. Copy the full SHA
    1f2c04f View commit details

Commits on May 12, 2017

  1. new config options

    tudurom committed May 12, 2017
    Copy the full SHA
    2c3a5d2 View commit details
  2. Copy the full SHA
    db84204 View commit details

Commits on Jun 25, 2017

  1. readme: add link to ruler

    tudurom committed Jun 25, 2017
    Copy the full SHA
    29f58f0 View commit details

Commits on Jul 1, 2017

  1. Copy the full SHA
    3f2c245 View commit details
  2. Copy the full SHA
    73a2022 View commit details

Commits on Jul 5, 2017

  1. Copy the full SHA
    058a9b7 View commit details

Commits on Jul 6, 2017

  1. Merge pull request #32 from onodera-punpun/master

    Add window resize hints support
    Tudor Roman authored Jul 6, 2017
    Copy the full SHA
    70d96fb View commit details

Commits on Jul 7, 2017

  1. Copy the full SHA
    ceefe56 View commit details
  2. Copy the full SHA
    742c44f View commit details

Commits on Aug 8, 2017

  1. Copy the full SHA
    e62257b View commit details
  2. Copy the full SHA
    03ca6a6 View commit details

Commits on Aug 9, 2017

  1. ewmh: added _NET_SUPPORTING_WM_CHECK root property. full screen shoul…

    …d now work in all ewmh-aware clients (that means fullscreen now works for firefox woohoo)
    tudurom committed Aug 9, 2017
    Copy the full SHA
    e96b892 View commit details
  2. clear license information

    tudurom committed Aug 9, 2017
    Copy the full SHA
    27ece01 View commit details
  3. Copy the full SHA
    392735b View commit details
  4. Copy the full SHA
    6cc1f91 View commit details
  5. Copy the full SHA
    7056d49 View commit details

Commits on Aug 10, 2017

  1. Copy the full SHA
    4ff4da0 View commit details
  2. xproto, not libx11

    tudurom committed Aug 10, 2017
    Copy the full SHA
    d9f216e View commit details
  3. clarify xproto even more

    tudurom committed Aug 10, 2017
    Copy the full SHA
    cdfabe2 View commit details
  4. rip dragger

    tudurom committed Aug 10, 2017
    Copy the full SHA
    e8538bb View commit details

Commits on Aug 22, 2017

  1. Copy the full SHA
    0d4fc32 View commit details

Commits on Aug 24, 2017

  1. update readme

    tudurom committed Aug 24, 2017
    Copy the full SHA
    c5fe278 View commit details

Commits on Sep 4, 2017

  1. the wm shouldn't apply resize hints when asked to configure a window.…

    … the window already knows exactly how it wants to be resized
    tudurom committed Sep 4, 2017
    Copy the full SHA
    f27f774 View commit details

Commits on Sep 22, 2017

  1. Add replay_click_on_focus config key

    And also bump the version goddamit
    tudurom committed Sep 22, 2017
    Copy the full SHA
    216b185 View commit details

Commits on Jan 26, 2018

  1. Update windowchefrc

    blackcat authored Jan 26, 2018
    Copy the full SHA
    d966b34 View commit details

Commits on Jan 27, 2018

  1. Fix #41

    tudurom committed Jan 27, 2018
    Copy the full SHA
    286f4be View commit details

Commits on Jan 30, 2018

  1. Initial support for Internal Border

    usage :
      waitron wm_config internal_border_width integer
      waitron wm_config internal_border_focused hex
      waitron wm_config internal_border_unfocused hex
    okitavera committed Jan 30, 2018
    Copy the full SHA
    748611e View commit details

Commits on Jan 31, 2018

  1. Copy the full SHA
    a2f1335 View commit details

Commits on Feb 1, 2018

  1. Merge pull request #42 from yuune/internal-border

    Initial support for Internal border from #40
    Tudor Roman authored Feb 1, 2018
    Copy the full SHA
    a91a1e6 View commit details
  2. docs for internal border

    tudurom committed Feb 1, 2018
    Copy the full SHA
    b6da7f1 View commit details

Commits on Feb 10, 2018

  1. Fix #46

    tudurom committed Feb 10, 2018
    Copy the full SHA
    d617411 View commit details

Commits on Jun 25, 2018

  1. Copy the full SHA
    44c713a View commit details
  2. Merge pull request #48 from noirecat/master

    Update windowchefrc
    Tudor Roman authored Jun 25, 2018
    Copy the full SHA
    0d82157 View commit details
  3. Implement #52

    tudurom committed Jun 25, 2018
    Copy the full SHA
    ee0bfd3 View commit details
  4. Copy the full SHA
    f96349f View commit details
  5. oops

    tudurom committed Jun 25, 2018
    Copy the full SHA
    ce67584 View commit details

Commits on Jul 19, 2018

  1. Small tweaks

    Fix last window focusing
    Let windows be focused by others (_NET_ACTIVE_WINDOW)
    tudurom committed Jul 19, 2018
    Copy the full SHA
    2b61159 View commit details

Commits on Aug 31, 2018

  1. Fix #55

    tudurom committed Aug 31, 2018
    Copy the full SHA
    49a075f View commit details

Commits on Sep 1, 2018

  1. Copy the full SHA
    e82665c View commit details

Commits on Sep 9, 2018

  1. All windows have a JSON'd WINDOWCHEF_STATUS prop.

    It contains data such as the size, position, size hints, group,
    maximized state etc.
    tudurom committed Sep 9, 2018
    Copy the full SHA
    7fcb636 View commit details
  2. Copy the full SHA
    11e1b77 View commit details

Commits on Oct 2, 2018

  1. Silence compiler warnings

    mtreca committed Oct 2, 2018
    Copy the full SHA
    d4d3a39 View commit details

Commits on Oct 11, 2018

  1. Merge pull request #59 from vxid/fixes

    Silence compiler warnings
    tudurom authored Oct 11, 2018
    Copy the full SHA
    fc61af7 View commit details

Commits on Jan 3, 2019

  1. Fix #49

    tudurom committed Jan 3, 2019
    Copy the full SHA
    45b027c View commit details
  2. Copy the full SHA
    9cb6396 View commit details

Commits on Feb 2, 2019

  1. new changelog

    tudurom committed Feb 2, 2019
    Copy the full SHA
    c3c5f0b View commit details

Commits on Jul 22, 2019

  1. Fix #49

    tudurom authored and mtreca committed Jul 22, 2019
    Copy the full SHA
    ed208ab View commit details
Showing with 1,692 additions and 381 deletions.
  1. +26 −0 CHANGELOG.md
  2. +1 −1 LICENSE
  3. +8 −3 Makefile
  4. +37 −7 README.md
  5. +1 −1 VERSION
  6. +128 −22 client.c
  7. +4 −3 common.h
  8. +29 −3 config.h
  9. +7 −6 config.mk
  10. +1 −1 examples/sxhkdrc
  11. +14 −2 examples/windowchefrc
  12. +50 −2 list.c → helpers.c
  13. +27 −0 helpers.h
  14. +16 −3 ipc.h
  15. +0 −19 list.h
  16. +89 −17 man/waitron.1
  17. +55 −17 man/waitron.1.html
  18. +81 −16 man/waitron.1.md
  19. +2 −2 man/windowchef.1
  20. +2 −2 man/windowchef.1.html
  21. +1 −1 man/windowchef.1.md
  22. +43 −6 types.h
  23. +5 −0 windowchef.desktop
  24. +1,065 −247 wm.c
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Change log

## v0.5.0

* [window_put_in_grid now has two additional params to specify how many cells to
occupy](https://github.com/tudurom/windowchef/issues/52). This is not
optional. Sorry.
* Each window managed by the WM has a property named `WINDOWCHEF_STATUS` that
contains data about it. It is updated every time the data is updated, such
as when you move or resize the window. JSON format.
* Windows can be focused by others (_NET_ACTIVE_WINDOW)
* Windowchef respects chwbb, again. (#51)
* Borders render correctly in some programs (#49)

## v0.5.1

* Fixed [#49 Internal border causes black/transparent border on termite](https://github.com/tudurom/windowchef/issues/49).
* Windowchef will print the cause of error when loading of the config file fails.
* Last window focusing works correctly
* Fixed [#62 'waitron window_rev_cycle' crash report](https://github.com/tudurom/windowchef/issues/62)
* [Added grid movement and resizing
functions](https://github.com/tudurom/windowchef/pull/64) thanks to @vxid.

## v0.5.2

* Fixed uninstall makefile rule thanks to @xero
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ISC License

Copyright (c) 2016, 2017 Tudor Ioan Roman <tudurom@gmail.com>
Copyright (c) 2016-2019 Tudor Ioan Roman <tudurom@gmail.com>

Permission to use, copy, modify, and distribute this software for
any purpose with or without fee is hereby granted, provided that the
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -5,14 +5,17 @@ NAME_DEFINES = -D__NAME__=\"$(__NAME__)\" \
-D__THIS_VERSION__=\"$(__THIS_VERSION__)\" \
-D__CONFIG_NAME__=\"$(__CONFIG_NAME__)\" \

SRC = list.c wm.c client.c
SRC = helpers.c wm.c client.c
OBJ = $(SRC:.c=.o)
BIN = $(__NAME__) $(__NAME_CLIENT__)
CFLAGS += $(NAME_DEFINES)

all: $(BIN)

$(__NAME__): wm.o list.o
debug: CFLAGS += -O0 -g -DD
debug: $(__NAME__) $(__NAME_CLIENT__)

$(__NAME__): wm.o helpers.o
@echo $@
@$(CC) -o $@ $^ $(LDFLAGS)

@@ -24,7 +27,7 @@ $(__NAME_CLIENT__): client.o
@echo $@
@$(CC) -o $@ -c $(CFLAGS) $<

$(OBJ): common.h list.h ipc.h types.h config.h
$(OBJ): common.h helpers.h ipc.h types.h config.h

install: all
mkdir -p "$(DESTDIR)$(PREFIX)/bin"
@@ -35,11 +38,13 @@ install: all
cp -fR examples "$(DESTDIR)$(DOCPREFIX)/$(__NAME__)/"
cp -f README.md LICENSE "$(DESTDIR)$(DOCPREFIX)/$(__NAME__)/"
cd ./man; $(MAKE) install
install -D windowchef.desktop "$(DESTDIR)$(XSESSIONS)/"windowchef.desktop

uninstall:
rm -f "$(DESTDIR)$(PREFIX)/bin/$(__NAME__)"
rm -f "$(DESTDIR)$(PREFIX)/bin/$(__NAME_CLIENT__)"
rm -rf "$(DESTDIR)$(DOCPREFIX)/$(__NAME__)"
rm -rf "$(DESTDIR)$(XSESSIONS)/windowchef.desktop"
cd ./man; $(MAKE) uninstall

clean:
44 changes: 37 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -50,13 +50,23 @@ The default configuration file is `~/.config/windowchef/windowchefrc`. It is usu
a shell script that calls `waitron wm_config` for configuration. See the
manual page for `waitron(1)` for details regarding this topic.

If you want to use window rules, a feature that windowchef lacks, you can use
[ruler](https://github.com/tudurom/ruler).

Dependencies
------------

* `xcb`
* `xcb-randr`
* `xcb-util-wm`
* `xcb-keysyms`
* `xproto` (compile-time dependency)

Windowchef depends on `xcb` to communicate with the X11 server, `xcb-randr` to
gather information about connected displays and `xcb-util-wm` for ewmh and icccm helper functions.

`xcb-keysyms` and `xproto` are required for mouse support.

I couldn't find compiled documentation for `xcb-util-wm` so I compiled it and
put it on my website [here](https://tudorr.xyz/res/).

@@ -97,12 +107,18 @@ Features
* Activate/Deactivate/Toggle a group
* groups can be "sticky": windows are assigned to the currently
selected group automatically
* Mouse support
* Focus, move and resize windows with the mouse
* Supports window resize hints
* Respects window resize hints.
* Simple and stylish solid-color border. Width can be configured
* Gaps around the monitor and around the cells of the virtual grid(s).
* Configuration script. Windowchef loads a given script at startup that can be
used for configuration with waitron.
* 100% compatible with window management utilities (e.g. [wmutils](https://github.com/wmutils/)). Windowchef will update its internal state if programs attempt to manage windows. It also applies the correct window decorations when a program focuses a window. This makes it possible to use it as a "backend" with wm utilities.

Many of the features listed above are optional and can be disabled.

### Soon to come

- Nothing yet.
@@ -143,15 +159,28 @@ grid and put my window in the cell at `x = 0`, `y = 2`:
Using the mouse
---------------

Windowchef doesn't offer any mouse moving/resizing features. You can emulate
that with `xmmv(1)` and `xmrs(1)` from wmutils' `opt`.
~~Windowchef doesn't offer any mouse moving/resizing features. You can emulate
that with `xmmv(1)` and `xmrs(1)` from wmutils' `opt`.~~

`.sxhkdrc`:
It does now!

```
super + {_,alt +} t
{xmmv,xmrs}
```
You can do 4 actions:

* focus windows
* move windows
* resize windows
* from the corners
* from the sides

All actions (besides focusing windows) require pressing a modifier key
(`super` or `alt`, you choose) while doing it. You can configure all the mouse buttons for each action. The modifier key can be changed but it's the same for all actions.

You can also configure windowchef to require pressing the modifier key to focus
windows.

When resizing, you don't need to put the pointer exactly in the corner/on the
side of the window (like on windows or GNOME). It will work as long as it's
in the right quarter of the window.

Bars and panels
---------------
@@ -181,5 +210,6 @@ And many, many thanks to contributors:
* @nullrndtx
* @dialuplama
* @allora
* @onodera-punpun

Thank you for using `windowchef`!
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.2
0.5.2
150 changes: 128 additions & 22 deletions client.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* See the LICENSE file for copyright and license details. */
/* Copyright (c) 2016-2019 Tudor Ioan Roman. All rights reserved. */
/* Licensed under the ISC License. See the LICENSE file in the project root for full license information. */

#include <xcb/xcb.h>

@@ -28,6 +29,10 @@ static bool fn_hex(uint32_t *, int, char **);
static bool fn_position(uint32_t *, int, char **);
static bool fn_gap(uint32_t *, int, char **);
static bool fn_direction(uint32_t *, int, char **);
static bool fn_pac(uint32_t *, int, char **);
static bool fn_mod(uint32_t *, int, char **);
static bool fn_button(uint32_t *, int, char **);
static bool fn_hack(uint32_t *, int, char **);

static void usage(char *, int);
static void version(void);
@@ -42,6 +47,7 @@ struct Command {
struct ConfigEntry {
char *key;
enum IPCConfig config;
int argc;
bool (*handler)(uint32_t *, int, char **);
};

@@ -52,11 +58,14 @@ static struct Command c[] = {
{ "window_resize" , IPCWindowResize , 2 , fn_offset } ,
{ "window_resize_absolute" , IPCWindowResizeAbsolute , 2 , fn_naturals } ,
{ "window_maximize" , IPCWindowMaximize , 0 , NULL } ,
{ "window_unmaximize" , IPCWindowUnmaximize , 0 , NULL } ,
{ "window_hor_maximize" , IPCWindowHorMaximize , 0 , NULL } ,
{ "window_ver_maximize" , IPCWindowVerMaximize , 0 , NULL } ,
{ "window_monocle" , IPCWindowMonocle , 0 , NULL } ,
{ "window_close" , IPCWindowClose , 0 , NULL } ,
{ "window_put_in_grid" , IPCWindowPutInGrid , 4 , fn_naturals } ,
{ "window_put_in_grid" , IPCWindowPutInGrid , 6 , fn_hack } ,
{ "window_move_in_grid" , IPCWindowMoveInGrid , 2 , fn_offset } ,
{ "window_resize_in_grid" , IPCWindowResizeInGrid , 2 , fn_offset } ,
{ "window_snap" , IPCWindowSnap , 1 , fn_position } ,
{ "window_cycle" , IPCWindowCycle , 0 , NULL } ,
{ "window_rev_cycle" , IPCWindowRevCycle , 0 , NULL } ,
@@ -77,19 +86,34 @@ static struct Command c[] = {
};

static struct ConfigEntry configs[] = {
{ "border_width" , IPCConfigBorderWidth , fn_naturals },
{ "color_focused" , IPCConfigColorFocused , fn_hex },
{ "color_unfocused" , IPCConfigColorUnfocused , fn_hex },
{ "gap_width" , IPCConfigGapWidth , fn_gap },
{ "grid_gap_width" , IPCConfigGridGapWidth , fn_naturals },
{ "cursor_position" , IPCConfigCursorPosition , fn_position },
{ "groups_nr" , IPCConfigGroupsNr , fn_naturals },
{ "enable_sloppy_focus" , IPCConfigEnableSloppyFocus , fn_bool },
{ "sticky_windows" , IPCConfigStickyWindows , fn_bool },
{ "enable_borders" , IPCConfigEnableBorders , fn_bool },
{ "enable_last_window_focusing", IPCConfigEnableLastWindowFocusing, fn_bool },
{ "border_width" , IPCConfigBorderWidth , 1 , fn_naturals },
{ "color_focused" , IPCConfigColorFocused , 1 , fn_hex },
{ "color_unfocused" , IPCConfigColorUnfocused , 1 , fn_hex },
{ "internal_border_width", IPCConfigInternalBorderWidth, 1 , fn_naturals },
{ "internal_color_focused", IPCConfigInternalColorFocused, 1 , fn_hex },
{ "internal_color_unfocused", IPCConfigInternalColorUnfocused, 1 , fn_hex },
{ "gap_width" , IPCConfigGapWidth , 2 , fn_gap },
{ "grid_gap_width" , IPCConfigGridGapWidth , 1 , fn_naturals },
{ "cursor_position" , IPCConfigCursorPosition , 1 , fn_position },
{ "groups_nr" , IPCConfigGroupsNr , 1 , fn_naturals },
{ "enable_sloppy_focus" , IPCConfigEnableSloppyFocus , 1 , fn_bool },
{ "enable_resize_hints" , IPCConfigEnableResizeHints , 1 , fn_bool },
{ "sticky_windows" , IPCConfigStickyWindows , 1 , fn_bool },
{ "enable_borders" , IPCConfigEnableBorders , 1 , fn_bool },
{ "enable_last_window_focusing", IPCConfigEnableLastWindowFocusing, 1 , fn_bool },
{ "apply_settings" , IPCConfigApplySettings , 1 , fn_bool },
{ "replay_click_on_focus" , IPCConfigReplayClickOnFocus, 1, fn_bool },
{ "pointer_actions" , IPCConfigPointerActions , 3 , fn_pac },
{ "pointer_modifier" , IPCConfigPointerModifier , 1 , fn_mod },
{ "click_to_focus" , IPCConfigClickToFocus , 1 , fn_button },
};

/*
* An offset is a pair of two signed integers.
*
* data[0], data[1] - if 1, then the number in negative
* data[2], data[3] - the actual numbers, unsigned
*/
static bool
fn_offset(uint32_t *data, int argc, char **argv)
{
@@ -123,8 +147,7 @@ fn_naturals(uint32_t *data, int argc, char **argv)

if (errno != 0)
return false;
else
return true;
return true;
}

static bool
@@ -149,18 +172,19 @@ fn_bool(uint32_t *data, int argc, char **argv) {

static bool
fn_config(uint32_t *data, int argc, char **argv) {
char *key, *value;
char *key;
bool status;
int i;

key = argv[0];
value = argv[1];

i = 0;
while (i < NR_IPC_CONFIGS && strcmp(key, configs[i].key) != 0)
i++;

if (i < NR_IPC_CONFIGS) {
if (configs[i].argc != argc - 1)
errx(EXIT_FAILURE, "too many or not enough arguments. Want: %d", configs[i].argc);
data[0] = configs[i].config;
status = (configs[i].handler)(data + 1, argc - 1, argv + 1);

@@ -211,6 +235,88 @@ fn_direction(uint32_t *data, int argc, char **argv)
return true;
}

static bool
fn_pac(uint32_t *data, int argc, char **argv)
{
for (int i = 0; i < argc; i++) {
char *pac = argv[i];
if (strcasecmp(pac, "nothing") == 0)
data[i] = POINTER_ACTION_NOTHING;
else if (strcasecmp(pac, "focus") == 0)
data[i] = POINTER_ACTION_FOCUS;
else if (strcasecmp(pac, "move") == 0)
data[i] = POINTER_ACTION_MOVE;
else if (strcasecmp(pac, "resize_corner") == 0)
data[i] = POINTER_ACTION_RESIZE_CORNER;
else if (strcasecmp(pac, "resize_side") == 0)
data[i] = POINTER_ACTION_RESIZE_SIDE;
else
return false;
}

return true;
}
static bool
fn_mod(uint32_t *data, int argc, char **argv)
{
(void)(argc);
if (strcasecmp(argv[0], "alt") == 0)
data[0] = XCB_MOD_MASK_1;
else if (strcasecmp(argv[0], "super") == 0)
data[0] = XCB_MOD_MASK_4;
else
return false;

return true;
}
static bool
fn_button(uint32_t *data, int argc, char **argv)
{
char *btn = argv[0];
(void)(argc);

if (strcasecmp(btn, "left") == 0)
data[0] = 1;
else if (strcasecmp(btn, "middle") == 0)
data[0] = 2;
else if (strcasecmp(btn, "right") == 0)
data[0] = 3;
else if (strcasecmp(btn, "none") == 0)
data[0] = UINT32_MAX;
else if (strcasecmp(btn, "any") == 0)
data[0] = 0;
else
return false;

return true;
}

/*
* Kinda like fn_naturals, but each two numbers are put as 16-bit numbers
* in one uint32_t.
*/
static bool
fn_hack(uint32_t *data, int argc, char **argv)
{
int i = 0, j = 0;
unsigned long d;
do {
errno = 0;
d = strtoul(argv[i], NULL, 10);
if (i % 2 == 0) {
data[j] = d << 16U;
} else {
data[j] |= d;
j++;
}
i++;
} while (i < argc && errno == 0);

if (i % 2 == 1 || errno != 0)
return false;
return true;
}

static bool
fn_position(uint32_t *data, int argc, char **argv)
{
@@ -225,7 +331,9 @@ fn_position(uint32_t *data, int argc, char **argv)
snap_pos = BOTTOM_LEFT;
else if (strcasecmp(pos, "bottomright") == 0)
snap_pos = BOTTOM_RIGHT;
else if (strcasecmp(pos, "middle") == 0)
else if (strcasecmp(pos, "middle") == 0 ||
strcasecmp(pos, "center") == 0 ||
strcasecmp(pos, "centre") == 0)
snap_pos = CENTER;
else if (strcasecmp(pos, "left") == 0)
snap_pos = LEFT;
@@ -287,7 +395,6 @@ send_command(struct Command *c, int argc, char **argv)
xcb_generic_error_t *err;
xcb_void_cookie_t cookie;
bool status = true;
size_t str_size;

msg.response_type = XCB_CLIENT_MESSAGE;
msg.type = get_atom(ATOM_COMMAND);
@@ -312,7 +419,7 @@ send_command(struct Command *c, int argc, char **argv)
static void
usage(char *name, int status)
{
fprintf(stderr, "Usage: %s <command> [args...]\n", name);
fprintf(stderr, "Usage: %s [-h|-v] <command> [args...]\n", name);
exit(status);
}

@@ -321,7 +428,7 @@ version(void)
{

fprintf(stderr, "%s %s\n", __NAME_CLIENT__, __THIS_VERSION__);
fprintf(stderr, "Copyright (c) 2016-2017 Tudor Ioan Roman\n");
fprintf(stderr, "Copyright (c) 2016-2019 Tudor Ioan Roman\n");
fprintf(stderr, "Released under the ISC License\n");

exit(EXIT_SUCCESS);
@@ -332,7 +439,6 @@ int main(int argc, char **argv)
int i;
int command_argc;
char **command_argv;
int opt;

if (argc == 1) {
usage(argv[0], EXIT_FAILURE);
7 changes: 4 additions & 3 deletions common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* See the LICENSE file for copyright and license details. */
/* Copyright (c) 2016-2019 Tudor Ioan Roman. All rights reserved. */
/* Licensed under the ISC License. See the LICENSE file in the project root for full license information. */

#ifndef _COMMON_H
#define _COMMON_H
#ifndef WM_COMMON_H
#define WM_COMMON_H

#ifdef D
#define DMSG(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
32 changes: 29 additions & 3 deletions config.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
/* See the LICENSE file for copyright and license details. */
/* Copyright (c) 2016-2019 Tudor Ioan Roman. All rights reserved. */
/* Licensed under the ISC License. See the LICENSE file in the project root for full license information. */

#ifndef _CONFIG_H
#define _CONFIG_H
#ifndef WM_CONFIG_H
#define WM_CONFIG_H

#define BORDER_WIDTH 5
#define INTERNAL_BORDER_WIDTH 0

/* colors are HTML colors that start in "0x" instead of "#" */
#define COLOR_FOCUS 0x97a293
#define COLOR_UNFOCUS 0x393638
#define INTERNAL_COLOR_FOCUS 0x393638
#define INTERNAL_COLOR_UNFOCUS 0x97a293

/* gap between the window and the edge of the monitor
* when snapping or vertically/horizontally maximizing window */
#define GAP 0

/* gap between windows when laid in grid */
#define GRID_GAP 0

/* where to place the cursor when moving/resizing the window */
@@ -24,6 +29,9 @@
/* focus windows after hovering them with the pointer */
#define SLOPPY_FOCUS true

/* respect window resize hints */
#define RESIZE_HINTS false

/* if true, new windows will be assigned to the last activated group */
#define STICKY_WINDOWS false

@@ -33,4 +41,22 @@
/* if true, focus last window when the currently focused window is unmapped */
#define LAST_WINDOW_FOCUSING true

/* if true, apply settings on windows when they are set (like border color, border width) */
#define APPLY_SETTINGS true

/* When clicking a window to focus it, send the click to it too. */
#define REPLAY_CLICK_ON_FOCUS true

/* default pointer actions */
#define DEFAULT_LEFT_BUTTON_ACTION POINTER_ACTION_MOVE
#define DEFAULT_MIDDLE_BUTTON_ACTION POINTER_ACTION_RESIZE_SIDE
#define DEFAULT_RIGHT_BUTTON_ACTION POINTER_ACTION_RESIZE_CORNER

/* default pointer modifier (super key). Set to XCB_MOD_MASK_1 for alt */
#define POINTER_MODIFIER XCB_MOD_MASK_4

/* default mouse button for click to focus. -1 for none, 0 for any
1, 2, 3 for left-click, middle-click, right-click */
#define CLICK_TO_FOCUS_BUTTON 0

#endif
13 changes: 7 additions & 6 deletions config.mk
Original file line number Diff line number Diff line change
@@ -4,10 +4,11 @@ __CONFIG_NAME__ = windowchefrc
VERCMD ?= git describe 2> /dev/null
__THIS_VERSION__ = $(shell $(VERCMD) || cat VERSION)

PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man
MANDIR = $(MANPREFIX)/man1
DOCPREFIX = $(PREFIX)/share/doc
PREFIX ?= /usr/local
MANPREFIX ?= $(PREFIX)/share/man
MANDIR ?= $(MANPREFIX)/man1
DOCPREFIX ?= $(PREFIX)/share/doc
XSESSIONS ?= $(PREFIX)/share/xsessions

CFLAGS += -std=c99 -Wextra -O2
LDFLAGS += -lm -lxcb -lxcb-ewmh -lxcb-icccm -lxcb-randr
CFLAGS += -std=c99 -Wall -Wextra -O2
LDFLAGS += -lm -lxcb -lxcb-ewmh -lxcb-icccm -lxcb-randr -lxcb-keysyms
2 changes: 1 addition & 1 deletion examples/sxhkdrc
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ super + alt + ctrl + {1-4}
waitron group_remove_all_windows {1-4}

super + Return
urxvt
xterm

super + {Insert,Prior,Delete,Next,End}
waitron window_snap {topleft,topright,bottomleft,bottomright,middle}
16 changes: 14 additions & 2 deletions examples/windowchefrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
#!/bin/sh

waitron wm_config border_width 5
waitron wm_config internal_border_width 2
waitron wm_config color_focused 0x97a293
waitron wm_config color_unfocused 0x393638
waitron wm_config internal_color_focused 0x393638
waitron wm_config internal_color_unfocused 0x97a293

waitron wm_config gap_width all 0
waitron wm_config grid_gap_width 0
waitron wm_config cursor_position middle
waitron wm_config groups_nr 9

waitron wm_config cursor_position center

waitron wm_config groups_nr 10
waitron wm_config enable_sloppy_focus true
waitron wm_config enable_resize_hints false
waitron wm_config sticky_windows false
waitron wm_config enable_borders true
waitron wm_config enable_last_window_focusing true
waitron wm_config apply_settings true
waitron wm_config replay_click_on_focus true
waitron wm_config pointer_actions move resize_side resize_corner
waitron wm_config pointer_modifier super
waitron wm_config click_to_focus any
52 changes: 50 additions & 2 deletions list.c → helpers.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,44 @@
/* See the LICENSE file for copyright and license details. */
/* Copyright (c) 2016-2018 Tudor Ioan Roman. All rights reserved. */
/* Licensed under the ISC License. See the LICENSE file in the project root for full license information. */

#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>

#include "list.h"
#include "helpers.h"

int
asprintf(char **buf, const char *fmt, ...)
{
int size = 0;
va_list args;
va_start(args, fmt);
size = vasprintf(buf, fmt, args);
va_end(args);
return size;
}

int
vasprintf(char **buf, const char *fmt, va_list args)
{
va_list tmp;
va_copy(tmp, args);
int size = vsnprintf(NULL, 0, fmt, tmp);
va_end(tmp);

if (size < 0) {
return -1;
}

*buf = malloc(size + 1);

if (*buf == NULL) {
return -1;
}

size = vsprintf(*buf, fmt, args);
return size;
}

/*
* Move list item to the beginning (head) of the list.
@@ -66,6 +102,9 @@ list_delete_item(struct list_item **list, struct list_item *item)

if (*list == item) {
*list = item->next;
if (*list != NULL) {
(*list)->prev = NULL;
}
} else {
item->prev->next = item->next;
if (item->next != NULL)
@@ -91,3 +130,12 @@ list_delete_all_items(struct list_item **list, bool can_free_data)
list_delete_item(list, item);
}
}

uint32_t
get_color_pixel(uint32_t color)
{
if (color >> 24 == 0x00) {
color |= 0xff000000;
}
return color;
}
27 changes: 27 additions & 0 deletions helpers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Copyright (c) 2016-2018 Tudor Ioan Roman. All rights reserved. */
/* Licensed under the ISC License. See the LICENSE file in the project root for full license information. */

#ifndef WCHF_HELPERS_H
#define WCHF_HELPERS_H

#include <stdbool.h>
#include <stdarg.h>
#include <stdint.h>

int asprintf(char **, const char *, ...);
int vasprintf(char **, const char *, va_list);

struct list_item {
void *data;
struct list_item *prev;
struct list_item *next;
};

void list_move_to_head(struct list_item **, struct list_item *);
struct list_item* list_add_item(struct list_item **);
void list_delete_item(struct list_item **, struct list_item *);
void list_delete_all_items(struct list_item **, bool);

uint32_t get_color_pixel(uint32_t);

#endif
19 changes: 16 additions & 3 deletions ipc.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* See the LICENSE file for copyright and license details. */
/* Copyright (c) 2016-2019 Tudor Ioan Roman. All rights reserved. */
/* Licensed under the ISC License. See the LICENSE file in the project root for full license information. */

#ifndef _WM_IPC_H
#define _WM_IPC_H
#ifndef WM_IPC_H
#define WM_IPC_H

#define ATOM_COMMAND "__WM_IPC_COMMAND"

@@ -14,11 +15,14 @@ enum IPCCommand {
IPCWindowResize,
IPCWindowResizeAbsolute,
IPCWindowMaximize,
IPCWindowUnmaximize,
IPCWindowHorMaximize,
IPCWindowVerMaximize,
IPCWindowMonocle,
IPCWindowClose,
IPCWindowPutInGrid,
IPCWindowMoveInGrid,
IPCWindowResizeInGrid,
IPCWindowSnap,
IPCWindowCycle,
IPCWindowRevCycle,
@@ -43,14 +47,23 @@ enum IPCConfig {
IPCConfigBorderWidth,
IPCConfigColorFocused,
IPCConfigColorUnfocused,
IPCConfigInternalBorderWidth,
IPCConfigInternalColorFocused,
IPCConfigInternalColorUnfocused,
IPCConfigGapWidth,
IPCConfigGridGapWidth,
IPCConfigCursorPosition,
IPCConfigGroupsNr,
IPCConfigEnableSloppyFocus,
IPCConfigEnableResizeHints,
IPCConfigStickyWindows,
IPCConfigEnableBorders,
IPCConfigEnableLastWindowFocusing,
IPCConfigApplySettings,
IPCConfigReplayClickOnFocus,
IPCConfigPointerActions,
IPCConfigPointerModifier,
IPCConfigClickToFocus,
NR_IPC_CONFIGS
};

19 changes: 0 additions & 19 deletions list.h

This file was deleted.

106 changes: 89 additions & 17 deletions man/waitron.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" https://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "WAITRON" "1" "March 2017" "Windowchef" "Windowchef Manual"
.TH "WAITRON" "1" "April 2020" "Windowchef" "Windowchef Manual"
.
.SH "NAME"
\fBwaitron\fR \- A client for windowchef(1)
@@ -39,6 +39,21 @@ false values: \fBfalse\fR | \fBf\fR | \fBno\fR | \fBn\fR | \fB0\fR
\fBDIRECTION\fR
\fBup\fR | \fBdown\fR | \fBleft\fR | \fBright\fR | \fBnorth\fR | \fBsouth\fR | \fBwest\fR | \fBeast\fR
.
.TP
\fBPOINTER_ACTION\fR
\fBnothing\fR | \fBfocus\fR | \fBmove\fR | \fBresize_corner\fR | \fBresize_side\fR
.
.TP
\fBPOINTER_MODIFIER\fR
\fBalt\fR | \fBsuper\fR
.
.TP
\fBMOUSE_BUTTON\fR
\fBany\fR | \fBnone\fR | \fBleft\fR | \fBmiddle\fR | \fBcentre\fR | \fBcenter\fR | \fBright\fR
.
.IP
\fBmiddle\fR, \fBcentre\fR, and \fBcenter\fR are synonyms and have the same behaviour\.
.
.SH "COMMANDS"
.
.TP
@@ -62,12 +77,16 @@ Resize the focused window up to \fIwidth\fR and \fIheight\fR\.
Hide the border and maximize the focused window on the current monitor\. Execute it again after maximizing to revert the state of the window\.
.
.TP
\fBwindow_unmaximize\fR
If the currently focused window is maximized in any way (fully, vertically, horizontally, monocled), return it to normal state\.
.
.TP
\fBwindow_hor_maximize\fR
Horizontally maximize the focused window on the current monitor, preserving its \fIx\fR component\. Leaves a gap at the left and right of the monitor that can be configured\. Execute it again after maximizing to revert the state of the window\.
Horizontally maximize the focused window on the current monitor, preserving its \fIy\fR component\. Leaves a gap at the left and right of the monitor that can be configured\. Execute it again after maximizing to revert the state of the window\.
.
.TP
\fBwindow_ver_maximize\fR
Vertically maximize the focused window on the current monitor, preserving its \fIy\fR component\. Leaves a gap at the top and bottom of the monitor whose width can be configured\. Execute it again after maximizing to revert the state of the window\.
Vertically maximize the focused window on the current monitor, preserving its \fIx\fR component\. Leaves a gap at the top and bottom of the monitor whose width can be configured\. Execute it again after maximizing to revert the state of the window\.
.
.TP
\fBwindow_monocle\fR
@@ -78,8 +97,16 @@ Puts the window in the "monocled" state: full screen but with borders visible\.
Closes the focused window\.
.
.TP
\fBwindow_put_in_grid\fR \fIgrid_width\fR \fIgrid_height\fR \fIcell_x\fR \fIcell_y\fR
Moves and resizes the focused windows accordingly to fit in a cell defined by the \fIcell_x\fR and \fIcell_y\fR coordinates in a virtual grid with width \fIgrid_width\fR and height \fIgrid_height\fR on the current monitor\. Gaps around the windows in the grid can be added along with monitor gaps\.
\fBwindow_put_in_grid\fR \fIgrid_width\fR \fIgrid_height\fR \fIcell_x\fR \fIcell_y\fR \fIcell_width\fR \fIcell_height\fR
Moves and resizes the focused windows accordingly to fit in a cell defined by the \fIcell_x\fR and \fIcell_y\fR coordinates, measuring \fIcell_width\fR in width and \fIcell_height\fR in height, in a virtual grid with width \fIgrid_width\fR and height \fIgrid_height\fR on the current monitor\. \fIcell_width\fR and \fIcell_height\fR are expressed in grid cells\. Gaps around the windows in the grid can be added along with monitor gaps\.
.
.TP
\fBwindow_move_in_grid\fR \fIx\fR \fIy\fR
Move a gridded window by \fIx\fR and \fIy\fR grid spaces\.
.
.TP
\fBwindow_resize_in_grid\fR \fIx\fR \fIy\fR
Resize a gridded window by \fIx\fR and \fIy\fR grid spaces\. Positive values grow, negative values shrink\.
.
.TP
\fBwindow_snap\fR \fIPOSITION\fR
@@ -95,7 +122,7 @@ Reverse cycle through mapped windows\.
.
.TP
\fBwindow_cycle_in_group\fR
Cycle trough mapped windows that belong to the same group as the focused window\.
Cycle through mapped windows that belong to the same group as the focused window\.
.
.TP
\fBwindow_rev_cycle_in_group\fR
@@ -111,7 +138,7 @@ Focus the window that was focused before the currently focused window\.
.
.TP
\fBwindow_cardinal_focus\fR \fIDIRECTION\fR
Focus the closest window in a direction, relative to the currently currently focused window\. Does nothing if there is no window focused\.
Focus the closest window in a direction, relative to the currently focused window\. Does nothing if there is no window focused\.
.
.TP
\fBgroup_add_window\fR \fIgroup_nr\fR
@@ -149,18 +176,11 @@ Activate group \fIgroup_nr\fR and deactivate the rest\.
Quit windowchef with exit_status \fIexit_status\fR\.
.
.TP
\fBwm_change_number_of_groups\fR \fInumber_of_groups\fR
Change the number of maximum groups to \fInumber_of_groups\fR\.
.
.IP
Windows that belong to a group that has a \fIgroup_nr\fR greater or equal to \fInumber_of_groups\fR will become orphaned\.
.
.TP
\fBwm_config\fR \fIkey\fR [\fIvalues\fR\.\.\.]
See \fICONFIGURING\fR\.
.
.SH "QUERYING"
Information about the current state of windowchef is made available through X properties of the root window\. Example:
Information about the current state of windowchef is available through X properties of the root window\. Example:
.
.IP "" 4
.
@@ -173,11 +193,28 @@ xprop \-root WINDOWCHEF_ACTIVE_GROUPS
.IP "" 0
.
.P
Information about the current state of each managed window is available through X properties of the window\. Example:
.
.IP "" 4
.
.nf

xprop \-id 0x02c00009 WINDOWCHEF_STATUS
.
.fi
.
.IP "" 0
.
.P
Here is a list of exposed properties:
.
.TP
\fBWINDOWCHEF_ACTIVE_GROUPS\fR
An integer list of currently active groups\.
On the root window\. An integer list of currently active groups\.
.
.TP
\fBWINDOWCHEF_STATUS\fR
On each managed window\. Contains information about the window\. Notable properties: \fBgroup\fR is \-1 if the window is not in a group\. \fBstate\fR can have one of the following values: \fBnormal\fR, \fBmaxed\fR, \fBvmaxed\fR, \fBhmaxed\fR, \fBmonocled\fR\.
.
.SH "CONFIGURING"
Configuring is done using the \fBwm_config\fR command\. Possible configuration keys are:
@@ -191,6 +228,14 @@ Sets the border width to \fIwidth\fR pixels\.
Sets the border color to \fIcolor\fR for the focused and unfocused state respectively\. \fIcolor\fR is a hexadecimal value that may or may not start with \fB0x\fR prefix\. Example: \fB0x1234ef\fR\.
.
.TP
\fBinternal_border_width\fR \fIwidth\fR
Make the first \fIwidth\fR pixels from the interior to the exterior of the border of another color, so you get two borders\. The width of the external border is \fBborder_width \- internal_border_width\fR\.
.
.TP
\fBinternal_color_focused\fR, \fBinternal_color_unfocused\fR \fIcolor\fR
Like \fBcolor_focused\fR and \fBcolor_unfocused\fR, but for the internal border\.
.
.TP
\fBgap_width\fR \fIPOSITION\fR \fIwidth\fR
Sets the window gap at \fIPOSITION\fR to \fIwidth\fR\. \fIPOSITION\fR can be equal to \fBall\fR to set all gaps to \fIPOSITION\fR\.
.
@@ -207,6 +252,10 @@ Sets the position of the cursor when moving or resizing windows\.
Sets the number of groups to \fInr\fR\. If \fInr\fR is less than the current number of groups, window that belong to groups whose numbers are greater than \fInr\fR will be mapped to screen and assigned to the null group\.
.
.TP
\fBenable_resize_hints\fR \fIBOOL\fR
If true, \fBwindowchef\fR will respect window resize hints as defined by ICCCM\. Most terminal emulators should have this feature\.
.
.TP
\fBenable_sloppy_focus\fR \fIBOOL\fR
Enable sloppy focus\.
.
@@ -216,13 +265,36 @@ If \fIsticky_windows\fR is true, new windows will be assigned to the last activa
.
.TP
\fBenable_borders\fR \fIBOOL\fR
If true, border colors will be set each time a window gets/loses focus\. Setting it to false is useful when using another program to draw the borders (example: \fBchwb2\fR from wmutils)\.
If true, the border will be fully managed by the window manager\. Border colors will be set each time a window gets/loses focus\. Setting it to false lets the user manage the border of every window using external tools\. (example: \fBchwb2\fR from wmutils)\.
.
.TP
\fBenable_last_window_focusing\fR \fIBOOL\fR
If true, when the currently focused window is unmapped or closed, \fBwindowchef\fR will focus the previously focused window\. See the \fBwindow_focus_last\fR command\.
.
.TP
\fBapply_settings\fR \fIBOOL\fR
If true, some settings will be applied on all windows instead of newly created windows\. True by default\.
.
.TP
\fBreplay_click_on_focus\fR \fIBOOL\fR
If true, when clicking on an unfocused with the intent to focus it, windowchef will also send the click event to the target window\. If false, the window will receive the click event only if it\'s already focused\.
.
.TP
\fBpointer_actions\fR \fIPOINTER_ACTION\fR \fIPOINTER_ACTION\fR \fIPOINTER_ACTION\fR
Sets the action that should be done whenever the modifier key and the corresponding button are clicked at the same time on the window\. There are 3 actions for three mouse buttons: left, middle and right\.
.
.TP
\fBpointer_modifier\fR \fIPOINTER_MODIFIER\fR
Set the modifier for pointer actions\.
.
.TP
\fBclick_to_focus\fR \fIMOUSE_BUTTON\fR
Set the mouse button that focuses the hovered window when clicked\.
.
.SH "SEE ALSO"

.
.P
windowchef(1), sxhkd(1), wmutils(1), pfw(1), lsw(1), chwb2(1), lemonbar(1)
.
.SH "REPORTING BUGS"
72 changes: 55 additions & 17 deletions man/waitron.1.html
97 changes: 81 additions & 16 deletions man/waitron.1.md
Original file line number Diff line number Diff line change
@@ -32,6 +32,17 @@ anything on `stdout`.
* `DIRECTION`:
`up` | `down` | `left` | `right` | `north` | `south` | `west` | `east`

* `POINTER_ACTION`:
`nothing` | `focus` | `move` | `resize_corner` | `resize_side`

* `POINTER_MODIFIER`:
`alt` | `super`

* `MOUSE_BUTTON`:
`any` | `none` | `left` | `middle` | `centre` | `center` | `right`

`middle`, `centre`, and `center` are synonyms and have the same behaviour.

## COMMANDS

* `window_move` <x> <y>:
@@ -51,14 +62,17 @@ anything on `stdout`.
Hide the border and maximize the focused window on the current monitor.
Execute it again after maximizing to revert the state of the window.

* `window_unmaximize`:
If the currently focused window is maximized in any way (fully, vertically, horizontally, monocled), return it to normal state.

* `window_hor_maximize`:
Horizontally maximize the focused window on the current monitor, preserving
its <x> component. Leaves a gap at the left and right of the monitor that
its <y> component. Leaves a gap at the left and right of the monitor that
can be configured. Execute it again after maximizing to revert the state of the window.

* `window_ver_maximize`:
Vertically maximize the focused window on the current monitor, preserving
its <y> component. Leaves a gap at the top and bottom of the monitor whose
its <x> component. Leaves a gap at the top and bottom of the monitor whose
width can be configured. Execute it again after maximizing to revert the state of the window.

* `window_monocle`:
@@ -68,12 +82,21 @@ anything on `stdout`.
* `window_close`:
Closes the focused window.

* `window_put_in_grid` <grid_width> <grid_height> <cell_x> <cell_y>:
* `window_put_in_grid` <grid_width> <grid_height> <cell_x> <cell_y> <cell_width> <cell_height>:
Moves and resizes the focused windows accordingly to fit in a cell defined
by the <cell_x> and <cell_y> coordinates in a virtual grid with width
by the <cell_x> and <cell_y> coordinates, measuring <cell_width> in width
and <cell_height> in height, in a virtual grid with width
<grid_width> and height <grid_height> on the current monitor.
<cell_width> and <cell_height> are expressed in grid cells.
Gaps around the windows in the grid can be added along with monitor gaps.

* `window_move_in_grid` <x> <y>:
Move a gridded window by <x> and <y> grid spaces.

* `window_resize_in_grid` <x> <y>:
Resize a gridded window by <x> and <y> grid spaces. Positive values grow,
negative values shrink.

* `window_snap` <POSITION>:
Snap the window on the screen in a position defined by <POSITION>.

@@ -84,7 +107,7 @@ anything on `stdout`.
Reverse cycle through mapped windows.

* `window_cycle_in_group`:
Cycle trough mapped windows that belong to the same group as the
Cycle through mapped windows that belong to the same group as the
focused window.

* `window_rev_cycle_in_group`:
@@ -100,7 +123,7 @@ anything on `stdout`.

* `window_cardinal_focus` <DIRECTION>:
Focus the closest window in a direction, relative to the currently
currently focused window. Does nothing if there is no window focused.
focused window. Does nothing if there is no window focused.

* `group_add_window` <group_nr>:
Add the focused window to the <group_nr> group.
@@ -128,28 +151,35 @@ anything on `stdout`.
* `wm_quit` <exit_status>:
Quit windowchef with exit_status <exit_status>.

* `wm_change_number_of_groups` <number_of_groups>:
Change the number of maximum groups to <number_of_groups>.

Windows that belong to a group that has a <group_nr> greater or equal to
<number_of_groups> will become orphaned.

* `wm_config` <key> [<values>...]:
See [CONFIGURING][].

## QUERYING

Information about the current state of windowchef is made available through
Information about the current state of windowchef is available through
X properties of the root window. Example:

```
xprop -root WINDOWCHEF_ACTIVE_GROUPS
```

Information about the current state of each managed window is available
through X properties of the window. Example:

```
xprop -id 0x02c00009 WINDOWCHEF_STATUS
```

Here is a list of exposed properties:

* `WINDOWCHEF_ACTIVE_GROUPS`:
An integer list of currently active groups.
On the root window. An integer list of currently active groups.
* `WINDOWCHEF_STATUS`:
On each managed window. Contains information about the window.
Notable properties:
`group` is -1 if the window is not in a group.
`state` can have one of the following values: `normal`, `maxed`, `vmaxed`,
`hmaxed`, `monocled`.

## CONFIGURING

@@ -164,6 +194,16 @@ are:
<color> is a hexadecimal value that may or may not start with `0x`
prefix. Example: `0x1234ef`.

* `internal_border_width` <width>:
Make the first <width> pixels from the interior to the exterior of the
border of another color, so you get two borders.
The width of the external border is `border_width -
internal_border_width`.

* `internal_color_focused`, `internal_color_unfocused` <color>:
Like `color_focused` and `color_unfocused`, but for the internal
border.

* `gap_width` <POSITION> <width>:
Sets the window gap at <POSITION> to <width>. <POSITION> can be equal to
`all` to set all gaps to <POSITION>.
@@ -179,6 +219,10 @@ are:
of groups, window that belong to groups whose numbers are greater than <nr>
will be mapped to screen and assigned to the null group.

* `enable_resize_hints` <BOOL>:
If true, `windowchef` will respect window resize hints as defined by ICCCM.
Most terminal emulators should have this feature.

* `enable_sloppy_focus` <BOOL>:
Enable sloppy focus.

@@ -188,14 +232,35 @@ are:
workspaces over groups.

* `enable_borders` <BOOL>:
If true, border colors will be set each time a window gets/loses focus.
Setting it to false is useful when using another program to draw the borders
If true, the border will be fully managed by the window manager. Border colors will
be set each time a window gets/loses focus. Setting it to false lets
the user manage the border of every window using external
tools.
(example: `chwb2` from wmutils).

* `enable_last_window_focusing` <BOOL>:
If true, when the currently focused window is unmapped or closed, `windowchef` will focus the
previously focused window. See the `window_focus_last` command.

* `apply_settings` <BOOL>:
If true, some settings will be applied on all windows instead of newly created windows.
True by default.

* `replay_click_on_focus` <BOOL>:
If true, when clicking on an unfocused with the intent to focus it, windowchef will also send
the click event to the target window. If false, the window will receive the click event only
if it's already focused.

* `pointer_actions` <POINTER_ACTION> <POINTER_ACTION> <POINTER_ACTION>:
Sets the action that should be done whenever the modifier key and the corresponding button
are clicked at the same time on the window. There are 3 actions for three mouse buttons:
left, middle and right.

* `pointer_modifier` <POINTER_MODIFIER>:
Set the modifier for pointer actions.

* `click_to_focus` <MOUSE_BUTTON>:
Set the mouse button that focuses the hovered window when clicked.
## SEE ALSO

windowchef(1), sxhkd(1), wmutils(1), pfw(1), lsw(1), chwb2(1), lemonbar(1)
4 changes: 2 additions & 2 deletions man/windowchef.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" https://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "WINDOWCHEF" "1" "February 2017" "Windowchef" "Windowchef Manual"
.TH "WINDOWCHEF" "1" "April 2020" "Windowchef" "Windowchef Manual"
.
.SH "NAME"
\fBwindowchef\fR \- A stacking window cooker
@@ -30,7 +30,7 @@ Print version information\.
Load script from \fIconfig_path\fR instead of \fB$XDG_CONFIG_HOME/windowchef/windowchefrc\fR\.
.
.SH "SEE ALSO"
waitron(1), sxhkd(1), xinit(1), xmmv(1), xmrs(1)
waitron(1), sxhkd(1), xinit(1)
.
.SH "REPORTING BUGS"
\fBwindowchef\fR issue tracker: https://github\.com/tudurom/windowchef/issues
4 changes: 2 additions & 2 deletions man/windowchef.1.html
2 changes: 1 addition & 1 deletion man/windowchef.1.md
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ overridden with the `-c` flag.

## SEE ALSO

waitron(1), sxhkd(1), xinit(1), xmmv(1), xmrs(1)
waitron(1), sxhkd(1), xinit(1)

## REPORTING BUGS

49 changes: 43 additions & 6 deletions types.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/* See the LICENSE file for copyright and license details. */
/* Copyright (c) 2016-2019 Tudor Ioan Roman. All rights reserved. */
/* Licensed under the ISC License. See the LICENSE file in the project root for full license information. */

#ifndef _TYPES_H
#define _TYPES_H
#ifndef WM_TYPES_H
#define WM_TYPES_H

#include <xcb/randr.h>
#include <stdbool.h>

enum position {
BOTTOM_LEFT,
@@ -31,6 +33,26 @@ enum mouse_mode {
MOUSE_RESIZE,
};

enum pointer_action {
POINTER_ACTION_NOTHING,
POINTER_ACTION_FOCUS,
POINTER_ACTION_MOVE,
POINTER_ACTION_RESIZE_CORNER,
POINTER_ACTION_RESIZE_SIDE,
};

enum resize_handle {
HANDLE_LEFT,
HANDLE_BOTTOM,
HANDLE_TOP,
HANDLE_RIGHT,

HANDLE_TOP_LEFT,
HANDLE_TOP_RIGHT,
HANDLE_BOTTOM_LEFT,
HANDLE_BOTTOM_RIGHT,
};

struct win_position {
int16_t x, y;
};
@@ -41,18 +63,27 @@ struct window_geom {
bool set_by_user;
};

struct grid {
int16_t gx, gy;
int16_t px, py;
int16_t sx, sy;
};

struct client {
xcb_window_t window;
struct window_geom geom;
struct window_geom orig_geom;
bool maxed, hmaxed, vmaxed, monocled;
struct grid grid;
bool maxed, hmaxed, vmaxed, monocled, gridded;
struct list_item *item;
struct list_item *focus_item;
struct monitor *monitor;
uint16_t min_width, min_height;
uint16_t max_width, max_height;
uint16_t width_inc, height_inc;
bool mapped;
uint32_t group;
uint8_t depth;
};

struct monitor {
@@ -64,15 +95,21 @@ struct monitor {
};

struct conf {
int8_t border_width, grid_gap;
int8_t border_width, internal_border_width, grid_gap;
int8_t gap_left, gap_down, gap_up, gap_right;
uint32_t focus_color, unfocus_color;
uint32_t focus_color, unfocus_color, internal_focus_color, internal_unfocus_color;
enum position cursor_position;
uint32_t groups;
bool sloppy_focus;
bool resize_hints;
bool sticky_windows;
bool borders;
bool last_window_focusing;
bool apply_settings;
bool replay_click_on_focus;
enum pointer_action pointer_actions[3];
uint16_t pointer_modifier;
int8_t click_to_focus;
};

#endif
5 changes: 5 additions & 0 deletions windowchef.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Desktop Entry]
Name=windowchef
Content=Simple stacking window manager
Exec=windowchef
Type=Application
1,312 changes: 1,065 additions & 247 deletions wm.c

Large diffs are not rendered by default.