Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/nandhp/gtk3-nocsd into ma…
Browse files Browse the repository at this point in the history
…ster
  • Loading branch information
chris-se committed Oct 15, 2015
2 parents edcb3ef + bc3ac34 commit e012497
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ CFLAGS ?= -O2 -g
CFLAGS += $(shell ${PKG_CONFIG} --cflags gtk+-3.0) $(shell ${PKG_CONFIG} --cflags gobject-introspection-1.0) -pthread -Wall -fPIC
LDLIBS = -ldl

libdir ?= /usr/lib
prefix ?= /usr/local
libdir ?= $(prefix)/lib

all: libgtk3-nocsd.so.0
all: libgtk3-nocsd.so.0 wrapper.sh

clean:
rm -f libgtk3-nocsd.so.0 *.o *~
rm -f libgtk3-nocsd.so.0 *.o wrapper.sh *~

libgtk3-nocsd.so.0: gtk3-nocsd.o
$(CC) -shared $(CFLAGS) $(LDFLAGS) -Wl,-soname,libgtk3-nocsd.so.0 -o $@ $^ $(LDLIBS)

wrapper.sh: wrapper.sh.in
sed 's|@@libdir@@|$(libdir)|g' < $< > $@
chmod +x wrapper.sh

install:
install -D -m 0644 libgtk3-nocsd.so.0 $(DESTDIR)$(libdir)/libgtk3-nocsd.so.0
31 changes: 31 additions & 0 deletions wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
#
# wrapper.sh - Wrapper to apply gtk3-nocsd to application
#
# Usage: ln -s wrapper.sh ~/bin/evince
#
# Create a symlink to this wrapper script with the name of the program
# you want run without client-side decorations. This wrapper script
# will run the first matching executable in the PATH that is *not* a
# script. This wrapper script is useful if you don't want to add
# gtk3-nocsd to your system-wide LD_PRELOAD or if you only want it
# applied to certain applications.
#

# Location of gtk3-nocsd library
NOCSDLIB="/usr/local/lib/libgtk3-nocsd.so.0"
if [ -z "$NOCSDLIB" ] || ! [ -e "$NOCSDLIB" ]; then
# Try looking in the same directory as the script
NOCSDLIB="$(dirname "$(readlink -f "$0")")/libgtk3-nocsd.so.0"
fi
export LD_PRELOAD="$NOCSDLIB:$LD_PRELOAD"
export GTK_CSD=0

# Find the real program (the first one that's not a shell script)
APPNAME="$(basename "$0")"
for APPPATH in $(type -Pa "$APPNAME") /bin/false; do
head -c2 "$APPPATH" | grep '#!' >/dev/null || break
done

# Run the program with CSD disabled
exec "$APPPATH" "$@"

0 comments on commit e012497

Please sign in to comment.