summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rwxr-xr-xscripts/x-focus-topmost7
2 files changed, 10 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 6c64bed..1a0c3cd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,10 @@
PREFIX = /usr/local
-SRC = x-session.c
+SRC = x-session.c
X11SRC = $(filter-out $(SRC),$(wildcard *.c))
SCRIPTS= $(wildcard scripts/*)
CC = gcc
-CFLAGS = -O2 -Wall -std=c99 -pedantic
+CFLAGS = -O2 -Wall -std=c99 -pedantic
X11LIB = -lX11 -L/usr/X11/lib
BIN = ${SRC:.c=}
@@ -23,5 +23,5 @@ clean: dist
dist:
@astyle --style=google *.c
-install:
+install: all
install -m 0755 $(BIN) $(X11BIN) $(SCRIPTS) ${PREFIX}/bin/.
diff --git a/scripts/x-focus-topmost b/scripts/x-focus-topmost
new file mode 100755
index 0000000..8931d64
--- /dev/null
+++ b/scripts/x-focus-topmost
@@ -0,0 +1,7 @@
+#!/bin/sh
+# focus the top-most window, i.e. the window just mapped
+topmost() {
+ xwininfo -root -children | awk '/^ *0x/{ print $1; exit; }'
+}
+[[ "$1" != "" ]] && sleep 0.5
+xdotool windowfocus $( topmost )