Skip to content

Commit

Permalink
released at 0.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpcpc authored Nov 30, 2020
1 parent 88a7d27 commit 90cb0fb
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Zombie reaping.

## [0.1.3] - 2020-11-30
### Added
- Instructions in README for Arch Linux AUR installation.

### Changed
- Default new window location from top-left to center.

20 changes: 9 additions & 11 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FEATURES
BUILD REQUIREMENTS
==================

libxcb, along with any default or user defined utilities:
xcb-util-keysyms, along with any default or user defined utilities:

application launcher https://git.suckless.org/dmenu
terminal emulator https://git.suckless.org/st
Expand Down Expand Up @@ -42,17 +42,18 @@ Building and installing on KISS Linux:
kiss b xwm
kiss i xwm

Build and install from Arch Linux AUR:
git clone https://aur.archlinux.org/xwm.git
cd kirc
makepkg -si

PATCHES
=======

xwm is considered a minimally viable window manager solution and,
therefore, is missing several features that many users would
consider "essential". For additional features, I have provided
instructions below for patching, as well as a respository for
sharing and hosting user created patches:
For additional features, I have provided a respository for sharing
and hosting user created patches:
http://github.com/mcpcpc/xwm-patches


EXAMPLES
========

Expand All @@ -63,13 +64,10 @@ Usimg startx to run xwm:
echo "exec xwm" > ~/.xinitrc
startx

Using xbg to set a solid background color:
xbg red

Using imagemagick to set a wallpaper:
display -window root background.png

Patching xwm (after copying the *.patch into the source dir.):
Patching xwm:
patch -p0 < mypatch.patch

DISCLAIMER
Expand Down
2 changes: 1 addition & 1 deletion config.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static char * browcmd[] = { "surf", "https://startpage.com", NULL };
* definitions, refer to the keysymdef.h and XF86keysym.h headers.
*/

static Key keys[] = {
static Key keys[] = {
{ MOD1, 0x0062, spawn, browcmd }, /* 0x0062 = XK_b */
{ MOD1, 0xff0d, spawn, termcmd }, /* 0xff0d = XK_Enter */
{ MOD1, 0x0020, spawn, menucmd }, /* 0x0020 = XK_space */
Expand Down
14 changes: 13 additions & 1 deletion xwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,17 @@ static void setWindowDimensions(xcb_window_t window) {
}
}

static void setWindowPosition(xcb_window_t window) {
if ((scre->root != window) && (0 != window)) {
uint32_t vals[2];
vals[0] = (scre->width_in_pixels / 2) - (WINDOW_X / 2);
vals[1] = (scre->height_in_pixels / 2) - (WINDOW_Y / 2);
xcb_configure_window(dpy, window, XCB_CONFIG_WINDOW_X |
XCB_CONFIG_WINDOW_Y, vals);
xcb_flush(dpy);
}
}

static void handleKeyPress(xcb_generic_event_t * ev) {
xcb_key_press_event_t * e = ( xcb_key_press_event_t *) ev;
xcb_keysym_t keysym = xcb_get_keysym(e->detail);
Expand Down Expand Up @@ -183,6 +194,7 @@ static void handleMapRequest(xcb_generic_event_t * ev) {
xcb_map_request_event_t * e = (xcb_map_request_event_t *) ev;
xcb_map_window(dpy, e->window);
setWindowDimensions(e->window);
setWindowPosition(e->window);
setBorderWidth(e->window);
values[0] = XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_FOCUS_CHANGE;
xcb_change_window_attributes_checked(dpy, e->window,
Expand Down Expand Up @@ -262,7 +274,7 @@ static int strcmp_c(char * str1, char * str2) {
int main(int argc, char * argv[]) {
int ret = 0;
if ((argc == 2) && (strcmp_c("-v", argv[1]) == 0)) {
ret = die("xwm-0.1.2, © 2020 Michael Czigler, see LICENSE for details\n");
ret = die("xwm-0.1.3, © 2020 Michael Czigler, see LICENSE for details\n");
}
if ((ret == 0) && (argc != 1)) {
ret = die("usage: xwm [-v]\n");
Expand Down
1 change: 1 addition & 0 deletions xwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ static void closewm(char ** com);
/* window behavior */
static void setFocus(xcb_drawable_t window);
static void setWindowDimensions(xcb_drawable_t window);
static void setWindowPosition(xcb_drawable_t window);
static void setBorderWidth(xcb_drawable_t window);
static void setBorderColor(xcb_drawable_t window, int focus);

Expand Down

0 comments on commit 90cb0fb

Please sign in to comment.