Skip to content

Commit

Permalink
Merge pull request jordansissel#23 from mgsloan/master
Browse files Browse the repository at this point in the history
Aggregated contributions
  • Loading branch information
jordansissel authored Aug 21, 2018
2 parents 6505bd0 + 982994f commit 78f9e07
Show file tree
Hide file tree
Showing 8 changed files with 452 additions and 158 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
/keynav
/keynav.1
/keynav.1.gz
/keynav_version.h
/VERSION
*.o
/keynav-*.tar.gz


.*
!.gitignore
59 changes: 40 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
CFLAGS+=$(shell pkg-config --cflags cairo-xlib xinerama glib-2.0 xext x11 xtst 2> /dev/null || echo -I/usr/X11R6/include -I/usr/local/include)
LDFLAGS+=$(shell pkg-config --libs cairo-xlib xinerama glib-2.0 xext x11 xtst 2> /dev/null || echo -L/usr/X11R6/lib -L/usr/local/lib -lX11 -lXtst -lXinerama -lXext -lglib)
LDFLAGS+=$(shell pkg-config --libs glib-2.0)

OTHERFILES=README CHANGELIST COPYRIGHT \
CFLAGS+=$(shell pkg-config --cflags cairo-xlib 2> /dev/null)
CFLAGS+=$(shell pkg-config --cflags xinerama 2> /dev/null)
CFLAGS+=$(shell pkg-config --cflags glib-2.0 2> /dev/null)
CFLAGS+=$(shell pkg-config --cflags x11 2> /dev/null)
CFLAGS+=$(shell pkg-config --cflags xrandr 2> /dev/null)

LDFLAGS+=$(shell pkg-config --libs cairo-xlib 2> /dev/null)
LDFLAGS+=$(shell pkg-config --libs xinerama 2> /dev/null)
LDFLAGS+=$(shell pkg-config --libs glib-2.0 2> /dev/null)
LDFLAGS+=$(shell pkg-config --libs x11 2> /dev/null)
LDFLAGS+=$(shell pkg-config --libs xrandr 2> /dev/null)
LDFLAGS+=-Xlinker -rpath=/usr/local/lib

PREFIX=/usr

OTHERFILES=README.md CHANGELIST COPYRIGHT keynav.pod \
keynavrc Makefile version.sh VERSION
#CFLAGS+=-DPROFILE_THINGS
#LDFLAGS+=-lrt

VERSION=$(shell sh version.sh)

#CFLAGS+=-pg -g
#LDFLAGS+=-pg -g
#LDFLAGS+=-L/usr/lib/debug/usr/lib/ -lcairo -lX11 -lXinerama -LXtst -lXext
#CFLAGS+=-O2

#CFLAGS+=-DPROFILE_THINGS
#LDFLAGS+=-lrt

.PHONY: all
.PHONY: all uninstall

all: keynav

clean:
rm *.o keynav keynav_version.h || true;
rm -f *.o keynav keynav_version.h keynav.1.gz

keynav.o: keynav_version.h
keynav_version.h: version.sh

keynav: LDFLAGS+=-Xlinker -rpath=/usr/local/lib
debug:CFLAGS+=-DPROFILE_THINGS
#debug:CFLAGS+=-pg
debug:CFLAGS+=-g
#debug:LDFLAGS+=-lrt
debug: keynav.o
$(CC) keynav.o -o keynav $(CFLAGS) $(LDFLAGS) -lxdo

keynav:CFLAGS+=-O2
keynav: keynav.o
$(CC) keynav.o -o $@ $(LDFLAGS) -lxdo; \
$(CC) keynav.o -o keynav $(CFLAGS) $(LDFLAGS) -lxdo
strip keynav

keynav_version.h:
sh version.sh --header > $@
Expand Down Expand Up @@ -62,3 +71,15 @@ test-package-build: create-package

keynav.1: keynav.pod
pod2man -c "" -r "" $< > $@

install: keynav keynav.1
mkdir -p $(PREFIX)/bin
install ./keynav $(PREFIX)/bin/keynav
rm -f keynav.1.gz
gzip keynav.1
mkdir -p $(PREFIX)/share/man/man1
install ./keynav.1.gz $(PREFIX)/share/man/man1/

uninstall:
rm -f $(PREFIX)/bin/keynav
rm -f $(PREFIX)/share/man/man1/keynav.1.gz
1 change: 0 additions & 1 deletion README

This file was deleted.

57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
keynav
======

Control the mouse with the keyboard.

Please see http://www.semicomplete.com/projects/keynav


Compiling
---------

You may need some extra libraries to compile keynav. On Debian and Ubuntu you can install these packages:

sudo apt-get install libcairo2-dev libxinerama-dev libxdo-dev

Next you simply run make:

make

This will produce an executable `./keynav` which may be run directly (or copied
somewhere in your path). You can also install (by default directly to `/usr`)
via `make install`.

On FreeBSD (and, I expect, other non-GNU platforms), you will want to use gmake.


FAQ
---

Q: What platforms are supported?
A: keynav should work on nearly any Unix-like that runs X11. It has been
confirmed to work on extremely varied GNU/Linux systems (incuding RPM-based,
Debian derivatives, musl-based systems, and Arch), and FreeBSD. If you get it to
run elsewhere, please let me know so I can add it to the list. If you try to run
it on another Unix-like and have trouble, please get in touch and I'll try to
help. If attempting to run elsewhere, note that we currently have a dependency
on GNU Make (gmake), and it hasn't been tested with many compilers yet.

Q: Does it work on Android/Windows/Wayland/iOS/...?
A: Sadly, no; keynav is totally dependent on X11, and porting it to any other
graphical system would really be a clone/rewrite. Although I am aware of no
exact analogues on other systems, I suggest looking into Tasker (Android),
AutoHotKey (Windows), and AppleScript (macOS). If you find something that works,
let me know and I'll consider adding it to this list.

Q: Can I use keynav to scroll?
A: Yes! X11 represents mouse scrolling as key presses, so you just add the
relevant stanza to your keynavrc. Mouse buttons are
1=left, 2=middle, 3=right, 4=scroll-up, 5=scroll-down, 6=scroll-left, 7=scroll-right. So for example to scroll up with i and down with e:
```
i click 4,end
e click 5,end
```
or to keep scrolling without having to re-invoke keynav, remove the end command from the bindings, like this:
```
i click 4
```
Loading

0 comments on commit 78f9e07

Please sign in to comment.