Skip to content

Commit 90cb0fb

Browse files
authored
released at 0.1.3
1 parent 88a7d27 commit 90cb0fb

File tree

5 files changed

+31
-13
lines changed

5 files changed

+31
-13
lines changed

CHANGELOG

+7
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7676
### Fixed
7777
- Zombie reaping.
7878

79+
## [0.1.3] - 2020-11-30
80+
### Added
81+
- Instructions in README for Arch Linux AUR installation.
82+
83+
### Changed
84+
- Default new window location from top-left to center.
85+

README

+9-11
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ FEATURES
1010
BUILD REQUIREMENTS
1111
==================
1212

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

1515
application launcher https://git.suckless.org/dmenu
1616
terminal emulator https://git.suckless.org/st
@@ -42,17 +42,18 @@ Building and installing on KISS Linux:
4242
kiss b xwm
4343
kiss i xwm
4444

45+
Build and install from Arch Linux AUR:
46+
git clone https://aur.archlinux.org/xwm.git
47+
cd kirc
48+
makepkg -si
49+
4550
PATCHES
4651
=======
4752

48-
xwm is considered a minimally viable window manager solution and,
49-
therefore, is missing several features that many users would
50-
consider "essential". For additional features, I have provided
51-
instructions below for patching, as well as a respository for
52-
sharing and hosting user created patches:
53+
For additional features, I have provided a respository for sharing
54+
and hosting user created patches:
5355
https://github.com/mcpcpc/xwm-patches
5456

55-
5657
EXAMPLES
5758
========
5859

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

66-
Using xbg to set a solid background color:
67-
xbg red
68-
6967
Using imagemagick to set a wallpaper:
7068
display -window root background.png
7169

72-
Patching xwm (after copying the *.patch into the source dir.):
70+
Patching xwm:
7371
patch -p0 < mypatch.patch
7472

7573
DISCLAIMER

config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static char * browcmd[] = { "surf", "https://startpage.com", NULL };
4646
* definitions, refer to the keysymdef.h and XF86keysym.h headers.
4747
*/
4848

49-
static Key keys[] = {
49+
static Key keys[] = {
5050
{ MOD1, 0x0062, spawn, browcmd }, /* 0x0062 = XK_b */
5151
{ MOD1, 0xff0d, spawn, termcmd }, /* 0xff0d = XK_Enter */
5252
{ MOD1, 0x0020, spawn, menucmd }, /* 0x0020 = XK_space */

xwm.c

+13-1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,17 @@ static void setWindowDimensions(xcb_window_t window) {
142142
}
143143
}
144144

145+
static void setWindowPosition(xcb_window_t window) {
146+
if ((scre->root != window) && (0 != window)) {
147+
uint32_t vals[2];
148+
vals[0] = (scre->width_in_pixels / 2) - (WINDOW_X / 2);
149+
vals[1] = (scre->height_in_pixels / 2) - (WINDOW_Y / 2);
150+
xcb_configure_window(dpy, window, XCB_CONFIG_WINDOW_X |
151+
XCB_CONFIG_WINDOW_Y, vals);
152+
xcb_flush(dpy);
153+
}
154+
}
155+
145156
static void handleKeyPress(xcb_generic_event_t * ev) {
146157
xcb_key_press_event_t * e = ( xcb_key_press_event_t *) ev;
147158
xcb_keysym_t keysym = xcb_get_keysym(e->detail);
@@ -183,6 +194,7 @@ static void handleMapRequest(xcb_generic_event_t * ev) {
183194
xcb_map_request_event_t * e = (xcb_map_request_event_t *) ev;
184195
xcb_map_window(dpy, e->window);
185196
setWindowDimensions(e->window);
197+
setWindowPosition(e->window);
186198
setBorderWidth(e->window);
187199
values[0] = XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_FOCUS_CHANGE;
188200
xcb_change_window_attributes_checked(dpy, e->window,
@@ -262,7 +274,7 @@ static int strcmp_c(char * str1, char * str2) {
262274
int main(int argc, char * argv[]) {
263275
int ret = 0;
264276
if ((argc == 2) && (strcmp_c("-v", argv[1]) == 0)) {
265-
ret = die("xwm-0.1.2, © 2020 Michael Czigler, see LICENSE for details\n");
277+
ret = die("xwm-0.1.3, © 2020 Michael Czigler, see LICENSE for details\n");
266278
}
267279
if ((ret == 0) && (argc != 1)) {
268280
ret = die("usage: xwm [-v]\n");

xwm.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ static void closewm(char ** com);
2525
/* window behavior */
2626
static void setFocus(xcb_drawable_t window);
2727
static void setWindowDimensions(xcb_drawable_t window);
28+
static void setWindowPosition(xcb_drawable_t window);
2829
static void setBorderWidth(xcb_drawable_t window);
2930
static void setBorderColor(xcb_drawable_t window, int focus);
3031

0 commit comments

Comments
 (0)