mirror of
https://github.com/dylanaraps/sowm.git
synced 2025-07-25 17:21:56 -07:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f201a467ea | ||
|
7821aac0d2 | ||
|
a1c80d9b23 | ||
|
0df345e1da | ||
|
b5087acaac | ||
|
e491a637fe | ||
|
21a35be863 | ||
|
5547cc3a51 | ||
|
67d323458c | ||
|
0004ff3e18 | ||
|
5cc5d25823 |
7
Makefile
7
Makefile
@@ -9,11 +9,14 @@ all: config.h sowm
|
||||
config.h:
|
||||
cp config.def.h config.h
|
||||
|
||||
sowm: sowm.o
|
||||
$(CC) $(LDFLAGS) -O3 -o $@ $+ -lX11
|
||||
sowm:
|
||||
$(CC) -O3 $(CFLAGS) -o sowm sowm.c -lX11 $(LDFLAGS)
|
||||
|
||||
install: all
|
||||
install -Dm755 sowm $(DESTDIR)$(BINDIR)/sowm
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(BINDIR)/sowm
|
||||
|
||||
clean:
|
||||
rm -f sowm *.o
|
||||
|
@@ -9,7 +9,8 @@ An itsy bitsy floating window manager (*220~ sloc / 24kb compiled!*).
|
||||
- Window centering.
|
||||
- Mix of mouse and keyboard workflow.
|
||||
- Focus with cursor.
|
||||
- Rounded corners (*[through patch](https://github.com/dylanaraps/sowm-patches)*)
|
||||
- Rounded corners (*[through patch](https://github.com/dylanaraps/sowm/pull/58)*)
|
||||
- Titlebars (*[through patch](https://github.com/dylanaraps/sowm/pull/57)*)
|
||||
|
||||
<a href="https://user-images.githubusercontent.com/6799467/66687814-8cd9f800-ec73-11e9-97b8-6ae77876bd1b.jpg"><img src="https://user-images.githubusercontent.com/6799467/66687814-8cd9f800-ec73-11e9-97b8-6ae77876bd1b.jpg" width="43%" align="right"></a>
|
||||
|
||||
@@ -23,7 +24,7 @@ An itsy bitsy floating window manager (*220~ sloc / 24kb compiled!*).
|
||||
|
||||
<br>
|
||||
|
||||
Patches available here: https://github.com/dylanaraps/sowm-patches
|
||||
Patches available here: https://github.com/dylanaraps/sowm/pulls
|
||||
|
||||
## Default Keybindings
|
||||
|
||||
|
16
sowm.c
16
sowm.c
@@ -16,6 +16,7 @@ static unsigned int ww, wh;
|
||||
|
||||
static Display *d;
|
||||
static XButtonEvent mouse;
|
||||
static Window root;
|
||||
|
||||
static void (*events[LASTEvent])(XEvent *e) = {
|
||||
[ButtonPress] = button_press,
|
||||
@@ -58,8 +59,8 @@ void notify_motion(XEvent *e) {
|
||||
XMoveResizeWindow(d, mouse.subwindow,
|
||||
wx + (mouse.button == 1 ? xd : 0),
|
||||
wy + (mouse.button == 1 ? yd : 0),
|
||||
ww + (mouse.button == 3 ? xd : 0),
|
||||
wh + (mouse.button == 3 ? yd : 0));
|
||||
MAX(1, ww + (mouse.button == 3 ? xd : 0)),
|
||||
MAX(1, wh + (mouse.button == 3 ? yd : 0)));
|
||||
}
|
||||
|
||||
void key_press(XEvent *e) {
|
||||
@@ -138,8 +139,9 @@ void win_fs(const Arg arg) {
|
||||
win_size(cur->w, &cur->wx, &cur->wy, &cur->ww, &cur->wh);
|
||||
XMoveResizeWindow(d, cur->w, 0, 0, sw, sh);
|
||||
|
||||
} else
|
||||
} else {
|
||||
XMoveResizeWindow(d, cur->w, cur->wx, cur->wy, cur->ww, cur->wh);
|
||||
}
|
||||
}
|
||||
|
||||
void win_to_ws(const Arg arg) {
|
||||
@@ -261,10 +263,10 @@ int main(void) {
|
||||
signal(SIGCHLD, SIG_IGN);
|
||||
XSetErrorHandler(xerror);
|
||||
|
||||
int s = DefaultScreen(d);
|
||||
Window root = RootWindow(d, s);
|
||||
sw = XDisplayWidth(d, s);
|
||||
sh = XDisplayHeight(d, s);
|
||||
int s = DefaultScreen(d);
|
||||
root = RootWindow(d, s);
|
||||
sw = XDisplayWidth(d, s);
|
||||
sh = XDisplayHeight(d, s);
|
||||
|
||||
XSelectInput(d, root, SubstructureRedirectMask);
|
||||
XDefineCursor(d, root, XCreateFontCursor(d, 68));
|
||||
|
6
sowm.h
6
sowm.h
@@ -3,6 +3,7 @@
|
||||
#define win (client *t=0, *c=list; c && t!=list->prev; t=c, c=c->next)
|
||||
#define ws_save(W) ws_list[W] = list
|
||||
#define ws_sel(W) list = ws_list[ws = W]
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
#define win_size(W, gx, gy, gw, gh) \
|
||||
XGetGeometry(d, W, &(Window){0}, gx, gy, gw, gh, \
|
||||
@@ -12,7 +13,7 @@
|
||||
#define mod_clean(mask) (mask & ~(numlock|LockMask) & \
|
||||
(ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
|
||||
|
||||
typedef union {
|
||||
typedef struct {
|
||||
const char** com;
|
||||
const int i;
|
||||
const Window w;
|
||||
@@ -52,4 +53,5 @@ void win_prev(const Arg arg);
|
||||
void win_next(const Arg arg);
|
||||
void win_to_ws(const Arg arg);
|
||||
void ws_go(const Arg arg);
|
||||
int xerror() { return 0; }
|
||||
|
||||
static int xerror() { return 0; }
|
||||
|
Reference in New Issue
Block a user