diff --git a/GNUmakefile b/GNUmakefile deleted file mode 100644 index cda88b3..0000000 --- a/GNUmakefile +++ /dev/null @@ -1,33 +0,0 @@ -include config.mk - -TARGET = absinthe - -SRC_FILES != find src/ -type f -OBJ_FILES = $(SRC_FILES:src/%.c=build/%.o) - -all: proto $(TARGET) - -xdg-shell-protocol.h: - $(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@ - -wlr-layer-shell-unstable-v1-protocol.h: - $(WAYLAND_SCANNER) server-header ./protocols/wlr-layer-shell-unstable-v1.xml $@ - -proto: xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h - -build/%.o: src/%.c - @mkdir -p build - $(CC) $(CFLAGS) -o $@ -c $< - -$(TARGET): $(OBJ_FILES) - $(CC) -o absinthe $(OBJ_FILES) $(LDFLAGS) - -clean: - rm -rf build/ - rm absinthe - rm xdg-shell-protocol.h - rm wlr-layer-shell-unstable-v1-protocol.h - -format: - find src/ -type f | xargs $(CLANG_FORMAT) -i - find include/ -type f | xargs $(CLANG_FORMAT) -i diff --git a/Makefile b/Makefile index a7365b0..cda88b3 100644 --- a/Makefile +++ b/Makefile @@ -8,18 +8,16 @@ OBJ_FILES = $(SRC_FILES:src/%.c=build/%.o) all: proto $(TARGET) xdg-shell-protocol.h: - $(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml ${.TARGET} + $(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@ wlr-layer-shell-unstable-v1-protocol.h: - $(WAYLAND_SCANNER) server-header ./protocols/wlr-layer-shell-unstable-v1.xml ${.TARGET} + $(WAYLAND_SCANNER) server-header ./protocols/wlr-layer-shell-unstable-v1.xml $@ proto: xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h -.for _src in ${SRC_FILES} -build/${_src:T:R}.o: ${_src} +build/%.o: src/%.c @mkdir -p build - $(CC) $(CFLAGS) -c ${.ALLSRC} -o ${.TARGET} -.endfor + $(CC) $(CFLAGS) -o $@ -c $< $(TARGET): $(OBJ_FILES) $(CC) -o absinthe $(OBJ_FILES) $(LDFLAGS) diff --git a/include/config.h b/include/config.h index 893fb33..589259d 100644 --- a/include/config.h +++ b/include/config.h @@ -12,7 +12,7 @@ static const float bgcolor[4] = { 0.0, 0.0, 0.0, 1.0 }; -static const float focused_bc[4] = { 0.0, 0.0, 1.0, 1.0 }; +static const float focused_bc[4] = { 1.0, 0.4, 0.6, 1.0 }; static const float urgent_bc[4] = { 1.0, 0.0, 0.0, 1.0 }; static const float unfocused_bc[4] = { 0.28, 0.28, 0.28, 1.0 }; diff --git a/src/keybinds.c b/src/keybinds.c index f3cda91..6c560e1 100644 --- a/src/keybinds.c +++ b/src/keybinds.c @@ -41,7 +41,7 @@ kill_focus(absn_server *server, const absn_arg *arg) void cycle_focus(absn_server *server, const absn_arg *arg) { - absn_toplevel *toplevel = server->focused_toplevel; + absn_toplevel *toplevel = focus_get_topmost(server); if (!toplevel || toplevel->fullscreen) return; @@ -66,32 +66,45 @@ void swap_focus(absn_server *server, const absn_arg *arg) { - absn_toplevel *toplevel = server->focused_toplevel; + absn_toplevel *toplevel = focus_get_topmost(server); if (!toplevel || toplevel->fullscreen || toplevel->floating) return; - absn_toplevel *swapped; + absn_toplevel *swap; if (arg->i > 0) { - wl_list_for_each(swapped, &toplevel->link, link) + if (server->toplevels.prev == &toplevel->link) { + wl_list_remove(&toplevel->link); + wl_list_insert(&server->toplevels, &toplevel->link); + goto arrange; + } + + wl_list_for_each(swap, &toplevel->link, link) { - if (toplevel->workspace == swapped->workspace) + if (toplevel->workspace == swap->workspace) break; } wl_list_remove(&toplevel->link); - wl_list_insert(&swapped->link, &toplevel->link); + wl_list_insert(&swap->link, &toplevel->link); } else { - wl_list_for_each_reverse(swapped, &toplevel->link, link) + if (server->toplevels.next == &toplevel->link) { + wl_list_remove(&toplevel->link); + wl_list_insert(server->toplevels.prev, &toplevel->link); + goto arrange; + } + + wl_list_for_each_reverse(swap, &toplevel->link, link) { - if (toplevel->workspace == swapped->workspace) + if (toplevel->workspace == swap->workspace) break; } - wl_list_remove(&swapped->link); - wl_list_insert(&toplevel->link, &swapped->link); + wl_list_remove(&swap->link); + wl_list_insert(&toplevel->link, &swap->link); } - layout_arrange(swapped->output); +arrange: + layout_arrange(toplevel->output); } void