mirror of
https://github.com/dylanaraps/sowm.git
synced 2025-05-19 09:30:24 -07:00
sowm: more broken (for now)
This commit is contained in:
parent
ef61316b5f
commit
d1e8ee5e67
@ -15,7 +15,7 @@ const char* colors[] = {"bud", "/home/goldie/Pictures/Wallpapers", 0};
|
|||||||
|
|
||||||
static struct key keys[] = {
|
static struct key keys[] = {
|
||||||
{MOD, XK_q, win_kill, {0}},
|
{MOD, XK_q, win_kill, {0}},
|
||||||
{MOD, XK_c, win_center, {0}},
|
{MOD, XK_c, win_center, {.w = 0}},
|
||||||
{MOD, XK_f, win_fs, {0}},
|
{MOD, XK_f, win_fs, {0}},
|
||||||
{Mod1Mask, XK_Tab, win_next, {0}},
|
{Mod1Mask, XK_Tab, win_next, {0}},
|
||||||
|
|
||||||
|
38
sowm.c
38
sowm.c
@ -66,25 +66,23 @@ static void (*events[LASTEvent])(XEvent *e) = {
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#define win (client *t=0, *c=list; t!=list->prev; t=c, c=c->next)
|
#define win (client *t=0, *c=list; t!=list->prev; t=c, c=c->next)
|
||||||
|
#define ws_save(W) ws_list[W] = list
|
||||||
#define ws_save(W) ws_list[W] = list
|
#define ws_sel(W) list = ws_list[ws = W]
|
||||||
#define ws_sel(W) list = ws_list[ws = W]
|
|
||||||
|
|
||||||
#define win_size(W, gx, gy, gw, gh) \
|
#define win_size(W, gx, gy, gw, gh) \
|
||||||
XGetGeometry(d, W, &(Window){0}, gx, gy, gw, gh, \
|
XGetGeometry(d, W, &(Window){0}, gx, gy, gw, gh, \
|
||||||
&(unsigned int){0}, &(unsigned int){0})
|
&(unsigned int){0}, &(unsigned int){0})
|
||||||
|
|
||||||
void win_focus(Window w) {
|
void win_focus(Window w) {
|
||||||
XSetInputFocus(d, w, RevertToParent, CurrentTime);
|
if (list) for win if (c->w == w) {
|
||||||
|
cur = c;
|
||||||
for win if (c->w == w) cur = c;
|
XSetInputFocus(d, w, RevertToParent, CurrentTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void notify_destroy(XEvent *e) {
|
void notify_destroy(XEvent *e) {
|
||||||
for win if (c->w == e->xdestroywindow.window) win_del(c);
|
if (list) for win if (c->w == e->xdestroywindow.window) win_del(c);
|
||||||
|
|
||||||
if (list) win_focus(list->w);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void notify_enter(XEvent *e) {
|
void notify_enter(XEvent *e) {
|
||||||
@ -125,7 +123,7 @@ void button_press(XEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void button_release() {
|
void button_release() {
|
||||||
for win if (c->w == mouse.subwindow) c->f = 0;
|
if (list) for win if (c->w == mouse.subwindow) c->f = 0;
|
||||||
|
|
||||||
mouse.subwindow = 0;
|
mouse.subwindow = 0;
|
||||||
}
|
}
|
||||||
@ -148,15 +146,15 @@ void win_add(Window w) {
|
|||||||
list = c;
|
list = c;
|
||||||
list->prev = list->next = list;
|
list->prev = list->next = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ws_save(ws);
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_del(client *c) {
|
void win_del(client *c) {
|
||||||
struct client **head = &list;
|
if (list || !c) return;
|
||||||
|
if (list == c) list = c->next;
|
||||||
if (!*head || !c) return;
|
if (c->next) c->next->prev = c->prev;
|
||||||
if (*head == c) *head = c->next;
|
if (c->prev) c->prev->next = c->next;
|
||||||
if (c->next) c->next->prev = c->prev;
|
|
||||||
if (c->prev) c->prev->next = c->next;
|
|
||||||
|
|
||||||
free(c);
|
free(c);
|
||||||
ws_save(ws);
|
ws_save(ws);
|
||||||
@ -198,10 +196,12 @@ void win_to_ws(const Arg arg) {
|
|||||||
XUnmapWindow(d, cur->w);
|
XUnmapWindow(d, cur->w);
|
||||||
ws_save(tmp);
|
ws_save(tmp);
|
||||||
|
|
||||||
if (list) win_focus(list->w);
|
if (list) win_focus(list->prev->w);
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_next() {
|
void win_next() {
|
||||||
|
if (!list) return;
|
||||||
|
|
||||||
win_focus(cur->next->w);
|
win_focus(cur->next->w);
|
||||||
XRaiseWindow(d, cur->next->w);
|
XRaiseWindow(d, cur->next->w);
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ void ws_go(const Arg arg) {
|
|||||||
|
|
||||||
ws_sel(arg.i);
|
ws_sel(arg.i);
|
||||||
|
|
||||||
if (list) win_focus(list->w);
|
if (list) win_focus(list->prev->w);
|
||||||
}
|
}
|
||||||
|
|
||||||
void configure_request(XEvent *e) {
|
void configure_request(XEvent *e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user