-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
README.md: reformatting, mention distribution packages
* reformat so that it fits into 72 characters per line * consistently use Gtk+ * reword some parts * mention how to properly enable it in Debian * mention packaged version in Debian unstable * reference screenshots from repository, not external site
- Loading branch information
Showing
1 changed file
with
68 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,89 @@ | ||
#gtk3-nocsd | ||
|
||
gtk3-nocsd is a small module used to disable the client side decoration of gtk+ 3. | ||
gtk3-nocsd is a small module used to disable the client side decoration | ||
of Gtk+ 3. | ||
|
||
##Introduction: | ||
Since gtk+ 3.10, its developers added a so-called header bar or custom title bar. | ||
With this and the client-side decoration, the original title bar and window border | ||
provided by the window manager are disabled by gtk+. This makes all gtk+ 3 programs | ||
look alike. Even worse, this may break some window manager or compositors. | ||
Since Gtk+ 3.10, its developers added a so-called header bar or custom | ||
title bar. With this and the client-side decoration, the original title | ||
bar and window border provided by the window manager are disabled by | ||
Gtk+. This makes all Gtk+ 3 programs look alike. Even worse, this may | ||
break some window manager or compositors. | ||
|
||
Unfortunately, the gtk+ developers decided to be against the | ||
existing standards and provide "no option" to turn it off. | ||
Unfortunately, the Gtk+ developers decided to be against the existing | ||
standards and provide "no option" to turn it off. | ||
|
||
Luckily, with gtk3-nocsd, we still have a way to (partially) turn it off. Window manager (title bar and window border) can be re-enabled. | ||
Luckily, with gtk3-nocsd, we still have a way to (partially) turn it | ||
off. Window manager (title bar and window border) can be re-enabled. | ||
|
||
##Preview: | ||
This is how the gtk3 windows look like before and after using `gtk3-nocsd`. | ||
This is how the gtk3 windows look like before and after using | ||
`gtk3-nocsd`. | ||
|
||
![](http://i.imgur.com/7rMRozy.png) | ||
![Screenshot of gedit with CSDs still enabled](gedit-with-csd.png) | ||
|
||
![](http://i.imgur.com/Ic4pUs9.png) | ||
![Screenshot of gedit with CSDs disabled by gtk3-nocsd](gedit-without-csd.png) | ||
|
||
#How to use: | ||
|
||
* Make sure your gtk+ version is either older than 3.16.1 or newer than | ||
3.17.3. | ||
* Install necessary packages. | ||
On Debian based systems, install `pkg-config`, `libgtk-3-dev`, `libgirepository1.0-dev`. | ||
On Rpm based distros, install `pkgconfig`, `gtk3-devel`, `gtk+-devel`, `gobject-introspection-devel`. | ||
* gtk3-nocsd should work with all Gtk+ 3 versions. | ||
|
||
* Install necessary packages: | ||
|
||
* On Debian-based systems (including Ubuntu and Mint), install | ||
`pkg-config`, `libgtk-3-dev`, `libgirepository1.0-dev`. | ||
|
||
* On Fedora-based distros (including RHEL, CentOS), install | ||
`pkgconfig`, `gtk3-devel`, `gtk+-devel`, `gobject-introspection-devel`. | ||
|
||
* Build the code. Run `make` from command line. | ||
After this you'll have the files `gtk3-nocsd`and `libgtk3-nocsd.so.0` in the same directory. | ||
* Now to run individual gtk3 apps(say gedit) using this hack, use the command `./gtk3-nocsd gedit` from the same directory. | ||
* To have all gtk3 apps(of current user) use this hack, export some environment variables in your `~/.bashrc`. | ||
After this you'll have the files `gtk3-nocsd`and `libgtk3-nocsd.so.0` | ||
in the same directory. | ||
|
||
* Now to run individual Gtk+ 3 apps (say gedit) using this hack, use | ||
the command `./gtk3-nocsd gedit` from the same directory. | ||
|
||
* To have all Gtk+ 3 apps (of current user) use this hack, export some | ||
environment variables in your `~/.bashrc`: | ||
|
||
> export GTK_CSD=0 | ||
> export LD_PRELOAD=<"full path" of your libgtk3-nocsd.so.0 file> | ||
export GTK_CSD=0 | ||
export LD_PRELOAD=<"full path" of your libgtk3-nocsd.so.0 file> | ||
|
||
* On Debian-based systems with graphical login, instead modify (or | ||
create) `~/.xsessionrc` and add the following code: | ||
|
||
if [ -n "$STARTUP" ]; then | ||
BASESTARTUP=${STARTUP%% *} | ||
BASESTARTUP=${BASESTARTUP##*/} | ||
if [ "$BASESTARTUP" = x-session-manager ]; then | ||
BASESTARTUP=$(basename $(readlink /etc/alternatives/x-session-manager)) | ||
fi | ||
if [ x"$BASESTARTUP" = x"${BASESTARTUP#gnome-session}" ] ; then | ||
export GTK_CSD=0 | ||
STARTUP="env LD_PRELOAD=/path/to/libgtk3-nocsd.so.0 $STARTUP" | ||
fi | ||
fi | ||
|
||
* Re-login to make the environment variables take effect. | ||
|
||
* Hooray! GTK+ 3 client-side decoration is dead now. | ||
* Hooray! GTK+ 3 client-side decorations are disabled now. | ||
|
||
#How it works: | ||
#Distribution packages: | ||
|
||
I use $LD_PRELOAD to override several gdk and glib/gobject APIs to | ||
intercept related calls gtk+ 3 uses to setup CSD. | ||
While gtk+ 3 is trying to initialize CSD, I let it think that there | ||
is no compositor available, so CSD fail to start. | ||
Actually, we never disable X compositing, so other parts are not affected. | ||
This hack to my knowledge is the most specific way to disable CSD | ||
without obvious side effects. | ||
gtk3-nocsd is packaged in Debian's unstable distribution, see | ||
[gtk3-nocsd in Debian's package database](https://packages.debian.org/unstable/gtk3-nocsd). | ||
The Debian package already comes with integration code to automatically | ||
disable CSDs when installed, so after package installation only a | ||
re-login is required to have CSDs disabled on non-GNOME desktops. | ||
|
||
#How it works: | ||
|
||
`$LD_PRELOAD` is used to override several Gdk and glib/gobject APIs to | ||
intercept related calls Gtk+ 3 uses to setup CSDs. While Gtk+ 3 is | ||
trying to initialize CSDs, it is led to believe that there is no | ||
compositor available, so CSDs are not added. For later Gtk+ 3 versions, | ||
the `gtk_window_set_titlebar` method is re-implemented, as they do not | ||
allow for the disabling of CSDs via the compositor trick. Since X | ||
compositing is never really disabled (nor are other parts of Gtk+ 3 led | ||
to believe so), this does not have adverse consequences. This appears | ||
to be the simplest way to disable CSDs without obvious side effects. |