From 9385c245df13ad126e8c91bf95800e8d0d4ccbea Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 11 Jun 2017 19:04:07 +0800 Subject: add support for make install to make everything, init x-focus-topmost script --- Makefile | 6 +++--- scripts/x-focus-topmost | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100755 scripts/x-focus-topmost 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 ) -- cgit v1.2.3