Merge branch 'next' into master

This commit is contained in:
Michael Stapelberg 2015-09-30 08:55:24 +02:00
commit 96e1b80371
219 changed files with 7098 additions and 2449 deletions

1
.gitignore vendored
View File

@ -33,3 +33,4 @@ docs/*.html
i3-command-parser.stamp i3-command-parser.stamp
i3-config-parser.stamp i3-config-parser.stamp
.clang_complete .clang_complete
LAST_VERSION

View File

@ -32,7 +32,7 @@ before_install:
- sudo cp /tmp/pin /etc/apt/preferences.d/trustypin - sudo cp /tmp/pin /etc/apt/preferences.d/trustypin
- sudo apt-get update - sudo apt-get update
- sudo apt-get install -t trusty libc6 libc6-dev - sudo apt-get install -t trusty libc6 libc6-dev
- sudo apt-get install --no-install-recommends devscripts equivs - sudo apt-get install --no-install-recommends devscripts equivs xdotool
- sudo apt-get install -t utopic clang-format-3.5 - sudo apt-get install -t utopic clang-format-3.5
- clang-format-3.5 --version - clang-format-3.5 --version
install: install:
@ -45,3 +45,22 @@ script:
- CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Werror" make -j - CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Werror" make -j
- (cd testcases && xvfb-run ./complete-run.pl --parallel=1 || (cat latest/complete-run.log; false)) - (cd testcases && xvfb-run ./complete-run.pl --parallel=1 || (cat latest/complete-run.log; false))
- clang-format-3.5 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false) - clang-format-3.5 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false)
- |
funcs='malloc|calloc|realloc|strdup|strndup|asprintf|write'
cstring='"([^"\\]|\\.)*"'
cchar="'[^\\\\]'|'\\\\.[^']*'"
regex="^([^'\"]|${cstring}|${cchar})*\<(${funcs})\>"
detected=0
while IFS= read -r file; do
if { cpp -w -fpreprocessed "$file" || exit "$?"; } | grep -E -- "$regex"; then
echo "^ $file calls a function that has a safe counterpart."
detected=1
fi
done << EOF
$(find -name '*.c' -not -name safewrappers.c -not -name strndup.c)
EOF
if [ "$detected" -ne 0 ]; then
echo
echo "Calls of functions that have safe counterparts were detected."
exit 1
fi

View File

@ -1,20 +1,32 @@
# i3status/i3lock bugreports/feature requests # Contributing
Note that i3status and i3lock related bugreports and feature requests should be ## i3status/i3lock bug reports and feature requests
filed in the corresponding repositories, i.e. https://github.com/i3/i3status
and https://github.com/i3/i3lock
# i3 bugreports/feature requests Note that bug reports and feature requests for related projects should be filed in the corresponding repositories for [i3status](https://github.com/i3/i3status) and [i3lock](https://github.com/i3/i3lock).
1. Read http://i3wm.org/docs/debugging.html ## i3 bug reports and feature requests
1. Read the [debugging instructions](http://i3wm.org/docs/debugging.html).
2. Make sure you include a link to your logfile in your report (section 3). 2. Make sure you include a link to your logfile in your report (section 3).
3. Make sure you include the i3 version number in your report (section 1). 3. Make sure you include the i3 version number in your report (section 1).
4. Please be aware that we cannot support compatibility issues with
closed-source software, as digging into compatibility problems without
having access to the source code is too time-consuming. Additionally,
experience has shown that often, the software in question is responsible for
the issue. Please raise an issue with the software in question, not i3.
# Pull requests ## Pull requests
* Before sending a pull request for new features, please check with us that the * Before sending a pull request for new features, please check with us that the
feature is something we want to see in i3 by opening an issue which has feature is something we want to see in i3 by opening an issue which has
“feature request” or “enhancement” in its title. ”feature request” or ”enhancement” in its title.
* Use the `next` branch for developing and sending your pull request. * Use the `next` branch for developing and sending your pull request.
* Use `clang-format` to format your code. * Use `clang-format` to format your code.
* Run the testsuite, see http://i3wm.org/docs/testsuite.html * Run the [testsuite](http://i3wm.org/docs/testsuite.html)
## Finding something to do
* Find a [reproducible bug](https://github.com/i3/i3/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3Areproducible+label%3Abug+) from the issue tracker. These issues have been reviewed and confirmed by a project contributor.
* Find an [accepted enhancement](https://github.com/i3/i3/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3Aaccepted+label%3Aenhancement) from the issue tracker. These have been approved and are ok to start working on.
There's a very good [overview of the codebase](http://i3wm.org/docs/hacking-howto.html) available to get you started.

29
DEPENDS
View File

@ -7,29 +7,30 @@
┌──────────────┬────────┬────────┬────────────────────────────────────────┐ ┌──────────────┬────────┬────────┬────────────────────────────────────────┐
│ dependency │ min. │ lkgv │ URL │ │ dependency │ min. │ lkgv │ URL │
├──────────────┼────────┼────────┼────────────────────────────────────────┤ ├──────────────┼────────┼────────┼────────────────────────────────────────┤
│ pkg-config │ 0.25 │ 0.26 │ http://pkgconfig.freedesktop.org/ │ │ pkg-config │ 0.25 │ 0.28 │ http://pkgconfig.freedesktop.org/ │
│ libxcb │ 1.1.93 │ 1.10 │ http://xcb.freedesktop.org/dist/ │ │ libxcb │ 1.1.93 │ 1.11 │ http://xcb.freedesktop.org/dist/ │
│ xcb-util │ 0.3.3 │ 0.4.1 │ http://xcb.freedesktop.org/dist/ │ │ xcb-util │ 0.3.3 │ 0.4.1 │ http://xcb.freedesktop.org/dist/ │
│ xkbcommon │ 0.4.0 │ 0.4.0 │ http://xkbcommon.org/ │ │ xkbcommon │ 0.4.0 │ 0.5.0 │ http://xkbcommon.org/ │
│ xkbcommon-x11│ 0.4.0 │ 0.4.0 │ http://xkbcommon.org/ │ │ xkbcommon-x11│ 0.4.0 │ 0.5.0 │ http://xkbcommon.org/ │
│ util-cursor³ │ 0.0.99 │ 0.0.99 │ http://xcb.freedesktop.org/dist/ │ │ util-cursor³⁴│ 0.0.99 │ 0.1.2 │ http://xcb.freedesktop.org/dist/ │
│ libev │ 4.0 │ 4.11 │ http://libev.schmorp.de/ │ │ util-wm⁴ │ 0.3.8 │ 0.3.8 │ http://xcb.freedesktop.org/dist/ │
│ yajl │ 2.0.1 │ 2.0.4 │ http://lloyd.github.com/yajl/ │ │ util-keysyms⁴│ 0.3.8 │ 0.4.0 │ http://xcb.freedesktop.org/dist/ │
│ asciidoc │ 8.3.0 │ 8.6.4 │ http://www.methods.co.nz/asciidoc/ │ │ libev │ 4.0 │ 4.19 │ http://libev.schmorp.de/ │
│ yajl │ 2.0.1 │ 2.1.0 │ http://lloyd.github.com/yajl/ │
│ asciidoc │ 8.3.0 │ 8.6.8 │ http://www.methods.co.nz/asciidoc/ │
│ xmlto │ 0.0.23 │ 0.0.23 │ http://www.methods.co.nz/asciidoc/ │ │ xmlto │ 0.0.23 │ 0.0.23 │ http://www.methods.co.nz/asciidoc/ │
│ Pod::Simple² │ 3.22 │ 3.22 │ http://search.cpan.org/~dwheeler/Pod-Simple-3.23/ │ Pod::Simple² │ 3.22 │ 3.22 │ http://search.cpan.org/~dwheeler/Pod-Simple-3.23/
│ docbook-xml │ 4.5 │ 4.5 │ http://www.methods.co.nz/asciidoc/ │ │ docbook-xml │ 4.5 │ 4.5 │ http://www.methods.co.nz/asciidoc/ │
│ Xlib │ 1.3.3 │ 1.4.3 │ http://ftp.x.org/pub/current/src/lib/ │ │ PCRE │ 8.12 │ 8.35 │ http://www.pcre.org/ │
│ PCRE │ 8.12 │ 8.12 │ http://www.pcre.org/ │
│ libsn¹ │ 0.10 │ 0.12 │ http://freedesktop.org/wiki/Software/startup-notification │ libsn¹ │ 0.10 │ 0.12 │ http://freedesktop.org/wiki/Software/startup-notification
│ pango │ 1.30.0 | 1.30.0 │ http://www.pango.org/ │ │ pango │ 1.30.0 | 1.36.8 │ http://www.pango.org/ │
│ cairo │ 1.12.2 │ 1.12.2 │ http://cairographics.org/ │ │ cairo │ 1.12.2 │ 1.14.0 │ http://cairographics.org/ │
└──────────────┴────────┴────────┴────────────────────────────────────────┘ └──────────────┴────────┴────────┴────────────────────────────────────────┘
¹ libsn = libstartup-notification ¹ libsn = libstartup-notification
² Pod::Simple is a Perl module required for converting the testsuite ² Pod::Simple is a Perl module required for converting the testsuite
documentation to HTML. See http://michael.stapelberg.de/cpan/#Pod::Simple documentation to HTML. See http://michael.stapelberg.de/cpan/#Pod::Simple
³ xcb-util-cursor, to be precise. Might be considered part of xcb-util, or not ³ xcb-util-cursor, to be precise.
:-). ⁴ Depending on your distribution, this might be considered part of xcb-util.
i3bar, i3-msg, i3-input, i3-nagbar and i3-config-wizard do not introduce any i3bar, i3-msg, i3-input, i3-nagbar and i3-config-wizard do not introduce any
new dependencies. new dependencies.

View File

@ -22,6 +22,12 @@ include i3-dump-log/i3-dump-log.mk
include docs/docs.mk include docs/docs.mk
include man/man.mk include man/man.mk
# Update $(TOPDIR)/LAST_VERSION if it differs from $I3_VERSION
CACHED_VERSION := '$(shell [ -f $(TOPDIR)/LAST_VERSION ] && cat $(TOPDIR)/LAST_VERSION)'
ifneq ($(CACHED_VERSION),$(I3_VERSION))
$(shell echo -n ${I3_VERSION} > $(TOPDIR)/LAST_VERSION)
endif
real-all: $(ALL_TARGETS) real-all: $(ALL_TARGETS)
install: $(INSTALL_TARGETS) install: $(INSTALL_TARGETS)

View File

@ -1,30 +0,0 @@
┌──────────────────────────────┐
│ Release notes for i3 v4.10.3 │
└──────────────────────────────┘
This is i3 v4.10.3. This version is considered stable. All users of i3 are
strongly encouraged to upgrade.
┌────────────────────────────┐
│ Bugfixes │
└────────────────────────────┘
• serialize con_id with %p in run_binding() (For FreeBSD)
• ignore InputHint when not in WM_HINTS (fixes e.g. mupdf focus)
• disable physically disconnect RandR outputs
• initialize workspace rect to the output's upon creation
• userguide: quoted strings need to be used, escaping isnt possible
• mkdirp: do not throw an error if directory exists (fixes layout loss for
in-place restarts)
• i3bar: fix freeing static strings
┌────────────────────────────┐
│ Thanks! │
└────────────────────────────┘
Thanks for testing, bugfixes, discussions and everything I forgot go out to:
Tony Crisci, Deiz, Theo Buehler, shdown
-- Michael Stapelberg, 2015-07-30

115
RELEASE-NOTES-4.11 Normal file
View File

@ -0,0 +1,115 @@
┌────────────────────────────┐
│ Release notes for i3 v4.11 │
└────────────────────────────┘
This is i3 v4.11. This version is considered stable. All users of i3 are
strongly encouraged to upgrade.
Aside from plenty of new features, there are several changes that might result
in behavioral changes, depending on your specific configuration and
environment. As usual, we tried hard to keep the current behavior, and when we
changed behavior, we strongly believe its for the better.
Keyboard binding handling has been made more correct, for details see:
https://github.com/i3/i3/commit/bf3cd41b5ddf1e757515ab5fbf811be56e5f69cc
┌────────────────────────────┐
│ Changes in i3 v4.11 │
└────────────────────────────┘
• docs/debugging: provide instructions on how to debug i3bar
• docs/debugging: added a note about sensitive data
• docs/userguide: add a note to both “exec”s about semicolon and comma
• docs/userguide: quoted strings need to be used, escaping isnt possible
• docs/userguide: make syntax of syntax descriptions consistent
• docs/userguide: recommend “exec exec” for correct signal handling
• docs/userguide: explain i3-config-wizards behavior
• i3-nagbar: open on the primary screen
• i3-config-wizard: respect XDG config directories
• i3-input: position i3-input at window with input focus
• i3bar: use a reasonable default sep_block_width if a separator_symbol is given
• i3bar: add binding mode indicator
• i3bar: add bindsym command (deprecates wheel_{up,down}_cmd)
• i3bar: make tray padding configurable
• makefiles: respect EXEC_PREFIX and PKG_CONFIG
• added a --toggle switch to mark: “mark [--toggle] <mark>”
• added “focus_on_window_activation” directive
• added “no_focus” directive
• added “move [container|window] [to] mark <str>” command
• added “move [window|container] [to] position mouse|cursor|pointer” command
• added “title_format” command
• added “resize set [width] [height]” command
• added “sticky” command (for floating containers)
• added “workspace” criterion
• added “window_type” criterion
• make center coordinates relative to current workspace
• draw marks in window decoration (configure with show_marks)
• only mark a window if only one window is matched
• make floating window mouse handling consistent with tiled windows
• add a --border flag to enable mouse binds to trigger on border click
• set the _NET_WM_STATE_HIDDEN atom on windows that are currently not visible
due to being in the non-focused tab of a stacked or tabbed container
• ignore InputHint when not in WM_HINTS
• display which config is used in i3 --moreversion
• support config file line continuation
• use WM_SIZE_HINTS when present to set the geometry of floating windows
• add “tray_output primary” to the default config
• use libxkbcommon for translating keysyms, support all XKB groups
• support special value “__focused__” in criteria
• support _NET_WM_VISIBLE_NAME
• make sure borders are never counted as adjacent to the edge for floating
containers
• support moving dock clients to another output
• let “focus” report success depending on whether a window was matched
• handle _NET_WM_STATE_STICKY (for floating containers)
• make “debuglog on” command persist over restarts
• randr: use root window in case of no randr outputs
• set proper WM_CLASS on frame windows
┌────────────────────────────┐
│ Bugfixes │
└────────────────────────────┘
• i3bar: only detect clicks within the statusline width
• i3bar: fix flickering shortened status bar on other output(s)
• i3bar: send custom-defined command upon click on the non-statusline part of
i3bar even if workspace_buttons is set to “no”.
• i3-config-wizard: Make window size and click coordinates dependent on font
• i3-save-tree: retain “rect” for floating cons
• move urgency hint when moving container
• fix percents when attaching a window to a ws creates a new split con
• cope with non-null-terminated x class properties
• get workspace name when renaming current workspace
• allow single-child non-default layout cons to be moved between outputs
• allow --whole-window right after 'bindsym' within binding modes
• remove windows from the save set when unmapping (fixes problems with e.g.
owncloud when restarting i3)
• serialize con_id with %p in run_binding()
• initialize workspace rect to the output's upon creation
• mkdirp: do not throw an error if directory exists
• grab all buttons when managing a window to also allow 'bindsym
--whole-window button4 …' to work correctly
• properly clear the urgency hint when set by i3
• layout restore: load floating containers correctly
• layout restore: remove remaining criteria when swallowing window
• layout restore: When appending a layout containing a marked container, make
sure that any other containers with the same mark are unmarked during
insertion of the new container.
• use the EWMH support window rather than the root window as an input focus fallback
• use the focused container to determine the target window_mode when using
floating mode_toggle
┌────────────────────────────┐
│ Thanks! │
└────────────────────────────┘
Thanks for testing, bugfixes, discussions and everything I forgot go out to:
Andrzej Pronobis, Chris West (Faux), Deiz, Felix C. Stegerman, Georgiy Tugai,
hwangcc23, Ingo Bürk, Kacper Kowalik (Xarthisius), lasers, lambithal, Michael
Hofmann, Michael Tipton, Micha Rosenbaum, Nikita Mikhailov, Nils Schneider,
PopeLevi, rr-, shdown, Simon Nagl, Theo Buehler, Thomas Anderson, Tim Creech,
Tony Crisci
-- Michael Stapelberg, 2015-09-30

View File

@ -1,11 +1,14 @@
UNAME=$(shell uname) UNAME=$(shell uname)
DEBUG=1 DEBUG=1
COVERAGE=0
INSTALL=install INSTALL=install
LN=ln LN=ln
PKG_CONFIG=pkg-config
ifndef PREFIX ifndef PREFIX
PREFIX=/usr PREFIX=/usr
endif endif
ifndef EXEC_PREFIX
EXEC_PREFIX=$(PREFIX)
endif
ifndef SYSCONFDIR ifndef SYSCONFDIR
ifeq ($(PREFIX),/usr) ifeq ($(PREFIX),/usr)
SYSCONFDIR=/etc SYSCONFDIR=/etc
@ -60,7 +63,7 @@ I3_CPPFLAGS += -DI3__FILE__=__FILE__
## Libraries flags ## Libraries flags
ifeq ($(shell which pkg-config 2>/dev/null 1>/dev/null || echo 1),1) ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null 1>/dev/null || echo 1),1)
$(error "pkg-config was not found") $(error "pkg-config was not found")
endif endif
@ -74,15 +77,15 @@ endif
# #
# We redirect stderr to /dev/null because pkg-config prints an error if support # We redirect stderr to /dev/null because pkg-config prints an error if support
# for gnome-config was enabled but gnome-config is not actually installed. # for gnome-config was enabled but gnome-config is not actually installed.
cflags_for_lib = $(shell pkg-config --silence-errors --cflags $(1) 2>/dev/null) cflags_for_lib = $(shell $(PKG_CONFIG) --silence-errors --cflags $(1) 2>/dev/null)
ldflags_for_lib = $(shell pkg-config --exists 2>/dev/null $(1) && pkg-config --libs $(1) 2>/dev/null || echo -l$(2)) ldflags_for_lib = $(shell $(PKG_CONFIG) --exists 2>/dev/null $(1) && $(PKG_CONFIG) --libs $(1) 2>/dev/null || echo -l$(2))
# XCB common stuff # XCB common stuff
XCB_CFLAGS := $(call cflags_for_lib, xcb) XCB_CFLAGS := $(call cflags_for_lib, xcb)
XCB_CFLAGS += $(call cflags_for_lib, xcb-event) XCB_CFLAGS += $(call cflags_for_lib, xcb-event)
XCB_LIBS := $(call ldflags_for_lib, xcb,xcb) XCB_LIBS := $(call ldflags_for_lib, xcb,xcb)
XCB_LIBS += $(call ldflags_for_lib, xcb-event,xcb-event) XCB_LIBS += $(call ldflags_for_lib, xcb-event,xcb-event)
ifeq ($(shell pkg-config --exists xcb-util 2>/dev/null || echo 1),1) ifeq ($(shell $(PKG_CONFIG) --exists xcb-util 2>/dev/null || echo 1),1)
XCB_CFLAGS += $(call cflags_for_lib, xcb-atom) XCB_CFLAGS += $(call cflags_for_lib, xcb-atom)
XCB_CFLAGS += $(call cflags_for_lib, xcb-aux) XCB_CFLAGS += $(call cflags_for_lib, xcb-aux)
XCB_LIBS += $(call ldflags_for_lib, xcb-atom,xcb-atom) XCB_LIBS += $(call ldflags_for_lib, xcb-atom,xcb-atom)
@ -125,7 +128,7 @@ LIBEV_LIBS := $(call ldflags_for_lib, libev,ev)
# libpcre # libpcre
PCRE_CFLAGS := $(call cflags_for_lib, libpcre) PCRE_CFLAGS := $(call cflags_for_lib, libpcre)
ifeq ($(shell pkg-config --atleast-version=8.10 libpcre 2>/dev/null && echo 1),1) ifeq ($(shell $(PKG_CONFIG) --atleast-version=8.10 libpcre 2>/dev/null && echo 1),1)
I3_CPPFLAGS += -DPCRE_HAS_UCP=1 I3_CPPFLAGS += -DPCRE_HAS_UCP=1
endif endif
PCRE_LIBS := $(call ldflags_for_lib, libpcre,pcre) PCRE_LIBS := $(call ldflags_for_lib, libpcre,pcre)
@ -175,6 +178,10 @@ else ifneq ($(UNAME),OpenBSD)
LIBS += -lrt LIBS += -lrt
endif endif
ifeq ($(UNAME),SunOS)
LIBS += -lsocket -liconv -lgen
endif
ifneq (,$(filter Linux GNU GNU/%, $(UNAME))) ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
I3_CPPFLAGS += -D_GNU_SOURCE I3_CPPFLAGS += -D_GNU_SOURCE
endif endif

36
debian/changelog vendored
View File

@ -1,8 +1,40 @@
i3-wm (4.10.5-1) unstable; urgency=medium
* UNRELEASED
-- Michael Stapelberg <stapelberg@debian.org> Tue, 08 Sep 2015 09:25:45 +0200
i3-wm (4.10.4-1) unstable; urgency=medium
* New upstream release.
-- Michael Stapelberg <stapelberg@debian.org> Tue, 08 Sep 2015 09:15:45 +0200
i3-wm (4.10.3-1) unstable; urgency=medium
* New upstream release.
-- Michael Stapelberg <stapelberg@debian.org> Thu, 30 Jul 2015 21:51:27 +0200
i3-wm (4.10.2-2) unstable; urgency=medium
* New upstream release.
* experimental to unstable because i3-wm 4.10.2-1 was only in experimental
due to the freeze.
-- Michael Stapelberg <stapelberg@debian.org> Fri, 01 May 2015 20:21:18 +0200
i3-wm (4.10.2-1) experimental; urgency=medium
* New upstream release.
-- Michael Stapelberg <stapelberg@debian.org> Thu, 16 Apr 2015 09:02:53 +0200
i3-wm (4.10.1-1) experimental; urgency=medium i3-wm (4.10.1-1) experimental; urgency=medium
* NOT YET RELEASED. * New upstream release.
-- Michael Stapelberg <stapelberg@debian.org> Sun, 29 Mar 2015 18:08:13 +0200 -- Michael Stapelberg <stapelberg@debian.org> Sun, 29 Mar 2015 18:54:07 +0200
i3-wm (4.10-1) experimental; urgency=medium i3-wm (4.10-1) experimental; urgency=medium

1
debian/i3-wm.docs vendored
View File

@ -8,7 +8,6 @@ docs/snapping.png
docs/two_columns.png docs/two_columns.png
docs/two_terminals.png docs/two_terminals.png
docs/modes.png docs/modes.png
docs/stacklimit.png
docs/ipc.html docs/ipc.html
docs/multi-monitor.html docs/multi-monitor.html
docs/wsbar.html docs/wsbar.html

View File

@ -647,7 +647,7 @@ endif::doctype-manpage[]
</div> </div>
{disable-javascript%<div id="footnotes"><hr /></div>} {disable-javascript%<div id="footnotes"><hr /></div>}
<div id="footer" lang="de"> <div id="footer" lang="de">
© 2009-2014 Michael Stapelberg, <a href="http://i3wm.org/impress.html">Impressum</a> © 2009 Michael Stapelberg, <a href="http://i3wm.org/impress.html">Impressum</a>
</div> </div>
</body> </body>
</html> </html>

View File

@ -10,10 +10,10 @@ Thank you for being interested in debugging i3. It really means
something to us to get your bug fixed. If you have any questions about the something to us to get your bug fixed. If you have any questions about the
process and/or need further help, do not hesitate to contact us! process and/or need further help, do not hesitate to contact us!
== Verify you are using i3 ≥ 4.7 == Verify you are using i3 ≥ 4.10
Only the latest major version of i3 is supported, i.e. version 4.7 currently. Only the latest major version of i3 is supported. To verify which version
To verify which version you are running, use: you are running, use:
--------------- ---------------
$ i3 --moreversion 2>&- || i3 --version $ i3 --moreversion 2>&- || i3 --version
@ -67,8 +67,44 @@ fly:
i3-msg 'debuglog on; shmlog on; reload' i3-msg 'debuglog on; shmlog on; reload'
--------------------------------------- ---------------------------------------
== Reproducing the problem
Before submitting an issue, please make sure to close down on the problem as
much as you can yourself. Here are some steps you should consider:
* Find a deterministic, reliable way to reproduce the problem and provide it
with your bug report.
* Try using the default i3 config to reproduce the problem. If the issue does
not appear with the default config, gradually adapt it to track down what
change(s) to the config introduce the problem.
* Reproduce the problem with a minimal setup, i.e., only use as few applications,
windows and steps as necessary.
* In addition, try to stick to applications that are common and, even more
importantly, free / open source.
* Before obtaining the log file, restart i3 in-place, execute the steps to
reproduce the problem and then save the logs. This keeps the log file as
small as possible and necessary.
Please be aware that we cannot support compatibility issues with closed-source
software, as digging into compatibility problems without having access to the
source code is too time-consuming. Additionally, experience has shown that
often, the software in question is responsible for the issue. Please raise an
issue with the software in question, not i3.
== Obtaining the debug logfile == Obtaining the debug logfile
[CAUTION]
================================================================================
Logs may contain sensitive information, so please inspect the log before
submitting it. Logs may be viewed by anyone, once posted. If you choose to
redact the log, make an effort not to discard information which may be relevant
to the issue you are reporting.
The best way to avoid submitting such information is to only run the necessary
steps to reproduce the behavior when saving the log file. This will also make
analyzing the log file easier.
================================================================================
No matter whether i3 misbehaved in some way without crashing or whether it just No matter whether i3 misbehaved in some way without crashing or whether it just
crashed, the logfile provides all information necessary to debug the problem. crashed, the logfile provides all information necessary to debug the problem.
@ -121,3 +157,20 @@ When debugging with us in IRC, be prepared to use a so called nopaste service
such as http://nopaste.info or http://pastebin.com because pasting large such as http://nopaste.info or http://pastebin.com because pasting large
amounts of text in IRC sometimes leads to incomplete lines (servers have line amounts of text in IRC sometimes leads to incomplete lines (servers have line
length limitations) or flood kicks. length limitations) or flood kicks.
== Debugging i3bar
To debug i3bar problems, add +verbose yes+ to all +bar {}+ blocks in your i3
config, reload your config and then restart all i3bar instances like this:
---------------------------------------------------------------------
$ i3 reload
$ killall i3bar
$ for c in $(i3-msg -t get_bar_config | python -c \
'import json,sys;print("\n".join(json.load(sys.stdin)))'); do \
(i3bar --bar_id=$c >i3bar.$c.log 2>&1) & \
done;
---------------------------------------------------------------------
There will now be +i3bar.*.log+ files in your current directory that you can provide
in your bug report.

View File

@ -404,10 +404,14 @@ can reconfigure themselves).
== _NET_WM_STATE == _NET_WM_STATE
Only the _NET_WM_STATE_FULLSCREEN atom is handled. It calls Only the _NET_WM_STATE_FULLSCREEN and _NET_WM_STATE_DEMANDS_ATTENTION atoms
``toggle_fullscreen()'' for the specific client which just configures the are handled.
client to use the whole screen on which it currently is. Also, it is set as
fullscreen_client for the i3Screen. The former calls ``toggle_fullscreen()'' for the specific client which just
configures the client to use the whole screen on which it currently is.
Also, it is set as fullscreen_client for the i3Screen.
The latter is used to set, read and display urgency hints.
== WM_NAME == WM_NAME
@ -629,8 +633,8 @@ unmapped if it should not be visible anymore. +WM_STATE+ will be set to
+x_draw_decoration+ draws window decorations. It is run for every leaf +x_draw_decoration+ draws window decorations. It is run for every leaf
container (representing an actual X11 window) and for every non-leaf container container (representing an actual X11 window) and for every non-leaf container
which is in a stacked/tabbed container (because stacked/tabbed containers which is in a stacked/tabbed container (because stacked/tabbed containers
display a window decoration for split containers, which at the moment just says display a window decoration for split containers, which consists of a representation
"another container"). of the child container's names.
Then, parameters are collected to be able to determine whether this decoration Then, parameters are collected to be able to determine whether this decoration
drawing is actually necessary or was already done. This saves a substantial drawing is actually necessary or was already done. This saves a substantial
@ -686,9 +690,9 @@ all commands.
In earlier versions of i3, interpreting these commands was done using lex and In earlier versions of i3, interpreting these commands was done using lex and
yacc, but experience has shown that lex and yacc are not well suited for our yacc, but experience has shown that lex and yacc are not well suited for our
command language. Therefore, starting from version 4.2, we use a custom parser command language. Therefore, starting from version 4.2, we use a custom parser
for user commands (not yet for the configuration file). for user commands and the configuration file.
The input specification for this parser can be found in the file The input specification for this parser can be found in the file
+parser-specs/commands.spec+. Should you happen to use Vim as an editor, use +parser-specs/*.spec+. Should you happen to use Vim as an editor, use
:source parser-specs/highlighting.vim to get syntax highlighting for this file :source parser-specs/highlighting.vim to get syntax highlighting for this file
(highlighting files for other editors are welcome). (highlighting files for other editors are welcome).
@ -729,11 +733,14 @@ features. This is its definition:
# workspace next|prev|next_on_output|prev_on_output # workspace next|prev|next_on_output|prev_on_output
# workspace back_and_forth # workspace back_and_forth
# workspace <name> # workspace <name>
# workspace number <number>
state WORKSPACE: state WORKSPACE:
direction = 'next_on_output', 'prev_on_output', 'next', 'prev' direction = 'next_on_output', 'prev_on_output', 'next', 'prev'
-> call cmd_workspace($direction) -> call cmd_workspace($direction)
'back_and_forth' 'back_and_forth'
-> call cmd_workspace_back_and_forth() -> call cmd_workspace_back_and_forth()
'number'
-> WORKSPACE_NUMBER
workspace = string workspace = string
-> call cmd_workspace_name($workspace) -> call cmd_workspace_name($workspace)
---------------------------------------------------------------- ----------------------------------------------------------------
@ -772,6 +779,10 @@ workspace <name>::
single quotes), but just called string. Other possible tokens are word single quotes), but just called string. Other possible tokens are word
(the same as string, but stops matching at a whitespace) and end (the same as string, but stops matching at a whitespace) and end
(matches the end of the input). (matches the end of the input).
workspace number <number>::
The workspace command has to be followed by the keyword +number+. It
then transitions into the state +WORKSPACE_NUMBER+, where the actual
parameter will be read.
=== Introducing a new command === Introducing a new command
@ -952,30 +963,35 @@ http://web.archive.org/web/20121024222556/http://www.spheredev.org/wiki/Git_for_
or, for more documentation, see http://git-scm.com/documentation or, for more documentation, see http://git-scm.com/documentation
Please talk to us before working on new features to see whether they will be Please talk to us before working on new features to see whether they will be
accepted. There are a few things which we dont want to see in i3, e.g. a accepted. A good way for this is to open an issue and asking for opinions on it.
command which will focus windows in an alt+tab like way. Even for accepted features, this can be a good way to refine an idea upfront. However,
we don't want to see certain features in i3, e.g., switching window focus in an
Alt+Tab like way.
When working on bugfixes, please make sure you mention that you are working on When working on bugfixes, please make sure you mention that you are working on
it in the corresponding bugreport at https://github.com/i3/i3/issues In case it in the corresponding bug report at https://github.com/i3/i3/issues. In case
there is no bug report yet, please create one. there is no bug report yet, please create one.
After you are done, please submit your work for review at https://github.com/i3/i3 After you are done, please submit your work for review as a pull request at
https://github.com/i3/i3.
Do not send emails to the mailing list or any author directly, and dont submit Do not send emails to the mailing list or any author directly, and dont submit
them in the bugtracker, since all reviews should be done in public at them in the bugtracker, since all reviews should be done in public at
http://cr.i3wm.org/. In order to make your review go as fast as possible, you https://github.com/i3/i3. In order to make your review go as fast as possible, you
could have a look at previous reviews and see what the common mistakes are. could have a look at previous reviews and see what the common mistakes are.
=== Which branch to use? === Which branch to use?
Work on i3 generally happens in two branches: “master” and “next”. Since Work on i3 generally happens in two branches: “master” and “next” (the latter
“master” is what people get when they check out the git repository, its being the default branch, the one that people get when they check out the git
contents are always stable. That is, it contains the source code of the latest repository).
release, plus any bugfixes that were applied since that release.
The contents of “master” are always stable. That is, it contains the source code
of the latest release, plus any bugfixes that were applied since that release.
New features are only found in the “next” branch. Therefore, if you are working New features are only found in the “next” branch. Therefore, if you are working
on a new feature, use the “next” branch. If you are working on a bugfix, use on a new feature, use the “next” branch. If you are working on a bugfix, use the
the “next” branch, too, but make sure your code also works on “master”. “next” branch, too, but make sure your code also works on “master”.
== Thought experiments == Thought experiments

View File

@ -520,21 +520,23 @@ statusline::
Text color to be used for the statusline. Text color to be used for the statusline.
separator:: separator::
Text color to be used for the separator. Text color to be used for the separator.
focused_workspace_text/focused_workspace_bg:: focused_workspace_text/focused_workspace_bg/focused_workspace_border::
Text color/background color for a workspace button when the workspace Text/background/border color for a workspace button when the workspace
has focus. has focus.
active_workspace_text/active_workspace_bg:: active_workspace_text/active_workspace_bg/active_workspace_border::
Text color/background color for a workspace button when the workspace Text/background/border color for a workspace button when the workspace
is active (visible) on some output, but the focus is on another one. is active (visible) on some output, but the focus is on another one.
You can only tell this apart from the focused workspace when you are You can only tell this apart from the focused workspace when you are
using multiple monitors. using multiple monitors.
inactive_workspace_text/inactive_workspace_bg:: inactive_workspace_text/inactive_workspace_bg/inactive_workspace_border::
Text color/background color for a workspace button when the workspace Text/background/border color for a workspace button when the workspace
does not have focus and is not active (visible) on any output. This does not have focus and is not active (visible) on any output. This
will be the case for most workspaces. will be the case for most workspaces.
urgent_workspace_text/urgent_workspace_bar:: urgent_workspace_text/urgent_workspace_bg/urgent_workspace_border::
Text color/background color for workspaces which contain at least one Text/background/border color for workspaces which contain at least one
window with the urgency hint set. window with the urgency hint set.
binding_mode_text/binding_mode_bg/binding_mode_border::
Text/background/border color for the binding mode indicator.
*Example of configured bars:* *Example of configured bars:*
@ -580,11 +582,14 @@ human_readable (string)::
build date and branch name. When you need to display the i3 version to build date and branch name. When you need to display the i3 version to
your users, use the human-readable version whenever possible (since your users, use the human-readable version whenever possible (since
this is what +i3 --version+ displays, too). this is what +i3 --version+ displays, too).
loaded_config_file_name (string)::
The current config path.
*Example:* *Example:*
------------------- -------------------
{ {
"human_readable" : "4.2-169-gf80b877 (2012-08-05, branch \"next\")", "human_readable" : "4.2-169-gf80b877 (2012-08-05, branch \"next\")",
"loaded_config_file_name" : "/home/hwangcc23/.i3/config",
"minor" : 2, "minor" : 2,
"patch" : 0, "patch" : 0,
"major" : 4 "major" : 4
@ -768,8 +773,8 @@ The +binding (object)+ field contains details about the binding that was run:
command (string):: command (string)::
The i3 command that is configured to run for this binding. The i3 command that is configured to run for this binding.
mods (array of strings):: event_state_mask (array of strings)::
The modifier keys that were configured with this binding. The group and modifier keys that were configured with this binding.
input_code (integer):: input_code (integer)::
If the binding was configured with +bindcode+, this will be the key code If the binding was configured with +bindcode+, this will be the key code
that was given for the binding. If the binding is a mouse binding, it will be that was given for the binding. If the binding is a mouse binding, it will be
@ -787,7 +792,7 @@ input_type (string)::
"change": "run", "change": "run",
"binding": { "binding": {
"command": "nop", "command": "nop",
"mods": [ "event_state_mask": [
"shift", "shift",
"ctrl" "ctrl"
], ],
@ -822,4 +827,7 @@ Python::
* https://github.com/whitelynx/i3ipc (not maintained) * https://github.com/whitelynx/i3ipc (not maintained)
* https://github.com/ziberna/i3-py (not maintained) * https://github.com/ziberna/i3-py (not maintained)
Ruby:: Ruby::
* http://github.com/badboy/i3-ipc * https://github.com/veelenga/i3ipc-ruby
* https://github.com/badboy/i3-ipc (not maintained)
Rust::
* https://github.com/tmerr/i3ipc-rs

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -160,6 +160,27 @@ $ ./complete-run.pl --parallel=1 --keep-xserver-output
This will show the output of Xephyr, which is the X server implementation we This will show the output of Xephyr, which is the X server implementation we
use for testing. use for testing.
==== Coverage testing
Coverage testing is possible with +lcov+, the front-end for GCC's coverage
testing tool +gcov+. The testcases can generate a nice html report that tells
you which functions and lines were covered during a run of the tests. You can
use this tool to judge how effective your tests are.
To use test coverage tools, first compile with coverage enabled.
---------------------------------------------------
COVERAGE=1 make
---------------------------------------------------
Then run the tests with the +--coverage-testing+ flag.
---------------------------------------------------
./complete-run.pl --coverage-testing
---------------------------------------------------
Then open +latest/i3-coverage/index.html+ in your web browser.
==== IPC interface ==== IPC interface
The testsuite makes extensive use of the IPC (Inter-Process Communication) The testsuite makes extensive use of the IPC (Inter-Process Communication)

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
# vim:ts=4:sw=4:expandtab # vim:ts=4:sw=4:expandtab
# #
# i3 - an improved dynamic tiling window manager # i3 - an improved dynamic tiling window manager
# © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) # © 2009 Michael Stapelberg and contributors (see also: LICENSE)
# #
# generate-command-parser.pl: script to generate parts of the command parser # generate-command-parser.pl: script to generate parts of the command parser
# from its specification file parser-specs/commands.spec. # from its specification file parser-specs/commands.spec.
@ -112,7 +112,7 @@ for my $line (@lines) {
# We sort descendingly by length to be able to replace occurences of the state # We sort descendingly by length to be able to replace occurences of the state
# name even when one states name is included in another ones (like FOR_WINDOW # name even when one states name is included in another ones (like FOR_WINDOW
# is in FOR_WINDOW_COMMAND). # is in FOR_WINDOW_COMMAND).
my @keys = sort { length($b) <=> length($a) } keys %states; my @keys = sort { (length($b) <=> length($a)) or ($a cmp $b) } keys %states;
open(my $enumfh, '>', "GENERATED_${prefix}_enums.h"); open(my $enumfh, '>', "GENERATED_${prefix}_enums.h");

View File

@ -20,8 +20,8 @@ i3-config-wizard/i3-config-wizard: libi3.a $(i3_config_wizard_OBJECTS)
install-i3-config-wizard: i3-config-wizard/i3-config-wizard install-i3-config-wizard: i3-config-wizard/i3-config-wizard
echo "[i3-config-wizard] Install" echo "[i3-config-wizard] Install"
$(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/bin $(INSTALL) -d -m 0755 $(DESTDIR)$(EXEC_PREFIX)/bin
$(INSTALL) -m 0755 i3-config-wizard/i3-config-wizard $(DESTDIR)$(PREFIX)/bin/ $(INSTALL) -m 0755 i3-config-wizard/i3-config-wizard $(DESTDIR)$(EXEC_PREFIX)/bin/
clean-i3-config-wizard: clean-i3-config-wizard:
echo "[i3-config-wizard] Clean" echo "[i3-config-wizard] Clean"

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* i3-config-wizard: Program to convert configs using keycodes to configs using * i3-config-wizard: Program to convert configs using keycodes to configs using
* keysyms. * keysyms.
@ -392,7 +392,7 @@ static char *rewrite_binding(const char *input) {
} }
} }
if (walk != beginning) { if (walk != beginning) {
char *str = scalloc(walk - beginning + 1); char *str = scalloc(walk - beginning + 1, 1);
/* We copy manually to handle escaping of characters. */ /* We copy manually to handle escaping of characters. */
int inpos, outpos; int inpos, outpos;
for (inpos = 0, outpos = 0; for (inpos = 0, outpos = 0;
@ -461,38 +461,6 @@ void errorlog(char *fmt, ...) {
void debuglog(char *fmt, ...) { void debuglog(char *fmt, ...) {
} }
/*
* This function resolves ~ in pathnames.
* It may resolve wildcards in the first part of the path, but if no match
* or multiple matches are found, it just returns a copy of path as given.
*
*/
static char *resolve_tilde(const char *path) {
static glob_t globbuf;
char *head, *tail, *result;
tail = strchr(path, '/');
head = strndup(path, tail ? (size_t)(tail - path) : strlen(path));
int res = glob(head, GLOB_TILDE, NULL, &globbuf);
free(head);
/* no match, or many wildcard matches are bad */
if (res == GLOB_NOMATCH || globbuf.gl_pathc != 1)
result = strdup(path);
else if (res != 0) {
err(1, "glob() failed");
} else {
head = globbuf.gl_pathv[0];
result = calloc(1, strlen(head) + (tail ? strlen(tail) : 0) + 1);
strncpy(result, head, strlen(head));
if (tail)
strncat(result, tail, strlen(tail));
}
globfree(&globbuf);
return result;
}
/* /*
* Handles expose events, that is, draws the window contents. * Handles expose events, that is, draws the window contents.
* *
@ -514,17 +482,23 @@ static int handle_expose() {
set_font_colors(pixmap_gc, get_colorpixel("#FFFFFF"), get_colorpixel("#000000")); set_font_colors(pixmap_gc, get_colorpixel("#FFFFFF"), get_colorpixel("#000000"));
txt(logical_px(10), 2, "You have not configured i3 yet."); txt(logical_px(10), 2, "You have not configured i3 yet.");
txt(logical_px(10), 3, "Do you want me to generate ~/.i3/config?"); txt(logical_px(10), 3, "Do you want me to generate a config at");
txt(logical_px(85), 5, "Yes, generate ~/.i3/config");
txt(logical_px(85), 7, "No, I will use the defaults"); char *msg;
sasprintf(&msg, "%s?", config_path);
txt(logical_px(10), 4, msg);
free(msg);
txt(logical_px(85), 6, "Yes, generate the config");
txt(logical_px(85), 8, "No, I will use the defaults");
/* green */ /* green */
set_font_colors(pixmap_gc, get_colorpixel("#00FF00"), get_colorpixel("#000000")); set_font_colors(pixmap_gc, get_colorpixel("#00FF00"), get_colorpixel("#000000"));
txt(logical_px(25), 5, "<Enter>"); txt(logical_px(25), 6, "<Enter>");
/* red */ /* red */
set_font_colors(pixmap_gc, get_colorpixel("#FF0000"), get_colorpixel("#000000")); set_font_colors(pixmap_gc, get_colorpixel("#FF0000"), get_colorpixel("#000000"));
txt(logical_px(31), 7, "<ESC>"); txt(logical_px(31), 8, "<ESC>");
} }
if (current_step == STEP_GENERATE) { if (current_step == STEP_GENERATE) {
@ -534,7 +508,7 @@ static int handle_expose() {
txt(logical_px(85), 4, "Win as default modifier"); txt(logical_px(85), 4, "Win as default modifier");
txt(logical_px(85), 5, "Alt as default modifier"); txt(logical_px(85), 5, "Alt as default modifier");
txt(logical_px(10), 7, "Afterwards, press"); txt(logical_px(10), 7, "Afterwards, press");
txt(logical_px(85), 9, "to write ~/.i3/config"); txt(logical_px(85), 9, "to write the config");
txt(logical_px(85), 10, "to abort"); txt(logical_px(85), 10, "to abort");
/* the not-selected modifier */ /* the not-selected modifier */
@ -772,7 +746,7 @@ static void finish() {
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
config_path = resolve_tilde("~/.i3/config"); char *xdg_config_home;
socket_path = getenv("I3SOCK"); socket_path = getenv("I3SOCK");
char *pattern = "pango:monospace 8"; char *pattern = "pango:monospace 8";
char *patternbold = "pango:monospace bold 8"; char *patternbold = "pango:monospace bold 8";
@ -794,7 +768,7 @@ int main(int argc, char *argv[]) {
switch (o) { switch (o) {
case 's': case 's':
FREE(socket_path); FREE(socket_path);
socket_path = strdup(optarg); socket_path = sstrdup(optarg);
break; break;
case 'v': case 'v':
printf("i3-config-wizard " I3_VERSION "\n"); printf("i3-config-wizard " I3_VERSION "\n");
@ -806,20 +780,29 @@ int main(int argc, char *argv[]) {
} }
} }
/* Check if the destination config file does not exist but the path is char *path = get_config_path(NULL, false);
* writable. If not, exit now, this program is not useful in that case. */ if (path != NULL) {
struct stat stbuf; printf("The config file \"%s\" already exists. Exiting.\n", path);
if (stat(config_path, &stbuf) == 0) { free(path);
printf("The config file \"%s\" already exists. Exiting.\n", config_path);
return 0; return 0;
} }
/* Create ~/.i3 if it does not yet exist */ /* Always write to $XDG_CONFIG_HOME/i3/config by default. */
char *config_dir = resolve_tilde("~/.i3"); if ((xdg_config_home = getenv("XDG_CONFIG_HOME")) == NULL)
xdg_config_home = "~/.config";
xdg_config_home = resolve_tilde(xdg_config_home);
sasprintf(&config_path, "%s/i3/config", xdg_config_home);
/* Create $XDG_CONFIG_HOME/i3 if it does not yet exist */
char *config_dir;
struct stat stbuf;
sasprintf(&config_dir, "%s/i3", xdg_config_home);
if (stat(config_dir, &stbuf) != 0) if (stat(config_dir, &stbuf) != 0)
if (mkdir(config_dir, 0755) == -1) if (mkdirp(config_dir, DEFAULT_DIR_MODE) != 0)
err(1, "mkdir(%s) failed", config_dir); err(EXIT_FAILURE, "mkdirp(%s) failed", config_dir);
free(config_dir); free(config_dir);
free(xdg_config_home);
int fd; int fd;
if ((fd = open(config_path, O_CREAT | O_RDWR, 0644)) == -1) { if ((fd = open(config_path, O_CREAT | O_RDWR, 0644)) == -1) {

View File

@ -1,7 +1,7 @@
#!/usr/bin/env perl #!/usr/bin/env perl
# vim:ts=4:sw=4:expandtab # vim:ts=4:sw=4:expandtab
# #
# © 2012-2014 Michael Stapelberg # © 2012 Michael Stapelberg
# #
# No dependencies except for perl ≥ v5.10 # No dependencies except for perl ≥ v5.10
@ -45,7 +45,7 @@ my $result = GetOptions(
'dmenu=s' => \$dmenu_cmd, 'dmenu=s' => \$dmenu_cmd,
'entry-type=s' => \@entry_types, 'entry-type=s' => \@entry_types,
'version' => sub { 'version' => sub {
say "dmenu-desktop 1.5 © 2012-2013 Michael Stapelberg"; say "dmenu-desktop 1.5 © 2012 Michael Stapelberg";
exit 0; exit 0;
}, },
'help' => sub { 'help' => sub {

View File

@ -20,8 +20,8 @@ i3-dump-log/i3-dump-log: libi3.a $(i3_dump_log_OBJECTS)
install-i3-dump-log: i3-dump-log/i3-dump-log install-i3-dump-log: i3-dump-log/i3-dump-log
echo "[i3-dump-log] Install" echo "[i3-dump-log] Install"
$(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/bin $(INSTALL) -d -m 0755 $(DESTDIR)$(EXEC_PREFIX)/bin
$(INSTALL) -m 0755 i3-dump-log/i3-dump-log $(DESTDIR)$(PREFIX)/bin/ $(INSTALL) -m 0755 i3-dump-log/i3-dump-log $(DESTDIR)$(EXEC_PREFIX)/bin/
clean-i3-dump-log: clean-i3-dump-log:
echo "[i3-dump-log] Clean" echo "[i3-dump-log] Clean"

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* i3-dump-log/main.c: Dumps the i3 SHM log to stdout. * i3-dump-log/main.c: Dumps the i3 SHM log to stdout.
* *

View File

@ -20,8 +20,8 @@ i3-input/i3-input: libi3.a $(i3_input_OBJECTS)
install-i3-input: i3-input/i3-input install-i3-input: i3-input/i3-input
echo "[i3-input] Install" echo "[i3-input] Install"
$(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/bin $(INSTALL) -d -m 0755 $(DESTDIR)$(EXEC_PREFIX)/bin
$(INSTALL) -m 0755 i3-input/i3-input $(DESTDIR)$(PREFIX)/bin/ $(INSTALL) -m 0755 i3-input/i3-input $(DESTDIR)$(EXEC_PREFIX)/bin/
clean-i3-input: clean-i3-input:
echo "[i3-input] Clean" echo "[i3-input] Clean"

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* i3-input/main.c: Utility which lets the user input commands and sends them * i3-input/main.c: Utility which lets the user input commands and sends them
* to i3. * to i3.
@ -103,7 +103,7 @@ static void restore_input_focus(void) {
* *
*/ */
static uint8_t *concat_strings(char **glyphs, int max) { static uint8_t *concat_strings(char **glyphs, int max) {
uint8_t *output = calloc(max + 1, 4); uint8_t *output = scalloc(max + 1, 4);
uint8_t *walk = output; uint8_t *walk = output;
for (int c = 0; c < max; c++) { for (int c = 0; c < max; c++) {
printf("at %c\n", glyphs[c][0]); printf("at %c\n", glyphs[c][0]);
@ -187,10 +187,10 @@ static void finish_input() {
/* allocate space for the output */ /* allocate space for the output */
int inputlen = strlen(command); int inputlen = strlen(command);
char *full = calloc(1, char *full = scalloc(strlen(format) - (2 * cnt) /* format without all %s */
strlen(format) - (2 * cnt) /* format without all %s */
+ (inputlen * cnt) /* replaced %s */ + (inputlen * cnt) /* replaced %s */
+ 1); /* trailing NUL */ + 1, /* trailing NUL */
1);
char *dest = full; char *dest = full;
for (c = 0; c < len; c++) { for (c = 0; c < len; c++) {
/* if this is not % or it is % but without a following 's', /* if this is not % or it is % but without a following 's',
@ -314,8 +314,52 @@ static int handle_key_press(void *ignored, xcb_connection_t *conn, xcb_key_press
return 1; return 1;
} }
static xcb_rectangle_t get_window_position(void) {
xcb_rectangle_t result = (xcb_rectangle_t){logical_px(50), logical_px(50), logical_px(500), font.height + logical_px(8)};
xcb_get_input_focus_reply_t *input_focus = NULL;
xcb_get_geometry_reply_t *geometry = NULL;
xcb_translate_coordinates_reply_t *coordinates = NULL;
/* In rare cases, the window holding the input focus might disappear while we are figuring out its
* position. To avoid this, we grab the server in the meantime. */
xcb_grab_server(conn);
input_focus = xcb_get_input_focus_reply(conn, xcb_get_input_focus(conn), NULL);
if (input_focus == NULL || input_focus->focus == XCB_NONE) {
DLOG("Failed to receive the current input focus or no window has the input focus right now.\n");
goto free_resources;
}
geometry = xcb_get_geometry_reply(conn, xcb_get_geometry(conn, input_focus->focus), NULL);
if (geometry == NULL) {
DLOG("Failed to received window geometry.\n");
goto free_resources;
}
coordinates = xcb_translate_coordinates_reply(
conn, xcb_translate_coordinates(conn, input_focus->focus, root, geometry->x, geometry->y), NULL);
if (coordinates == NULL) {
DLOG("Failed to translate coordinates.\n");
goto free_resources;
}
DLOG("Determined coordinates of window with input focus at x = %i / y = %i.\n", coordinates->dst_x, coordinates->dst_y);
result.x += coordinates->dst_x;
result.y += coordinates->dst_y;
free_resources:
xcb_ungrab_server(conn);
xcb_flush(conn);
FREE(input_focus);
FREE(geometry);
FREE(coordinates);
return result;
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
format = strdup("%s"); format = sstrdup("%s");
socket_path = getenv("I3SOCK"); socket_path = getenv("I3SOCK");
char *pattern = sstrdup("pango:monospace 8"); char *pattern = sstrdup("pango:monospace 8");
int o, option_index = 0; int o, option_index = 0;
@ -337,7 +381,7 @@ int main(int argc, char *argv[]) {
switch (o) { switch (o) {
case 's': case 's':
FREE(socket_path); FREE(socket_path);
socket_path = strdup(optarg); socket_path = sstrdup(optarg);
break; break;
case 'v': case 'v':
printf("i3-input " I3_VERSION); printf("i3-input " I3_VERSION);
@ -357,11 +401,11 @@ int main(int argc, char *argv[]) {
break; break;
case 'f': case 'f':
FREE(pattern); FREE(pattern);
pattern = strdup(optarg); pattern = sstrdup(optarg);
break; break;
case 'F': case 'F':
FREE(format); FREE(format);
format = strdup(optarg); format = sstrdup(optarg);
break; break;
case 'h': case 'h':
printf("i3-input " I3_VERSION "\n"); printf("i3-input " I3_VERSION "\n");
@ -402,6 +446,8 @@ int main(int argc, char *argv[]) {
if (prompt != NULL) if (prompt != NULL)
prompt_offset = predict_text_width(prompt); prompt_offset = predict_text_width(prompt);
const xcb_rectangle_t win_pos = get_window_position();
/* Open an input window */ /* Open an input window */
win = xcb_generate_id(conn); win = xcb_generate_id(conn);
xcb_create_window( xcb_create_window(
@ -409,7 +455,7 @@ int main(int argc, char *argv[]) {
XCB_COPY_FROM_PARENT, XCB_COPY_FROM_PARENT,
win, /* the window id */ win, /* the window id */
root, /* parent == root */ root, /* parent == root */
logical_px(50), logical_px(50), logical_px(500), font.height + logical_px(8), /* dimensions */ win_pos.x, win_pos.y, win_pos.width, win_pos.height, /* dimensions */
0, /* X11 border = 0, we draw our own */ 0, /* X11 border = 0, we draw our own */
XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_WINDOW_CLASS_INPUT_OUTPUT,
XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */ XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */

View File

@ -117,7 +117,6 @@ for my $line (@lines) {
# new_container changed only the statement name to workspace_layout # new_container changed only the statement name to workspace_layout
if ($statement eq 'new_container') { if ($statement eq 'new_container') {
# TODO: new_container stack-limit
print "workspace_layout$parameters\n"; print "workspace_layout$parameters\n";
next; next;
} }
@ -184,7 +183,6 @@ sub convert_command {
restart restart
reload reload
exit exit
stack-limit
); );
my ($statement, $key, $command) = ($line =~ /([a-zA-Z_-]+)\s+([^\s]+)\s+(.*)/); my ($statement, $key, $command) = ($line =~ /([a-zA-Z_-]+)\s+([^\s]+)\s+(.*)/);

View File

@ -20,8 +20,8 @@ i3-msg/i3-msg: libi3.a $(i3_msg_OBJECTS)
install-i3-msg: i3-msg/i3-msg install-i3-msg: i3-msg/i3-msg
echo "[i3-msg] Install" echo "[i3-msg] Install"
$(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/bin $(INSTALL) -d -m 0755 $(DESTDIR)$(EXEC_PREFIX)/bin
$(INSTALL) -m 0755 i3-msg/i3-msg $(DESTDIR)$(PREFIX)/bin/ $(INSTALL) -m 0755 i3-msg/i3-msg $(DESTDIR)$(EXEC_PREFIX)/bin/
clean-i3-msg: clean-i3-msg:
echo "[i3-msg] Clean" echo "[i3-msg] Clean"

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* i3-msg/main.c: Utility which sends messages to a running i3-instance using * i3-msg/main.c: Utility which sends messages to a running i3-instance using
* IPC via UNIX domain sockets. * IPC via UNIX domain sockets.
@ -77,7 +77,7 @@ static int reply_boolean_cb(void *params, int val) {
} }
static int reply_string_cb(void *params, const unsigned char *val, size_t len) { static int reply_string_cb(void *params, const unsigned char *val, size_t len) {
char *str = scalloc(len + 1); char *str = scalloc(len + 1, 1);
strncpy(str, (const char *)val, len); strncpy(str, (const char *)val, len);
if (strcmp(last_key, "error") == 0) if (strcmp(last_key, "error") == 0)
last_reply.error = str; last_reply.error = str;
@ -105,7 +105,7 @@ static int reply_end_map_cb(void *params) {
static int reply_map_key_cb(void *params, const unsigned char *keyVal, size_t keyLen) { static int reply_map_key_cb(void *params, const unsigned char *keyVal, size_t keyLen) {
free(last_key); free(last_key);
last_key = scalloc(keyLen + 1); last_key = scalloc(keyLen + 1, 1);
strncpy(last_key, (const char *)keyVal, keyLen); strncpy(last_key, (const char *)keyVal, keyLen);
return 1; return 1;
} }
@ -191,8 +191,7 @@ int main(int argc, char *argv[]) {
payload = sstrdup(argv[optind]); payload = sstrdup(argv[optind]);
} else { } else {
char *both; char *both;
if (asprintf(&both, "%s %s", payload, argv[optind]) == -1) sasprintf(&both, "%s %s", payload, argv[optind]);
err(EXIT_FAILURE, "asprintf");
free(payload); free(payload);
payload = both; payload = both;
} }

View File

@ -4,8 +4,8 @@ CLEAN_TARGETS += clean-i3-nagbar
i3_nagbar_SOURCES := $(wildcard i3-nagbar/*.c) i3_nagbar_SOURCES := $(wildcard i3-nagbar/*.c)
i3_nagbar_HEADERS := $(wildcard i3-nagbar/*.h) i3_nagbar_HEADERS := $(wildcard i3-nagbar/*.h)
i3_nagbar_CFLAGS = $(XCB_CFLAGS) $(PANGO_CFLAGS) i3_nagbar_CFLAGS = $(XCB_CFLAGS) $(XCB_WM_CFLAGS) $(PANGO_CFLAGS)
i3_nagbar_LIBS = $(XCB_LIBS) $(PANGO_LIBS) i3_nagbar_LIBS = $(XCB_LIBS) $(XCB_WM_LIBS) $(PANGO_LIBS)
i3_nagbar_OBJECTS := $(i3_nagbar_SOURCES:.c=.o) i3_nagbar_OBJECTS := $(i3_nagbar_SOURCES:.c=.o)
@ -20,8 +20,8 @@ i3-nagbar/i3-nagbar: libi3.a $(i3_nagbar_OBJECTS)
install-i3-nagbar: i3-nagbar/i3-nagbar install-i3-nagbar: i3-nagbar/i3-nagbar
echo "[i3-nagbar] Install" echo "[i3-nagbar] Install"
$(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/bin $(INSTALL) -d -m 0755 $(DESTDIR)$(EXEC_PREFIX)/bin
$(INSTALL) -m 0755 i3-nagbar/i3-nagbar $(DESTDIR)$(PREFIX)/bin/ $(INSTALL) -m 0755 i3-nagbar/i3-nagbar $(DESTDIR)$(EXEC_PREFIX)/bin/
clean-i3-nagbar: clean-i3-nagbar:
echo "[i3-nagbar] Clean" echo "[i3-nagbar] Clean"

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* i3-nagbar is a utility which displays a nag message, for example in the case * i3-nagbar is a utility which displays a nag message, for example in the case
* when the user has an error in their configuration file. * when the user has an error in their configuration file.
@ -27,6 +27,7 @@
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_aux.h> #include <xcb/xcb_aux.h>
#include <xcb/xcb_event.h> #include <xcb/xcb_event.h>
#include <xcb/randr.h>
#include "libi3.h" #include "libi3.h"
#include "i3-nagbar.h" #include "i3-nagbar.h"
@ -288,6 +289,60 @@ static int handle_expose(xcb_connection_t *conn, xcb_expose_event_t *event) {
return 1; return 1;
} }
/**
* Return the position and size the i3-nagbar window should use.
* This will be the primary output or a fallback if it cannot be determined.
*/
static xcb_rectangle_t get_window_position(void) {
/* Default values if we cannot determine the primary output or its CRTC info. */
xcb_rectangle_t result = (xcb_rectangle_t){50, 50, 500, font.height + logical_px(8) + logical_px(8)};
xcb_randr_get_screen_resources_current_cookie_t rcookie = xcb_randr_get_screen_resources_current(conn, root);
xcb_randr_get_output_primary_cookie_t pcookie = xcb_randr_get_output_primary(conn, root);
xcb_randr_get_output_primary_reply_t *primary = NULL;
xcb_randr_get_screen_resources_current_reply_t *res = NULL;
if ((primary = xcb_randr_get_output_primary_reply(conn, pcookie, NULL)) == NULL) {
DLOG("Could not determine the primary output.\n");
goto free_resources;
}
if ((res = xcb_randr_get_screen_resources_current_reply(conn, rcookie, NULL)) == NULL) {
goto free_resources;
}
xcb_randr_get_output_info_reply_t *output =
xcb_randr_get_output_info_reply(conn,
xcb_randr_get_output_info(conn, primary->output, res->config_timestamp),
NULL);
if (output == NULL || output->crtc == XCB_NONE)
goto free_resources;
xcb_randr_get_crtc_info_reply_t *crtc =
xcb_randr_get_crtc_info_reply(conn,
xcb_randr_get_crtc_info(conn, output->crtc, res->config_timestamp),
NULL);
if (crtc == NULL)
goto free_resources;
DLOG("Found primary output on position x = %i / y = %i / w = %i / h = %i.\n",
crtc->x, crtc->y, crtc->width, crtc->height);
if (crtc->width == 0 || crtc->height == 0) {
DLOG("Primary output is not active, ignoring it.\n");
goto free_resources;
}
result.x = crtc->x;
result.y = crtc->y;
goto free_resources;
free_resources:
FREE(res);
FREE(primary);
return result;
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
/* The following lines are a terribly horrible kludge. Because terminal /* The following lines are a terribly horrible kludge. Because terminal
* emulators have different ways of interpreting the -e command line * emulators have different ways of interpreting the -e command line
@ -316,7 +371,7 @@ int main(int argc, char *argv[]) {
if (argv0_len > strlen(".nagbar_cmd") && if (argv0_len > strlen(".nagbar_cmd") &&
strcmp(argv[0] + argv0_len - strlen(".nagbar_cmd"), ".nagbar_cmd") == 0) { strcmp(argv[0] + argv0_len - strlen(".nagbar_cmd"), ".nagbar_cmd") == 0) {
unlink(argv[0]); unlink(argv[0]);
cmd = strdup(argv[0]); cmd = sstrdup(argv[0]);
*(cmd + argv0_len - strlen(".nagbar_cmd")) = '\0'; *(cmd + argv0_len - strlen(".nagbar_cmd")) = '\0';
execl("/bin/sh", "/bin/sh", cmd, NULL); execl("/bin/sh", "/bin/sh", cmd, NULL);
err(EXIT_FAILURE, "execv(/bin/sh, /bin/sh, %s)", cmd); err(EXIT_FAILURE, "execv(/bin/sh, /bin/sh, %s)", cmd);
@ -363,7 +418,7 @@ int main(int argc, char *argv[]) {
printf("i3-nagbar [-m <message>] [-b <button> <action>] [-t warning|error] [-f <font>] [-v]\n"); printf("i3-nagbar [-m <message>] [-b <button> <action>] [-t warning|error] [-f <font>] [-v]\n");
return 0; return 0;
case 'b': case 'b':
buttons = realloc(buttons, sizeof(button_t) * (buttoncnt + 1)); buttons = srealloc(buttons, sizeof(button_t) * (buttoncnt + 1));
buttons[buttoncnt].label = i3string_from_utf8(optarg); buttons[buttoncnt].label = i3string_from_utf8(optarg);
buttons[buttoncnt].action = argv[optind]; buttons[buttoncnt].action = argv[optind];
printf("button with label *%s* and action *%s*\n", printf("button with label *%s* and action *%s*\n",
@ -410,6 +465,8 @@ int main(int argc, char *argv[]) {
font = load_font(pattern, true); font = load_font(pattern, true);
set_font(&font); set_font(&font);
xcb_rectangle_t win_pos = get_window_position();
/* Open an input window */ /* Open an input window */
win = xcb_generate_id(conn); win = xcb_generate_id(conn);
@ -418,7 +475,7 @@ int main(int argc, char *argv[]) {
XCB_COPY_FROM_PARENT, XCB_COPY_FROM_PARENT,
win, /* the window id */ win, /* the window id */
root, /* parent == root */ root, /* parent == root */
50, 50, 500, font.height + logical_px(8) + logical_px(8) /* 8 px padding */, /* dimensions */ win_pos.x, win_pos.y, win_pos.width, win_pos.height, /* dimensions */
0, /* x11 border = 0, we draw our own */ 0, /* x11 border = 0, we draw our own */
XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_WINDOW_CLASS_INPUT_OUTPUT,
XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */ XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */

View File

@ -1,7 +1,7 @@
#!/usr/bin/env perl #!/usr/bin/env perl
# vim:ts=4:sw=4:expandtab # vim:ts=4:sw=4:expandtab
# #
# © 2013-2014 Michael Stapelberg # © 2013 Michael Stapelberg
# #
# Requires perl ≥ v5.10, AnyEvent::I3 and JSON::XS # Requires perl ≥ v5.10, AnyEvent::I3 and JSON::XS
@ -99,6 +99,7 @@ my %allowed_keys = map { ($_, 1) } qw(
geometry geometry
window_properties window_properties
mark mark
rect
); );
sub strip_containers { sub strip_containers {
@ -116,6 +117,9 @@ sub strip_containers {
delete $tree->{geometry} if zero_rect($tree->{geometry}); delete $tree->{geometry} if zero_rect($tree->{geometry});
# Retain the rect for floating containers to keep their positions.
delete $tree->{rect} unless $tree->{type} eq 'floating_con';
delete $tree->{current_border_width} if $tree->{current_border_width} == -1; delete $tree->{current_border_width} if $tree->{current_border_width} == -1;
for my $key (keys %$tree) { for my $key (keys %$tree) {

View File

@ -11,7 +11,7 @@
# Hopefully one of these is installed (no flamewars about preference please!): # Hopefully one of these is installed (no flamewars about preference please!):
# We don't use 'more' because it will exit if the file is too short. # We don't use 'more' because it will exit if the file is too short.
# Worst case scenario we'll open the file in your editor. # Worst case scenario we'll open the file in your editor.
for pager in $PAGER less most w3m i3-sensible-editor; do for pager in $PAGER less most w3m pg i3-sensible-editor; do
if command -v $pager > /dev/null 2>&1; then if command -v $pager > /dev/null 2>&1; then
exec $pager "$@" exec $pager "$@"
fi fi

View File

@ -8,7 +8,7 @@
# We welcome patches that add distribution-specific mechanisms to find the # We welcome patches that add distribution-specific mechanisms to find the
# preferred terminal emulator. On Debian, there is the x-terminal-emulator # preferred terminal emulator. On Debian, there is the x-terminal-emulator
# symlink for example. # symlink for example.
for terminal in $TERMINAL x-terminal-emulator urxvt rxvt terminator Eterm aterm xterm gnome-terminal roxterm xfce4-terminal termite lxterminal; do for terminal in $TERMINAL x-terminal-emulator urxvt rxvt terminator Eterm aterm xterm gnome-terminal roxterm xfce4-terminal termite lxterminal mate-terminal terminology; do
if command -v $terminal > /dev/null 2>&1; then if command -v $terminal > /dev/null 2>&1; then
exec $terminal "$@" exec $terminal "$@"
fi fi

View File

@ -165,6 +165,7 @@ bindsym Mod1+r mode "resize"
# finds out, if available) # finds out, if available)
bar { bar {
status_command i3status status_command i3status
tray_output primary
} }
####################################################################### #######################################################################

View File

@ -152,4 +152,5 @@ bindcode $mod+27 mode "resize"
# finds out, if available) # finds out, if available)
bar { bar {
status_command i3status status_command i3status
tray_output primary
} }

View File

@ -20,8 +20,8 @@ i3bar/i3bar: libi3.a $(i3bar_OBJECTS)
install-i3bar: i3bar/i3bar install-i3bar: i3bar/i3bar
echo "[i3bar] Install" echo "[i3bar] Install"
$(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/bin $(INSTALL) -d -m 0755 $(DESTDIR)$(EXEC_PREFIX)/bin
$(INSTALL) -m 0755 i3bar/i3bar $(DESTDIR)$(PREFIX)/bin/ $(INSTALL) -m 0755 i3bar/i3bar $(DESTDIR)$(EXEC_PREFIX)/bin/
clean-i3bar: clean-i3bar:
echo "[i3bar] Clean" echo "[i3bar] Clean"

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* child.c: Getting input for the statusline * child.c: Getting input for the statusline
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2011 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
*/ */
#pragma once #pragma once

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2011 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* config.c: Parses the configuration (received from i3). * config.c: Parses the configuration (received from i3).
* *
@ -22,10 +22,16 @@ typedef enum { M_DOCK = 0,
M_HIDE = 1, M_HIDE = 1,
M_INVISIBLE = 2 } bar_display_mode_t; M_INVISIBLE = 2 } bar_display_mode_t;
typedef struct binding_t {
int input_code;
char *command;
TAILQ_ENTRY(binding_t) bindings;
} binding_t;
typedef struct config_t { typedef struct config_t {
int modifier; int modifier;
char *wheel_up_cmd; TAILQ_HEAD(bindings_head, binding_t) bindings;
char *wheel_down_cmd;
position_t position; position_t position;
int verbose; int verbose;
struct xcb_color_strings_t colors; struct xcb_color_strings_t colors;
@ -37,6 +43,7 @@ typedef struct config_t {
char *fontname; char *fontname;
i3String *separator_symbol; i3String *separator_symbol;
char *tray_output; char *tray_output;
int tray_padding;
int num_outputs; int num_outputs;
char **outputs; char **outputs;

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* ipc.c: Communicating with i3 * ipc.c: Communicating with i3
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* mode.c: Handle "mode" event and show current binding mode in the bar * mode.c: Handle "mode" event and show current binding mode in the bar
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* outputs.c: Maintaining the outputs list * outputs.c: Maintaining the outputs list
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* parse_json_header.c: Parse the JSON protocol header to determine * parse_json_header.c: Parse the JSON protocol header to determine
* protocol version and features. * protocol version and features.

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2011 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
*/ */
#pragma once #pragma once

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
*/ */
#pragma once #pragma once

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* workspaces.c: Maintaining the workspace lists * workspaces.c: Maintaining the workspace lists
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* xcb.c: Communicating with X * xcb.c: Communicating with X
* *
@ -40,6 +40,9 @@ struct xcb_color_strings_t {
char *urgent_ws_bg; char *urgent_ws_bg;
char *urgent_ws_fg; char *urgent_ws_fg;
char *urgent_ws_border; char *urgent_ws_border;
char *binding_mode_bg;
char *binding_mode_fg;
char *binding_mode_border;
}; };
typedef struct xcb_colors_t xcb_colors_t; typedef struct xcb_colors_t xcb_colors_t;

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* child.c: Getting input for the statusline * child.c: Getting input for the statusline
* *
@ -105,13 +105,13 @@ __attribute__((format(printf, 1, 2))) static void set_statusline_error(const cha
va_start(args, format); va_start(args, format);
(void)vasprintf(&message, format, args); (void)vasprintf(&message, format, args);
struct status_block *err_block = scalloc(sizeof(struct status_block)); struct status_block *err_block = scalloc(1, sizeof(struct status_block));
err_block->full_text = i3string_from_utf8("Error: "); err_block->full_text = i3string_from_utf8("Error: ");
err_block->name = sstrdup("error"); err_block->name = sstrdup("error");
err_block->color = sstrdup("red"); err_block->color = sstrdup("red");
err_block->no_separator = true; err_block->no_separator = true;
struct status_block *message_block = scalloc(sizeof(struct status_block)); struct status_block *message_block = scalloc(1, sizeof(struct status_block));
message_block->full_text = i3string_from_utf8(message); message_block->full_text = i3string_from_utf8(message);
message_block->name = sstrdup("error_message"); message_block->name = sstrdup("error_message");
message_block->color = sstrdup("red"); message_block->color = sstrdup("red");
@ -220,21 +220,21 @@ static int stdin_string(void *context, const unsigned char *val, size_t len) {
return 1; return 1;
} }
if (strcasecmp(ctx->last_map_key, "min_width") == 0) { if (strcasecmp(ctx->last_map_key, "min_width") == 0) {
char *copy = (char *)malloc(len + 1); char *copy = (char *)smalloc(len + 1);
strncpy(copy, (const char *)val, len); strncpy(copy, (const char *)val, len);
copy[len] = 0; copy[len] = 0;
ctx->block.min_width_str = copy; ctx->block.min_width_str = copy;
return 1; return 1;
} }
if (strcasecmp(ctx->last_map_key, "name") == 0) { if (strcasecmp(ctx->last_map_key, "name") == 0) {
char *copy = (char *)malloc(len + 1); char *copy = (char *)smalloc(len + 1);
strncpy(copy, (const char *)val, len); strncpy(copy, (const char *)val, len);
copy[len] = 0; copy[len] = 0;
ctx->block.name = copy; ctx->block.name = copy;
return 1; return 1;
} }
if (strcasecmp(ctx->last_map_key, "instance") == 0) { if (strcasecmp(ctx->last_map_key, "instance") == 0) {
char *copy = (char *)malloc(len + 1); char *copy = (char *)smalloc(len + 1);
strncpy(copy, (const char *)val, len); strncpy(copy, (const char *)val, len);
copy[len] = 0; copy[len] = 0;
ctx->block.instance = copy; ctx->block.instance = copy;
@ -433,7 +433,7 @@ void stdin_io_first_line_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
} else { } else {
/* In case of plaintext, we just add a single block and change its /* In case of plaintext, we just add a single block and change its
* full_text pointer later. */ * full_text pointer later. */
struct status_block *new_block = scalloc(sizeof(struct status_block)); struct status_block *new_block = scalloc(1, sizeof(struct status_block));
TAILQ_INSERT_TAIL(&statusline_head, new_block, blocks); TAILQ_INSERT_TAIL(&statusline_head, new_block, blocks);
read_flat_input((char *)buffer, rec); read_flat_input((char *)buffer, rec);
} }

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2011 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* config.c: Parses the configuration (received from i3). * config.c: Parses the configuration (received from i3).
* *
@ -20,6 +20,7 @@
#include "common.h" #include "common.h"
static char *cur_key; static char *cur_key;
static bool parsing_bindings;
/* /*
* Parse a key. * Parse a key.
@ -34,6 +35,14 @@ static int config_map_key_cb(void *params_, const unsigned char *keyVal, size_t
strncpy(cur_key, (const char *)keyVal, keyLen); strncpy(cur_key, (const char *)keyVal, keyLen);
cur_key[keyLen] = '\0'; cur_key[keyLen] = '\0';
if (strcmp(cur_key, "bindings") == 0)
parsing_bindings = true;
return 1;
}
static int config_end_array_cb(void *params_) {
parsing_bindings = false;
return 1; return 1;
} }
@ -63,6 +72,27 @@ static int config_string_cb(void *params_, const unsigned char *val, size_t _len
if (!strcmp(cur_key, "id") || !strcmp(cur_key, "socket_path")) if (!strcmp(cur_key, "id") || !strcmp(cur_key, "socket_path"))
return 1; return 1;
if (parsing_bindings) {
if (strcmp(cur_key, "command") == 0) {
binding_t *binding = TAILQ_LAST(&(config.bindings), bindings_head);
if (binding == NULL) {
ELOG("There is no binding to put the current command onto. This is a bug in i3.\n");
return 0;
}
if (binding->command != NULL) {
ELOG("The binding for input_code = %d already has a command. This is a bug in i3.\n", binding->input_code);
return 0;
}
sasprintf(&(binding->command), "%.*s", len, val);
return 1;
}
ELOG("Unknown key \"%s\" while parsing bar bindings.\n", cur_key);
return 0;
}
if (!strcmp(cur_key, "mode")) { if (!strcmp(cur_key, "mode")) {
DLOG("mode = %.*s, len = %d\n", len, val, len); DLOG("mode = %.*s, len = %d\n", len, val, len);
config.hide_on_modifier = (len == 4 && !strncmp((const char *)val, "dock", strlen("dock")) ? M_DOCK config.hide_on_modifier = (len == 4 && !strncmp((const char *)val, "dock", strlen("dock")) ? M_DOCK
@ -112,17 +142,25 @@ static int config_string_cb(void *params_, const unsigned char *val, size_t _len
return 1; return 1;
} }
/* This key was sent in <= 4.10.2. We keep it around to avoid breakage for
* users updating from that version and restarting i3bar before i3. */
if (!strcmp(cur_key, "wheel_up_cmd")) { if (!strcmp(cur_key, "wheel_up_cmd")) {
DLOG("wheel_up_cmd = %.*s\n", len, val); DLOG("wheel_up_cmd = %.*s\n", len, val);
FREE(config.wheel_up_cmd); binding_t *binding = scalloc(1, sizeof(binding_t));
sasprintf(&config.wheel_up_cmd, "%.*s", len, val); binding->input_code = 4;
sasprintf(&(binding->command), "%.*s", len, val);
TAILQ_INSERT_TAIL(&(config.bindings), binding, bindings);
return 1; return 1;
} }
/* This key was sent in <= 4.10.2. We keep it around to avoid breakage for
* users updating from that version and restarting i3bar before i3. */
if (!strcmp(cur_key, "wheel_down_cmd")) { if (!strcmp(cur_key, "wheel_down_cmd")) {
DLOG("wheel_down_cmd = %.*s\n", len, val); DLOG("wheel_down_cmd = %.*s\n", len, val);
FREE(config.wheel_down_cmd); binding_t *binding = scalloc(1, sizeof(binding_t));
sasprintf(&config.wheel_down_cmd, "%.*s", len, val); binding->input_code = 5;
sasprintf(&(binding->command), "%.*s", len, val);
TAILQ_INSERT_TAIL(&(config.bindings), binding, bindings);
return 1; return 1;
} }
@ -191,6 +229,9 @@ static int config_string_cb(void *params_, const unsigned char *val, size_t _len
COLOR(urgent_workspace_border, urgent_ws_border); COLOR(urgent_workspace_border, urgent_ws_border);
COLOR(urgent_workspace_bg, urgent_ws_bg); COLOR(urgent_workspace_bg, urgent_ws_bg);
COLOR(urgent_workspace_text, urgent_ws_fg); COLOR(urgent_workspace_text, urgent_ws_fg);
COLOR(binding_mode_border, binding_mode_border);
COLOR(binding_mode_bg, binding_mode_bg);
COLOR(binding_mode_text, binding_mode_fg);
printf("got unexpected string %.*s for cur_key = %s\n", len, val, cur_key); printf("got unexpected string %.*s for cur_key = %s\n", len, val, cur_key);
@ -229,11 +270,40 @@ static int config_boolean_cb(void *params_, int val) {
return 0; return 0;
} }
/*
* Parse an integer value
*
*/
static int config_integer_cb(void *params_, long long val) {
if (parsing_bindings) {
if (strcmp(cur_key, "input_code") == 0) {
binding_t *binding = scalloc(1, sizeof(binding_t));
binding->input_code = val;
TAILQ_INSERT_TAIL(&(config.bindings), binding, bindings);
return 1;
}
ELOG("Unknown key \"%s\" while parsing bar bindings.\n", cur_key);
return 0;
}
if (!strcmp(cur_key, "tray_padding")) {
DLOG("tray_padding = %lld\n", val);
config.tray_padding = val;
return 1;
}
return 0;
}
/* A datastructure to pass all these callbacks to yajl */ /* A datastructure to pass all these callbacks to yajl */
static yajl_callbacks outputs_callbacks = { static yajl_callbacks outputs_callbacks = {
.yajl_null = config_null_cb, .yajl_null = config_null_cb,
.yajl_boolean = config_boolean_cb, .yajl_boolean = config_boolean_cb,
.yajl_integer = config_integer_cb,
.yajl_string = config_string_cb, .yajl_string = config_string_cb,
.yajl_end_array = config_end_array_cb,
.yajl_map_key = config_map_key_cb, .yajl_map_key = config_map_key_cb,
}; };
@ -246,6 +316,8 @@ void parse_config_json(char *json) {
yajl_status state; yajl_status state;
handle = yajl_alloc(&outputs_callbacks, NULL, NULL); handle = yajl_alloc(&outputs_callbacks, NULL, NULL);
TAILQ_INIT(&(config.bindings));
state = yajl_parse(handle, (const unsigned char *)json, strlen(json)); state = yajl_parse(handle, (const unsigned char *)json, strlen(json));
/* FIXME: Proper error handling for JSON parsing */ /* FIXME: Proper error handling for JSON parsing */
@ -286,5 +358,8 @@ void free_colors(struct xcb_color_strings_t *colors) {
FREE_COLOR(focus_ws_fg); FREE_COLOR(focus_ws_fg);
FREE_COLOR(focus_ws_bg); FREE_COLOR(focus_ws_bg);
FREE_COLOR(focus_ws_border); FREE_COLOR(focus_ws_border);
FREE_COLOR(binding_mode_fg);
FREE_COLOR(binding_mode_bg);
FREE_COLOR(binding_mode_border);
#undef FREE_COLOR #undef FREE_COLOR
} }

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* ipc.c: Communicating with i3 * ipc.c: Communicating with i3
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
*/ */
#include <stdio.h> #include <stdio.h>
@ -111,7 +111,7 @@ int main(int argc, char **argv) {
socket_path = expand_path(optarg); socket_path = expand_path(optarg);
break; break;
case 'v': case 'v':
printf("i3bar version " I3_VERSION " © 2010-2014 Axel Wagner and contributors\n"); printf("i3bar version " I3_VERSION " © 2010 Axel Wagner and contributors\n");
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
break; break;
case 'b': case 'b':

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* mode.c: Handle mode event and show current binding mode in the bar * mode.c: Handle mode event and show current binding mode in the bar
* *
@ -32,7 +32,7 @@ static int mode_string_cb(void *params_, const unsigned char *val, size_t len) {
if (!strcmp(params->cur_key, "change")) { if (!strcmp(params->cur_key, "change")) {
/* Save the name */ /* Save the name */
params->mode->name = i3string_from_utf8_with_length((const char *)val, len); params->mode->name = i3string_from_markup_with_length((const char *)val, len);
/* Save its rendered width */ /* Save its rendered width */
params->mode->width = predict_text_width(params->mode->name); params->mode->width = predict_text_width(params->mode->name);

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* outputs.c: Maintaining the outputs list * outputs.c: Maintaining the outputs list
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* parse_json_header.c: Parse the JSON protocol header to determine * parse_json_header.c: Parse the JSON protocol header to determine
* protocol version and features. * protocol version and features.

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* workspaces.c: Maintaining the workspace lists * workspaces.c: Maintaining the workspace lists
* *
@ -106,7 +106,7 @@ static int workspaces_string_cb(void *params_, const unsigned char *val, size_t
if (!strcmp(params->cur_key, "name")) { if (!strcmp(params->cur_key, "name")) {
const char *ws_name = (const char *)val; const char *ws_name = (const char *)val;
params->workspaces_walk->canonical_name = strndup(ws_name, len); params->workspaces_walk->canonical_name = sstrndup(ws_name, len);
if (config.strip_ws_numbers && params->workspaces_walk->num >= 0) { if (config.strip_ws_numbers && params->workspaces_walk->num >= 0) {
/* Special case: strip off the workspace number */ /* Special case: strip off the workspace number */

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3bar - an xcb-based status- and ws-bar for i3 * i3bar - an xcb-based status- and ws-bar for i3
* © 2010-2012 Axel Wagner and contributors (see also: LICENSE) * © 2010 Axel Wagner and contributors (see also: LICENSE)
* *
* xcb.c: Communicating with X * xcb.c: Communicating with X
* *
@ -60,6 +60,9 @@ xcb_connection_t *conn;
/* The font we'll use */ /* The font we'll use */
static i3Font font; static i3Font font;
/* Icon size (based on font size) */
int icon_size;
/* Overall height of the bar (based on font size) */ /* Overall height of the bar (based on font size) */
int bar_height; int bar_height;
@ -103,6 +106,9 @@ struct xcb_colors_t {
uint32_t focus_ws_bg; uint32_t focus_ws_bg;
uint32_t focus_ws_fg; uint32_t focus_ws_fg;
uint32_t focus_ws_border; uint32_t focus_ws_border;
uint32_t binding_mode_bg;
uint32_t binding_mode_fg;
uint32_t binding_mode_border;
}; };
struct xcb_colors_t colors; struct xcb_colors_t colors;
@ -148,7 +154,7 @@ int get_tray_width(struct tc_head *trayclients) {
TAILQ_FOREACH_REVERSE(trayclient, trayclients, tc_head, tailq) { TAILQ_FOREACH_REVERSE(trayclient, trayclients, tc_head, tailq) {
if (!trayclient->mapped) if (!trayclient->mapped)
continue; continue;
tray_width += font.height + logical_px(2); tray_width += icon_size + logical_px(config.tray_padding);
} }
if (tray_width > 0) if (tray_width > 0)
tray_width += logical_px(tray_loff_px); tray_width += logical_px(tray_loff_px);
@ -368,6 +374,18 @@ void init_colors(const struct xcb_color_strings_t *new_colors) {
PARSE_COLOR(focus_ws_border, "#4c7899"); PARSE_COLOR(focus_ws_border, "#4c7899");
#undef PARSE_COLOR #undef PARSE_COLOR
#define PARSE_COLOR_FALLBACK(name, fallback) \
do { \
colors.name = new_colors->name ? get_colorpixel(new_colors->name) : colors.fallback; \
} while (0)
/* For the binding mode indicator colors, we don't hardcode a default.
* Instead, we fall back to urgent_ws_* colors. */
PARSE_COLOR_FALLBACK(binding_mode_fg, urgent_ws_fg);
PARSE_COLOR_FALLBACK(binding_mode_bg, urgent_ws_bg);
PARSE_COLOR_FALLBACK(binding_mode_border, urgent_ws_border);
#undef PARSE_COLOR_FALLBACK
init_tray_colors(); init_tray_colors();
xcb_flush(xcb_connection); xcb_flush(xcb_connection);
} }
@ -420,7 +438,7 @@ void handle_button(xcb_button_press_event_t *event) {
int offset = walk->rect.w - statusline_width - tray_width - logical_px(sb_hoff_px); int offset = walk->rect.w - statusline_width - tray_width - logical_px(sb_hoff_px);
x = original_x - offset; x = original_x - offset;
if (x >= 0) { if (x >= 0 && (size_t)x < statusline_width) {
struct status_block *block; struct status_block *block;
int sep_offset_remainder = 0; int sep_offset_remainder = 0;
@ -442,25 +460,27 @@ void handle_button(xcb_button_press_event_t *event) {
x = original_x; x = original_x;
} }
/* If a custom command was specified for this mouse button, it overrides
* the default behavior. */
binding_t *binding;
TAILQ_FOREACH(binding, &(config.bindings), bindings) {
if (binding->input_code != event->detail)
continue;
i3_send_msg(I3_IPC_MESSAGE_TYPE_COMMAND, binding->command);
return;
}
if (cur_ws == NULL) { if (cur_ws == NULL) {
DLOG("No workspace active?\n"); DLOG("No workspace active?\n");
return; return;
} }
switch (event->detail) { switch (event->detail) {
case 4: case 4:
/* Mouse wheel up. We select the previous ws, if any. /* Mouse wheel up. We select the previous ws, if any.
* If there is no more workspace, dont even send the workspace * If there is no more workspace, dont even send the workspace
* command, otherwise (with workspace auto_back_and_forth) wed end * command, otherwise (with workspace auto_back_and_forth) wed end
* up on the wrong workspace. */ * up on the wrong workspace. */
/* If `wheel_up_cmd [COMMAND]` was specified, it should override
* the default behavior */
if (config.wheel_up_cmd) {
i3_send_msg(I3_IPC_MESSAGE_TYPE_COMMAND, config.wheel_up_cmd);
return;
}
if (cur_ws == TAILQ_FIRST(walk->workspaces)) if (cur_ws == TAILQ_FIRST(walk->workspaces))
return; return;
@ -471,14 +491,6 @@ void handle_button(xcb_button_press_event_t *event) {
* If there is no more workspace, dont even send the workspace * If there is no more workspace, dont even send the workspace
* command, otherwise (with workspace auto_back_and_forth) wed end * command, otherwise (with workspace auto_back_and_forth) wed end
* up on the wrong workspace. */ * up on the wrong workspace. */
/* if `wheel_down_cmd [COMMAND]` was specified, it should override
* the default behavior */
if (config.wheel_down_cmd) {
i3_send_msg(I3_IPC_MESSAGE_TYPE_COMMAND, config.wheel_down_cmd);
return;
}
if (cur_ws == TAILQ_LAST(walk->workspaces, ws_head)) if (cur_ws == TAILQ_LAST(walk->workspaces, ws_head))
return; return;
@ -521,7 +533,7 @@ void handle_button(xcb_button_press_event_t *event) {
} }
const size_t len = namelen + strlen("workspace \"\"") + 1; const size_t len = namelen + strlen("workspace \"\"") + 1;
char *buffer = scalloc(len + num_quotes); char *buffer = scalloc(len + num_quotes, 1);
strncpy(buffer, "workspace \"", strlen("workspace \"")); strncpy(buffer, "workspace \"", strlen("workspace \""));
size_t inpos, outpos; size_t inpos, outpos;
for (inpos = 0, outpos = strlen("workspace \""); for (inpos = 0, outpos = strlen("workspace \"");
@ -591,8 +603,8 @@ static void configure_trayclients(void) {
clients++; clients++;
DLOG("Configuring tray window %08x to x=%d\n", DLOG("Configuring tray window %08x to x=%d\n",
trayclient->win, output->rect.w - (clients * (font.height + logical_px(2)))); trayclient->win, output->rect.w - (clients * (icon_size + logical_px(config.tray_padding))));
uint32_t x = output->rect.w - (clients * (font.height + logical_px(2))); uint32_t x = output->rect.w - (clients * (icon_size + logical_px(config.tray_padding)));
xcb_configure_window(xcb_connection, xcb_configure_window(xcb_connection,
trayclient->win, trayclient->win,
XCB_CONFIG_WINDOW_X, XCB_CONFIG_WINDOW_X,
@ -702,23 +714,23 @@ static void handle_client_message(xcb_client_message_event_t *event) {
xcb_reparent_window(xcb_connection, xcb_reparent_window(xcb_connection,
client, client,
output->bar, output->bar,
output->rect.w - font.height - 2, output->rect.w - icon_size - logical_px(config.tray_padding),
2); logical_px(config.tray_padding));
/* We reconfigure the window to use a reasonable size. The systray /* We reconfigure the window to use a reasonable size. The systray
* specification explicitly says: * specification explicitly says:
* Tray icons may be assigned any size by the system tray, and * Tray icons may be assigned any size by the system tray, and
* should do their best to cope with any size effectively * should do their best to cope with any size effectively
*/ */
mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
values[0] = font.height; values[0] = icon_size;
values[1] = font.height; values[1] = icon_size;
xcb_configure_window(xcb_connection, xcb_configure_window(xcb_connection,
client, client,
mask, mask,
values); values);
/* send the XEMBED_EMBEDDED_NOTIFY message */ /* send the XEMBED_EMBEDDED_NOTIFY message */
void *event = scalloc(32); void *event = scalloc(32, 1);
xcb_client_message_event_t *ev = event; xcb_client_message_event_t *ev = event;
ev->response_type = XCB_CLIENT_MESSAGE; ev->response_type = XCB_CLIENT_MESSAGE;
ev->window = client; ev->window = client;
@ -941,10 +953,10 @@ static void handle_configure_request(xcb_configure_request_event_t *event) {
continue; continue;
xcb_rectangle_t rect; xcb_rectangle_t rect;
rect.x = output->rect.w - (clients * (font.height + 2)); rect.x = output->rect.w - (clients * (icon_size + logical_px(config.tray_padding)));
rect.y = 2; rect.y = logical_px(config.tray_padding);
rect.width = font.height; rect.width = icon_size;
rect.height = font.height; rect.height = icon_size;
DLOG("This is a tray window. x = %d\n", rect.x); DLOG("This is a tray window. x = %d\n", rect.x);
fake_configure_notify(xcb_connection, rect, event->window, 0); fake_configure_notify(xcb_connection, rect, event->window, 0);
@ -1215,6 +1227,7 @@ void init_xcb_late(char *fontname) {
set_font(&font); set_font(&font);
DLOG("Calculated font height: %d\n", font.height); DLOG("Calculated font height: %d\n", font.height);
bar_height = font.height + 2 * logical_px(ws_voff_px); bar_height = font.height + 2 * logical_px(ws_voff_px);
icon_size = bar_height - 2 * logical_px(config.tray_padding);
if (config.separator_symbol) if (config.separator_symbol)
separator_symbol_width = predict_text_width(config.separator_symbol); separator_symbol_width = predict_text_width(config.separator_symbol);
@ -1641,8 +1654,7 @@ void reconfig_windows(bool redraw_bars) {
"i3bar\0i3bar\0"); "i3bar\0i3bar\0");
char *name; char *name;
if (asprintf(&name, "i3bar for output %s", walk->name) == -1) sasprintf(&name, "i3bar for output %s", walk->name);
err(EXIT_FAILURE, "asprintf()");
xcb_void_cookie_t name_cookie; xcb_void_cookie_t name_cookie;
name_cookie = xcb_change_property(xcb_connection, name_cookie = xcb_change_property(xcb_connection,
XCB_PROP_MODE_REPLACE, XCB_PROP_MODE_REPLACE,
@ -1792,6 +1804,8 @@ void reconfig_windows(bool redraw_bars) {
void draw_bars(bool unhide) { void draw_bars(bool unhide) {
DLOG("Drawing bars...\n"); DLOG("Drawing bars...\n");
int workspace_width = 0; int workspace_width = 0;
/* Is the currently-rendered statusline using short_text items? */
bool rendered_statusline_is_short = false;
refresh_statusline(false); refresh_statusline(false);
@ -1888,11 +1902,11 @@ void draw_bars(bool unhide) {
if (binding.name && !config.disable_binding_mode_indicator) { if (binding.name && !config.disable_binding_mode_indicator) {
workspace_width += logical_px(ws_spacing_px); workspace_width += logical_px(ws_spacing_px);
uint32_t fg_color = colors.urgent_ws_fg; uint32_t fg_color = colors.binding_mode_fg;
uint32_t bg_color = colors.urgent_ws_bg; uint32_t bg_color = colors.binding_mode_bg;
uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND; uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND;
uint32_t vals_border[] = {colors.urgent_ws_border, colors.urgent_ws_border}; uint32_t vals_border[] = {colors.binding_mode_border, colors.binding_mode_border};
xcb_change_gc(xcb_connection, xcb_change_gc(xcb_connection,
outputs_walk->bargc, outputs_walk->bargc,
mask, mask,
@ -1941,8 +1955,15 @@ void draw_bars(bool unhide) {
uint32_t max_statusline_width = outputs_walk->rect.w - workspace_width - tray_width - 2 * logical_px(sb_hoff_px); uint32_t max_statusline_width = outputs_walk->rect.w - workspace_width - tray_width - 2 * logical_px(sb_hoff_px);
/* If the statusline is too long, try to use short texts. */ /* If the statusline is too long, try to use short texts. */
if (statusline_width > max_statusline_width) if (statusline_width > max_statusline_width) {
/* If the currently rendered statusline is long, render a short status line */
refresh_statusline(true); refresh_statusline(true);
rendered_statusline_is_short = true;
} else if (rendered_statusline_is_short) {
/* If the currently rendered statusline is short, render a long status line */
refresh_statusline(false);
rendered_statusline_is_short = false;
}
/* Luckily we already prepared a seperate pixmap containing the rendered /* Luckily we already prepared a seperate pixmap containing the rendered
* statusline, we just have to copy the relevant parts to the relevant * statusline, we just have to copy the relevant parts to the relevant

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* This header file includes all relevant files of i3 and the most often used * This header file includes all relevant files of i3 and the most often used
* system header files. This reduces boilerplate (the amount of code duplicated * system header files. This reduces boilerplate (the amount of code duplicated

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* assignments.c: Assignments for specific windows (for_window). * assignments.c: Assignments for specific windows (for_window).
* *

View File

@ -1,17 +1,25 @@
xmacro(_NET_SUPPORTED) xmacro(_NET_SUPPORTED)
xmacro(_NET_SUPPORTING_WM_CHECK) xmacro(_NET_SUPPORTING_WM_CHECK)
xmacro(_NET_WM_NAME) xmacro(_NET_WM_NAME)
xmacro(_NET_WM_VISIBLE_NAME)
xmacro(_NET_WM_MOVERESIZE) xmacro(_NET_WM_MOVERESIZE)
xmacro(_NET_WM_STATE_STICKY)
xmacro(_NET_WM_STATE_FULLSCREEN) xmacro(_NET_WM_STATE_FULLSCREEN)
xmacro(_NET_WM_STATE_DEMANDS_ATTENTION) xmacro(_NET_WM_STATE_DEMANDS_ATTENTION)
xmacro(_NET_WM_STATE_MODAL) xmacro(_NET_WM_STATE_MODAL)
xmacro(_NET_WM_STATE_HIDDEN)
xmacro(_NET_WM_STATE) xmacro(_NET_WM_STATE)
xmacro(_NET_WM_WINDOW_TYPE) xmacro(_NET_WM_WINDOW_TYPE)
xmacro(_NET_WM_WINDOW_TYPE_NORMAL)
xmacro(_NET_WM_WINDOW_TYPE_DOCK) xmacro(_NET_WM_WINDOW_TYPE_DOCK)
xmacro(_NET_WM_WINDOW_TYPE_DIALOG) xmacro(_NET_WM_WINDOW_TYPE_DIALOG)
xmacro(_NET_WM_WINDOW_TYPE_UTILITY) xmacro(_NET_WM_WINDOW_TYPE_UTILITY)
xmacro(_NET_WM_WINDOW_TYPE_TOOLBAR) xmacro(_NET_WM_WINDOW_TYPE_TOOLBAR)
xmacro(_NET_WM_WINDOW_TYPE_SPLASH) xmacro(_NET_WM_WINDOW_TYPE_SPLASH)
xmacro(_NET_WM_WINDOW_TYPE_MENU)
xmacro(_NET_WM_WINDOW_TYPE_DROPDOWN_MENU)
xmacro(_NET_WM_WINDOW_TYPE_POPUP_MENU)
xmacro(_NET_WM_WINDOW_TYPE_TOOLTIP)
xmacro(_NET_WM_DESKTOP) xmacro(_NET_WM_DESKTOP)
xmacro(_NET_WM_STRUT_PARTIAL) xmacro(_NET_WM_STRUT_PARTIAL)
xmacro(_NET_CLIENT_LIST) xmacro(_NET_CLIENT_LIST)

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2014 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* bindings.h: Functions for configuring, finding, and running bindings. * bindings.h: Functions for configuring, finding, and running bindings.
* *
@ -24,13 +24,14 @@ const char *DEFAULT_BINDING_MODE;
* *
*/ */
Binding *configure_binding(const char *bindtype, const char *modifiers, const char *input_code, Binding *configure_binding(const char *bindtype, const char *modifiers, const char *input_code,
const char *release, const char *whole_window, const char *command, const char *mode); const char *release, const char *border, const char *whole_window,
const char *command, const char *mode);
/** /**
* Grab the bound keys (tell X to send us keypress events for those keycodes) * Grab the bound keys (tell X to send us keypress events for those keycodes)
* *
*/ */
void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch); void grab_all_keys(xcb_connection_t *conn);
/** /**
* Returns a pointer to the Binding that matches the given xcb event or NULL if * Returns a pointer to the Binding that matches the given xcb event or NULL if
@ -51,6 +52,21 @@ void translate_keysyms(void);
*/ */
void switch_mode(const char *new_mode); void switch_mode(const char *new_mode);
/**
* Reorders bindings by event_state_mask descendingly so that get_binding()
* correctly matches more specific bindings before more generic bindings. Take
* the following binding configuration as an example:
*
* bindsym n nop lower-case n pressed
* bindsym Shift+n nop upper-case n pressed
*
* Without reordering, the first bindings event_state_mask of 0x0 would match
* the actual event_stat_mask of 0x1 and hence trigger instead of the second
* keybinding.
*
*/
void reorder_bindings(void);
/** /**
* Checks for duplicate key bindings (the same keycode or keysym is configured * Checks for duplicate key bindings (the same keycode or keysym is configured
* more than once). If a duplicate binding is found, a message is printed to * more than once). If a duplicate binding is found, a message is printed to
@ -73,3 +89,9 @@ void binding_free(Binding *bind);
* *
*/ */
CommandResult *run_binding(Binding *bind, Con *con); CommandResult *run_binding(Binding *bind, Con *con);
/**
* Loads the XKB keymap from the X11 server and feeds it to xkbcommon.
*
*/
bool load_keymap(void);

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* click.c: Button press (mouse click) events. * click.c: Button press (mouse click) events.
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* cmdparse.y: the parser for commands you send to i3 (or bind on keys) * cmdparse.y: the parser for commands you send to i3 (or bind on keys)
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* commands.c: all command functions (see commands_parser.c) * commands.c: all command functions (see commands_parser.c)
* *
@ -60,6 +60,12 @@ void cmd_move_con_to_workspace_name(I3_CMD, char *name);
*/ */
void cmd_move_con_to_workspace_number(I3_CMD, char *which); void cmd_move_con_to_workspace_number(I3_CMD, char *which);
/**
* Implementation of 'resize set <px> [px] <px> [px]'.
*
*/
void cmd_size(I3_CMD, char *cwidth, char *cheight);
/** /**
* Implementation of 'resize grow|shrink <direction> [<px> px] [or <ppt> ppt]'. * Implementation of 'resize grow|shrink <direction> [<px> px] [or <ppt> ppt]'.
* *
@ -67,7 +73,7 @@ void cmd_move_con_to_workspace_number(I3_CMD, char *which);
void cmd_resize(I3_CMD, char *way, char *direction, char *resize_px, char *resize_ppt); void cmd_resize(I3_CMD, char *way, char *direction, char *resize_px, char *resize_ppt);
/** /**
* Implementation of 'border normal|none|1pixel|toggle'. * Implementation of 'border normal|pixel [<n>]', 'border none|1pixel|toggle'.
* *
*/ */
void cmd_border(I3_CMD, char *border_style_str, char *border_width); void cmd_border(I3_CMD, char *border_style_str, char *border_width);
@ -109,10 +115,10 @@ void cmd_workspace_back_and_forth(I3_CMD);
void cmd_workspace_name(I3_CMD, char *name); void cmd_workspace_name(I3_CMD, char *name);
/** /**
* Implementation of 'mark <mark>' * Implementation of 'mark [--toggle] <mark>'
* *
*/ */
void cmd_mark(I3_CMD, char *mark); void cmd_mark(I3_CMD, char *mark, char *toggle);
/** /**
* Implementation of 'unmark [mark]' * Implementation of 'unmark [mark]'
@ -132,6 +138,12 @@ void cmd_mode(I3_CMD, char *mode);
*/ */
void cmd_move_con_to_output(I3_CMD, char *name); void cmd_move_con_to_output(I3_CMD, char *name);
/**
* Implementation of 'move [window|container] [to] mark <str>'.
*
*/
void cmd_move_con_to_mark(I3_CMD, char *mark);
/** /**
* Implementation of 'floating enable|disable|toggle' * Implementation of 'floating enable|disable|toggle'
* *
@ -192,6 +204,12 @@ void cmd_focus(I3_CMD);
*/ */
void cmd_fullscreen(I3_CMD, char *action, char *fullscreen_mode); void cmd_fullscreen(I3_CMD, char *action, char *fullscreen_mode);
/**
* Implementation of 'sticky enable|disable|toggle'.
*
*/
void cmd_sticky(I3_CMD, char *action);
/** /**
* Implementation of 'move <direction> [<pixels> [px]]'. * Implementation of 'move <direction> [<pixels> [px]]'.
* *
@ -252,6 +270,12 @@ void cmd_move_window_to_position(I3_CMD, char *method, char *x, char *y);
*/ */
void cmd_move_window_to_center(I3_CMD, char *method); void cmd_move_window_to_center(I3_CMD, char *method);
/**
* Implementation of 'move [window|container] [to] position mouse'
*
*/
void cmd_move_window_to_mouse(I3_CMD);
/** /**
* Implementation of 'move scratchpad'. * Implementation of 'move scratchpad'.
* *
@ -264,6 +288,12 @@ void cmd_move_scratchpad(I3_CMD);
*/ */
void cmd_scratchpad_show(I3_CMD); void cmd_scratchpad_show(I3_CMD);
/**
* Implementation of 'title_format <format>'
*
*/
void cmd_title_format(I3_CMD, char *format);
/** /**
* Implementation of 'rename workspace <name> to <name>' * Implementation of 'rename workspace <name> to <name>'
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* commands.c: all command functions (see commands_parser.c) * commands.c: all command functions (see commands_parser.c)
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* con.c: Functions which deal with containers directly (creating containers, * con.c: Functions which deal with containers directly (creating containers,
* searching containers, getting specific properties from containers, * searching containers, getting specific properties from containers,
@ -42,12 +42,25 @@ bool con_is_leaf(Con *con);
*/ */
bool con_has_managed_window(Con *con); bool con_has_managed_window(Con *con);
/* /**
* Returns true if a container should be considered split. * Returns true if a container should be considered split.
* *
*/ */
bool con_is_split(Con *con); bool con_is_split(Con *con);
/**
* This will only return true for containers which have some parent with
* a tabbed / stacked parent of which they are not the currently focused child.
*
*/
bool con_is_hidden(Con *con);
/**
* Returns whether the container or any of its children is sticky.
*
*/
bool con_is_sticky(Con *con);
/** /**
* Returns true if this node has regular or floating children. * Returns true if this node has regular or floating children.
* *
@ -126,6 +139,34 @@ Con *con_by_window_id(xcb_window_t window);
*/ */
Con *con_by_frame_id(xcb_window_t frame); Con *con_by_frame_id(xcb_window_t frame);
/**
* Returns the container with the given mark or NULL if no such container
* exists.
*
*/
Con *con_by_mark(const char *mark);
/**
* Toggles the mark on a container.
* If the container already has this mark, the mark is removed.
* Otherwise, the mark is assigned to the container.
*
*/
void con_mark_toggle(Con *con, const char *mark);
/**
* Assigns a mark to the container.
*
*/
void con_mark(Con *con, const char *mark);
/**
* If mark is NULL, this removes all existing marks.
* Otherwise, it will only remove the given mark (if it is present).
*
*/
void con_unmark(const char *mark);
/** /**
* Returns the first container below 'con' which wants to swallow this window * Returns the first container below 'con' which wants to swallow this window
* TODO: priority * TODO: priority
@ -198,10 +239,20 @@ void con_disable_fullscreen(Con *con);
* The dont_warp flag disables pointer warping and will be set when this * The dont_warp flag disables pointer warping and will be set when this
* function is called while dragging a floating window. * function is called while dragging a floating window.
* *
* If ignore_focus is set, the container will be moved without modifying focus
* at all.
*
* TODO: is there a better place for this function? * TODO: is there a better place for this function?
* *
*/ */
void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates, bool dont_warp); void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates,
bool dont_warp, bool ignore_focus);
/**
* Moves the given container to the given mark.
*
*/
bool con_move_to_mark(Con *con, const char *mark);
/** /**
* Returns the orientation of the given container (for stacked containers, * Returns the orientation of the given container (for stacked containers,

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* include/config.h: Contains all structs/variables for the configurable * include/config.h: Contains all structs/variables for the configurable
* part of i3 as well as functions handling the configuration file (calling * part of i3 as well as functions handling the configuration file (calling
@ -167,6 +167,22 @@ struct Config {
* flag can be delayed using an urgency timer. */ * flag can be delayed using an urgency timer. */
float workspace_urgency_timer; float workspace_urgency_timer;
/** Behavior when a window sends a NET_ACTIVE_WINDOW message. */
enum {
/* Focus if the target workspace is visible, set urgency hint otherwise. */
FOWA_SMART,
/* Always set the urgency hint. */
FOWA_URGENT,
/* Always focus the window. */
FOWA_FOCUS,
/* Ignore the request (no focus, no urgency hint). */
FOWA_NONE
} focus_on_window_activation;
/** Specifies whether or not marks should be displayed in the window
* decoration. Marks starting with a "_" will be ignored either way. */
bool show_marks;
/** The default border style for new windows. */ /** The default border style for new windows. */
border_style_t default_border; border_style_t default_border;
@ -235,6 +251,9 @@ struct Barconfig {
* disables the tray (its enabled by default). */ * disables the tray (its enabled by default). */
char *tray_output; char *tray_output;
/* Padding around the tray icons. */
int tray_padding;
/** Path to the i3 IPC socket. This option is discouraged since programs /** Path to the i3 IPC socket. This option is discouraged since programs
* can find out the path by looking for the I3_SOCKET_PATH property on the * can find out the path by looking for the I3_SOCKET_PATH property on the
* root window! */ * root window! */
@ -261,13 +280,7 @@ struct Barconfig {
M_MOD5 = 7 M_MOD5 = 7
} modifier; } modifier;
/** Command that should be run when mouse wheel up button is pressed over TAILQ_HEAD(bar_bindings_head, Barbinding) bar_bindings;
* i3bar to override the default behavior. */
char *wheel_up_cmd;
/** Command that should be run when mouse wheel down button is pressed over
* i3bar to override the default behavior. */
char *wheel_down_cmd;
/** Bar position (bottom by default). */ /** Bar position (bottom by default). */
enum { P_BOTTOM = 0, enum { P_BOTTOM = 0,
@ -324,11 +337,30 @@ struct Barconfig {
char *urgent_workspace_border; char *urgent_workspace_border;
char *urgent_workspace_bg; char *urgent_workspace_bg;
char *urgent_workspace_text; char *urgent_workspace_text;
char *binding_mode_border;
char *binding_mode_bg;
char *binding_mode_text;
} colors; } colors;
TAILQ_ENTRY(Barconfig) configs; TAILQ_ENTRY(Barconfig) configs;
}; };
/**
* Defines a mouse command to be executed instead of the default behavior when
* clicking on the non-statusline part of i3bar.
*
*/
struct Barbinding {
/** The button to be used (e.g., 1 for "button1"). */
int input_code;
/** The command which is to be executed for this button. */
char *command;
TAILQ_ENTRY(Barbinding) bindings;
};
/** /**
* Finds the configuration file to use (either the one specified by * Finds the configuration file to use (either the one specified by
* override_configpath), the users one or the system default) and calls * override_configpath), the users one or the system default) and calls

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* config_directives.h: all config storing functions (see config_parser.c) * config_directives.h: all config storing functions (see config_parser.c)
* *
@ -12,10 +12,10 @@
#include "config_parser.h" #include "config_parser.h"
/** /**
* A utility function to convert a string of modifiers to the corresponding bit * A utility function to convert a string containing the group and modifiers to
* mask. * the corresponding bit mask.
*/ */
uint32_t modifiers_from_str(const char *str); i3_event_state_mask_t event_state_from_str(const char *str);
/** The beginning of the prototype for every cfg_ function. */ /** The beginning of the prototype for every cfg_ function. */
#define I3_CFG Match *current_match, struct ConfigResultIR *result #define I3_CFG Match *current_match, struct ConfigResultIR *result
@ -51,8 +51,11 @@ CFGFUN(force_focus_wrapping, const char *value);
CFGFUN(force_xinerama, const char *value); CFGFUN(force_xinerama, const char *value);
CFGFUN(fake_outputs, const char *outputs); CFGFUN(fake_outputs, const char *outputs);
CFGFUN(force_display_urgency_hint, const long duration_ms); CFGFUN(force_display_urgency_hint, const long duration_ms);
CFGFUN(focus_on_window_activation, const char *mode);
CFGFUN(show_marks, const char *value);
CFGFUN(hide_edge_borders, const char *borders); CFGFUN(hide_edge_borders, const char *borders);
CFGFUN(assign, const char *workspace); CFGFUN(assign, const char *workspace);
CFGFUN(no_focus);
CFGFUN(ipc_socket, const char *path); CFGFUN(ipc_socket, const char *path);
CFGFUN(restart_state, const char *path); CFGFUN(restart_state, const char *path);
CFGFUN(popup_during_fullscreen, const char *value); CFGFUN(popup_during_fullscreen, const char *value);
@ -61,10 +64,10 @@ CFGFUN(color_single, const char *colorclass, const char *color);
CFGFUN(floating_modifier, const char *modifiers); CFGFUN(floating_modifier, const char *modifiers);
CFGFUN(new_window, const char *windowtype, const char *border, const long width); CFGFUN(new_window, const char *windowtype, const char *border, const long width);
CFGFUN(workspace, const char *workspace, const char *output); CFGFUN(workspace, const char *workspace, const char *output);
CFGFUN(binding, const char *bindtype, const char *modifiers, const char *key, const char *release, const char *whole_window, const char *command); CFGFUN(binding, const char *bindtype, const char *modifiers, const char *key, const char *release, const char *border, const char *whole_window, const char *command);
CFGFUN(enter_mode, const char *mode); CFGFUN(enter_mode, const char *mode);
CFGFUN(mode_binding, const char *bindtype, const char *modifiers, const char *key, const char *release, const char *whole_window, const char *command); CFGFUN(mode_binding, const char *bindtype, const char *modifiers, const char *key, const char *release, const char *border, const char *whole_window, const char *command);
CFGFUN(bar_font, const char *font); CFGFUN(bar_font, const char *font);
CFGFUN(bar_separator_symbol, const char *separator); CFGFUN(bar_separator_symbol, const char *separator);
@ -76,14 +79,17 @@ CFGFUN(bar_verbose, const char *verbose);
CFGFUN(bar_modifier, const char *modifier); CFGFUN(bar_modifier, const char *modifier);
CFGFUN(bar_wheel_up_cmd, const char *command); CFGFUN(bar_wheel_up_cmd, const char *command);
CFGFUN(bar_wheel_down_cmd, const char *command); CFGFUN(bar_wheel_down_cmd, const char *command);
CFGFUN(bar_bindsym, const char *button, const char *command);
CFGFUN(bar_position, const char *position); CFGFUN(bar_position, const char *position);
CFGFUN(bar_i3bar_command, const char *i3bar_command); CFGFUN(bar_i3bar_command, const char *i3bar_command);
CFGFUN(bar_color, const char *colorclass, const char *border, const char *background, const char *text); CFGFUN(bar_color, const char *colorclass, const char *border, const char *background, const char *text);
CFGFUN(bar_socket_path, const char *socket_path); CFGFUN(bar_socket_path, const char *socket_path);
CFGFUN(bar_tray_output, const char *output); CFGFUN(bar_tray_output, const char *output);
CFGFUN(bar_tray_padding, const long spacing_px);
CFGFUN(bar_color_single, const char *colorclass, const char *color); CFGFUN(bar_color_single, const char *colorclass, const char *color);
CFGFUN(bar_status_command, const char *command); CFGFUN(bar_status_command, const char *command);
CFGFUN(bar_binding_mode_indicator, const char *value); CFGFUN(bar_binding_mode_indicator, const char *value);
CFGFUN(bar_workspace_buttons, const char *value); CFGFUN(bar_workspace_buttons, const char *value);
CFGFUN(bar_strip_workspace_numbers, const char *value); CFGFUN(bar_strip_workspace_numbers, const char *value);
CFGFUN(bar_start);
CFGFUN(bar_finish); CFGFUN(bar_finish);

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* config_parser.h: config parser-related definitions * config_parser.h: config parser-related definitions
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* include/data.h: This file defines all data structures used by i3 * include/data.h: This file defines all data structures used by i3
* *
@ -74,18 +74,6 @@ typedef enum { ADJ_NONE = 0,
ADJ_UPPER_SCREEN_EDGE = (1 << 2), ADJ_UPPER_SCREEN_EDGE = (1 << 2),
ADJ_LOWER_SCREEN_EDGE = (1 << 4) } adjacent_t; ADJ_LOWER_SCREEN_EDGE = (1 << 4) } adjacent_t;
enum {
BIND_NONE = 0,
BIND_SHIFT = XCB_MOD_MASK_SHIFT, /* (1 << 0) */
BIND_CONTROL = XCB_MOD_MASK_CONTROL, /* (1 << 2) */
BIND_MOD1 = XCB_MOD_MASK_1, /* (1 << 3) */
BIND_MOD2 = XCB_MOD_MASK_2, /* (1 << 4) */
BIND_MOD3 = XCB_MOD_MASK_3, /* (1 << 5) */
BIND_MOD4 = XCB_MOD_MASK_4, /* (1 << 6) */
BIND_MOD5 = XCB_MOD_MASK_5, /* (1 << 7) */
BIND_MODE_SWITCH = (1 << 8)
};
/** /**
* Container layouts. See Con::layout. * Container layouts. See Con::layout.
*/ */
@ -107,6 +95,25 @@ typedef enum {
B_MOUSE = 1 B_MOUSE = 1
} input_type_t; } input_type_t;
/**
* Bitmask for matching XCB_XKB_GROUP_1 to XCB_XKB_GROUP_4.
*/
typedef enum {
I3_XKB_GROUP_MASK_ANY = 0,
I3_XKB_GROUP_MASK_1 = (1 << 0),
I3_XKB_GROUP_MASK_2 = (1 << 1),
I3_XKB_GROUP_MASK_3 = (1 << 2),
I3_XKB_GROUP_MASK_4 = (1 << 3)
} i3_xkb_group_mask_t;
/**
* The lower 16 bits contain a xcb_key_but_mask_t, the higher 16 bits contain
* an i3_xkb_group_mask_t. This type is necessary for the fallback logic to
* work when handling XKB groups (see ticket #1775) and makes the code which
* locates keybindings upon KeyPress/KeyRelease events simpler.
*/
typedef uint32_t i3_event_state_mask_t;
/** /**
* Mouse pointer warping modes. * Mouse pointer warping modes.
*/ */
@ -255,6 +262,10 @@ struct Binding {
B_UPON_KEYRELEASE_IGNORE_MODS = 2, B_UPON_KEYRELEASE_IGNORE_MODS = 2,
} release; } release;
/** If this is true for a mouse binding, the binding should be executed
* when the button is pressed over the window border. */
bool border;
/** If this is true for a mouse binding, the binding should be executed /** If this is true for a mouse binding, the binding should be executed
* when the button is pressed over any part of the window, not just the * when the button is pressed over any part of the window, not just the
* title bar (default). */ * title bar (default). */
@ -265,8 +276,10 @@ struct Binding {
/** Keycode to bind */ /** Keycode to bind */
uint32_t keycode; uint32_t keycode;
/** Bitmask consisting of BIND_MOD_1, BIND_MODE_SWITCH, … */ /** Bitmask which is applied against event->state for KeyPress and
uint32_t mods; * KeyRelease events to determine whether this binding applies to the
* current state. */
i3_event_state_mask_t event_state_mask;
/** Symbol the user specified in configfile, if any. This needs to be /** Symbol the user specified in configfile, if any. This needs to be
* stored with the binding to be able to re-convert it into a keycode * stored with the binding to be able to re-convert it into a keycode
@ -359,6 +372,8 @@ struct Window {
/** The name of the window. */ /** The name of the window. */
i3String *name; i3String *name;
/** The format with which the window's name should be displayed. */
char *title_format;
/** The WM_WINDOW_ROLE of this window (for example, the pidgin buddy window /** The WM_WINDOW_ROLE of this window (for example, the pidgin buddy window
* sets "buddy list"). Useful to match specific windows in assignments or * sets "buddy list"). Useful to match specific windows in assignments or
@ -378,6 +393,9 @@ struct Window {
* default will be 'accepts focus'. */ * default will be 'accepts focus'. */
bool doesnt_accept_focus; bool doesnt_accept_focus;
/** The _NET_WM_WINDOW_TYPE for this window. */
xcb_atom_t window_type;
/** Whether the window says it is a dock window */ /** Whether the window says it is a dock window */
enum { W_NODOCK = 0, enum { W_NODOCK = 0,
W_DOCK_TOP = 1, W_DOCK_TOP = 1,
@ -391,6 +409,18 @@ struct Window {
/** Depth of the window */ /** Depth of the window */
uint16_t depth; uint16_t depth;
/* the wanted size of the window, used in combination with size
* increments (see below). */
int base_width;
int base_height;
/* minimum increment size specified for the window (in pixels) */
int width_increment;
int height_increment;
/* aspect ratio from WM_NORMAL_HINTS (MPlayer uses this for example) */
double aspect_ratio;
}; };
/** /**
@ -408,6 +438,8 @@ struct Match {
struct regex *instance; struct regex *instance;
struct regex *mark; struct regex *mark;
struct regex *window_role; struct regex *window_role;
struct regex *workspace;
xcb_atom_t window_type;
enum { enum {
U_DONTCHECK = -1, U_DONTCHECK = -1,
U_LATEST = 0, U_LATEST = 0,
@ -460,6 +492,7 @@ struct Assignment {
* *
* A_COMMAND = run the specified command for the matching window * A_COMMAND = run the specified command for the matching window
* A_TO_WORKSPACE = assign the matching window to the specified workspace * A_TO_WORKSPACE = assign the matching window to the specified workspace
* A_NO_FOCUS = don't focus matched window when it is managed
* *
* While the type is a bitmask, only one value can be set at a time. It is * While the type is a bitmask, only one value can be set at a time. It is
* a bitmask to allow filtering for multiple types, for example in the * a bitmask to allow filtering for multiple types, for example in the
@ -469,7 +502,8 @@ struct Assignment {
enum { enum {
A_ANY = 0, A_ANY = 0,
A_COMMAND = (1 << 0), A_COMMAND = (1 << 0),
A_TO_WORKSPACE = (1 << 1) A_TO_WORKSPACE = (1 << 1),
A_NO_FOCUS = (1 << 2)
} type; } type;
/** the criteria to check if a window matches */ /** the criteria to check if a window matches */
@ -543,24 +577,15 @@ struct Con {
/* user-definable mark to jump to this container later */ /* user-definable mark to jump to this container later */
char *mark; char *mark;
/* cached to decide whether a redraw is needed */
bool mark_changed;
double percent; double percent;
/* aspect ratio from WM_NORMAL_HINTS (MPlayer uses this for example) */
double aspect_ratio;
/* the wanted size of the window, used in combination with size
* increments (see below). */
int base_width;
int base_height;
/* the x11 border pixel attribute */ /* the x11 border pixel attribute */
int border_width; int border_width;
int current_border_width; int current_border_width;
/* minimum increment size specified for the window (in pixels) */
int width_increment;
int height_increment;
struct Window *window; struct Window *window;
/* timer used for disabling urgency */ /* timer used for disabling urgency */
@ -578,6 +603,12 @@ struct Con {
TAILQ_HEAD(swallow_head, Match) swallow_head; TAILQ_HEAD(swallow_head, Match) swallow_head;
fullscreen_mode_t fullscreen_mode; fullscreen_mode_t fullscreen_mode;
/* Whether this window should stick to the glass. This corresponds to
* the _NET_WM_STATE_STICKY atom and will only be respected if the
* window is floating. */
bool sticky;
/* layout is the layout of this container: one of split[v|h], stacked or /* layout is the layout of this container: one of split[v|h], stacked or
* tabbed. Special containers in the tree (above workspaces) have special * tabbed. Special containers in the tree (above workspaces) have special
* layouts like dockarea or output. * layouts like dockarea or output.

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* debug.c: Debugging functions, especially FormatEvent, which prints unhandled * debug.c: Debugging functions, especially FormatEvent, which prints unhandled
* events. This code is from xcb-util. * events. This code is from xcb-util.

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* display_version.c: displays the running i3 version, runs as part of * display_version.c: displays the running i3 version, runs as part of
* i3 --moreversion. * i3 --moreversion.

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* ewmh.c: Get/set certain EWMH properties easily. * ewmh.c: Get/set certain EWMH properties easily.
* *
@ -45,6 +45,12 @@ void ewmh_update_desktop_viewport(void);
*/ */
void ewmh_update_active_window(xcb_window_t window); void ewmh_update_active_window(xcb_window_t window);
/**
* Updates _NET_WM_VISIBLE_NAME.
*
*/
void ewmh_update_visible_name(xcb_window_t window, const char *name);
/** /**
* Updates the _NET_CLIENT_LIST hint. Used for window listers. * Updates the _NET_CLIENT_LIST hint. Used for window listers.
*/ */
@ -62,6 +68,12 @@ void ewmh_update_client_list(xcb_window_t *list, int num_windows);
*/ */
void ewmh_update_client_list_stacking(xcb_window_t *stack, int num_windows); void ewmh_update_client_list_stacking(xcb_window_t *stack, int num_windows);
/**
* Set or remove _NET_WM_STATE_STICKY on the window.
*
*/
void ewmh_update_sticky(xcb_window_t window, bool sticky);
/** /**
* Set up the EWMH hints on the root window. * Set up the EWMH hints on the root window.
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* Faking outputs is useful in pathological situations (like network X servers * Faking outputs is useful in pathological situations (like network X servers
* which dont support multi-monitor in a useful way) and for our testsuite. * which dont support multi-monitor in a useful way) and for our testsuite.

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* floating.c: Floating windows. * floating.c: Floating windows.
* *
@ -64,6 +64,18 @@ void floating_raise_con(Con *con);
*/ */
bool floating_maybe_reassign_ws(Con *con); bool floating_maybe_reassign_ws(Con *con);
/**
* Centers a floating con above the specified rect.
*
*/
void floating_center(Con *con, Rect rect);
/**
* Moves the given floating con to the current pointer position.
*
*/
void floating_move_to_pointer(Con *con);
#if 0 #if 0
/** /**
* Removes the floating client from its workspace and attaches it to the new * Removes the floating client from its workspace and attaches it to the new
@ -176,6 +188,15 @@ drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event,
*/ */
void floating_reposition(Con *con, Rect newrect); void floating_reposition(Con *con, Rect newrect);
/**
* Sets size of the CT_FLOATING_CON to specified dimensions. Might limit the
* actual size with regard to size constraints taken from user settings.
* Additionally, the dimensions may be upscaled until they're divisible by the
* window's size hints.
*
*/
void floating_resize(Con *floating_con, int x, int y);
/** /**
* Fixes the coordinates of the floating window whenever the window gets * Fixes the coordinates of the floating window whenever the window gets
* reassigned to a different output (or when the outputs rect changes). * reassigned to a different output (or when the outputs rect changes).

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* handlers.c: Small handlers for various events (keypresses, focus changes, * handlers.c: Small handlers for various events (keypresses, focus changes,
* ). * ).

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* i3.h: global variables that are used all over i3. * i3.h: global variables that are used all over i3.
* *
@ -24,6 +24,9 @@
#include "data.h" #include "data.h"
#include "xcb.h" #include "xcb.h"
/** Git commit identifier, from version.c */
extern const char *i3_version;
/** The original value of RLIMIT_CORE when i3 was started. We need to restore /** The original value of RLIMIT_CORE when i3 was started. We need to restore
* this before starting any other process, since we set RLIMIT_CORE to * this before starting any other process, since we set RLIMIT_CORE to
* RLIM_INFINITY for i3 debugging versions. */ * RLIM_INFINITY for i3 debugging versions. */
@ -34,6 +37,15 @@ extern bool debug_build;
extern int listen_fds; extern int listen_fds;
extern xcb_connection_t *conn; extern xcb_connection_t *conn;
extern int conn_screen; extern int conn_screen;
/**
* The EWMH support window that is used to indicate that an EWMH-compliant
* window manager is present. This window is created when i3 starts and
* kept alive until i3 exits.
* We also use this window as the focused window if no other window is
* available to be focused on the active workspace in order to prevent
* keyboard focus issues (see #1378).
*/
extern xcb_window_t ewmh_window;
/** The last timestamp we got from X11 (timestamps are included in some events /** The last timestamp we got from X11 (timestamps are included in some events
* and are used for some things, like determining a unique ID in startup * and are used for some things, like determining a unique ID in startup
* notification). */ * notification). */

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* This public header defines the different constants and message types to use * This public header defines the different constants and message types to use
* for the IPC interface to i3 (see docs/ipc for more information). * for the IPC interface to i3 (see docs/ipc for more information).

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* ipc.c: UNIX domain socket IPC (initialization, client handling, protocol). * ipc.c: UNIX domain socket IPC (initialization, client handling, protocol).
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* key_press.c: key press handler * key_press.c: key press handler
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* libi3: contains functions which are used by i3 *and* accompanying tools such * libi3: contains functions which are used by i3 *and* accompanying tools such
* as i3-msg, i3-config-wizard, * as i3-msg, i3-config-wizard,
@ -21,6 +21,8 @@
#include <pango/pango.h> #include <pango/pango.h>
#endif #endif
#define DEFAULT_DIR_MODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
/** /**
* Opaque data structure for storing strings. * Opaque data structure for storing strings.
* *
@ -111,7 +113,7 @@ void *smalloc(size_t size);
* there is no more memory available) * there is no more memory available)
* *
*/ */
void *scalloc(size_t size); void *scalloc(size_t num, size_t size);
/** /**
* Safe-wrapper around realloc which exits if realloc returns NULL (meaning * Safe-wrapper around realloc which exits if realloc returns NULL (meaning
@ -127,6 +129,13 @@ void *srealloc(void *ptr, size_t size);
*/ */
char *sstrdup(const char *str); char *sstrdup(const char *str);
/**
* Safe-wrapper around strndup which exits if strndup returns NULL (meaning that
* there is no more memory available)
*
*/
char *sstrndup(const char *str, size_t size);
/** /**
* Safe-wrapper around asprintf which exits if it returns -1 (meaning that * Safe-wrapper around asprintf which exits if it returns -1 (meaning that
* there is no more memory available) * there is no more memory available)
@ -236,6 +245,11 @@ bool i3string_is_markup(i3String *str);
*/ */
void i3string_set_markup(i3String *str, bool is_markup); void i3string_set_markup(i3String *str, bool is_markup);
/**
* Escape pango markup characters in the given string.
*/
i3String *i3string_escape_markup(i3String *str);
/** /**
* Returns the number of glyphs in an i3String. * Returns the number of glyphs in an i3String.
* *
@ -374,6 +388,12 @@ xcb_char2b_t *convert_utf8_to_ucs2(char *input, size_t *real_strlen);
*/ */
void set_font_colors(xcb_gcontext_t gc, uint32_t foreground, uint32_t background); void set_font_colors(xcb_gcontext_t gc, uint32_t foreground, uint32_t background);
/**
* Returns true if and only if the current font is a pango font.
*
*/
bool font_is_pango(void);
/** /**
* Draws text onto the specified X drawable (normally a pixmap) at the * Draws text onto the specified X drawable (normally a pixmap) at the
* specified coordinates (from the top left corner of the leftmost, uppermost * specified coordinates (from the top left corner of the leftmost, uppermost
@ -435,8 +455,28 @@ char *get_exe_path(const char *argv0);
*/ */
int logical_px(const int logical); int logical_px(const int logical);
/**
* This function resolves ~ in pathnames.
* It may resolve wildcards in the first part of the path, but if no match
* or multiple matches are found, it just returns a copy of path as given.
*
*/
char *resolve_tilde(const char *path);
/**
* Get the path of the first configuration file found. If override_configpath
* is specified, that path is returned and saved for further calls. Otherwise,
* checks the home directory first, then the system directory first, always
* taking into account the XDG Base Directory Specification ($XDG_CONFIG_HOME,
* $XDG_CONFIG_DIRS)
*
*/
char *get_config_path(const char *override_configpath, bool use_system_paths);
#if !defined(__sun)
/** /**
* Emulates mkdir -p (creates any missing folders) * Emulates mkdir -p (creates any missing folders)
* *
*/ */
bool mkdirp(const char *path); int mkdirp(const char *path, mode_t mode);
#endif

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2014 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* load_layout.c: Restore (parts of) the layout, for example after an inplace * load_layout.c: Restore (parts of) the layout, for example after an inplace
* restart. * restart.

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* log.c: Logging functions. * log.c: Logging functions.
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* main.c: Initialization, main loop * main.c: Initialization, main loop
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* manage.c: Initially managing new windows (or existing ones on restart). * manage.c: Initially managing new windows (or existing ones on restart).
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* A "match" is a data structure which acts like a mask or expression to match * A "match" is a data structure which acts like a mask or expression to match
* certain windows or not. For example, when using commands, you can specify a * certain windows or not. For example, when using commands, you can specify a

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* move.c: Moving containers into some direction. * move.c: Moving containers into some direction.
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* output.c: Output (monitor) related functions. * output.c: Output (monitor) related functions.
* *
@ -21,3 +21,10 @@ Con *output_get_content(Con *output);
* *
*/ */
Output *get_output_from_string(Output *current_output, const char *output_str); Output *get_output_from_string(Output *current_output, const char *output_str);
/**
* Iterates over all outputs and pushes sticky windows to the currently visible
* workspace on that output.
*
*/
void output_push_sticky_windows(Con *to_focus);

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* For more information on RandR, please see the X.org RandR specification at * For more information on RandR, please see the X.org RandR specification at
* http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt * http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt
@ -29,13 +29,6 @@ typedef enum {
*/ */
void randr_init(int *event_base); void randr_init(int *event_base);
/**
* Disables RandR support by creating exactly one output with the size of the
* X11 screen.
*
*/
void disable_randr(xcb_connection_t *conn);
/** /**
* Initializes a CT_OUTPUT Con (searches existing ones from inplace restart * Initializes a CT_OUTPUT Con (searches existing ones from inplace restart
* before) to use for the given Output. * before) to use for the given Output.
@ -120,3 +113,9 @@ Output *get_output_next(direction_t direction, Output *current, output_close_far
* *
*/ */
Output *get_output_next_wrap(direction_t direction, Output *current); Output *get_output_next_wrap(direction_t direction, Output *current);
/*
* Creates an output covering the root window.
*
*/
Output *create_root_output(xcb_connection_t *conn);

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* regex.c: Interface to libPCRE (perl compatible regular expressions). * regex.c: Interface to libPCRE (perl compatible regular expressions).
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* render.c: Renders (determines position/sizes) the layout tree, updating the * render.c: Renders (determines position/sizes) the layout tree, updating the
* various rects. Needs to be pushed to X11 (see x.c) to be visible. * various rects. Needs to be pushed to X11 (see x.c) to be visible.

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* resize.c: Interactive resizing. * resize.c: Interactive resizing.
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* restore_layout.c: Everything for restored containers that is not pure state * restore_layout.c: Everything for restored containers that is not pure state
* parsing (which can be found in load_layout.c). * parsing (which can be found in load_layout.c).

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* scratchpad.c: Scratchpad functions (TODO: more description) * scratchpad.c: Scratchpad functions (TODO: more description)
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* The format of the shmlog data structure which i3 development versions use by * The format of the shmlog data structure which i3 development versions use by
* default (ringbuffer for storing the debug log). * default (ringbuffer for storing the debug log).

View File

@ -2,8 +2,8 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* © 2009-2010 Jan-Erik Rediger * © 2009 Jan-Erik Rediger
* *
* sighandler.c: Interactive crash dialog upon SIGSEGV/SIGABRT/SIGFPE (offers * sighandler.c: Interactive crash dialog upon SIGSEGV/SIGABRT/SIGFPE (offers
* to restart inplace). * to restart inplace).

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* startup.c: Startup notification code. Ensures a startup notification context * startup.c: Startup notification code. Ensures a startup notification context
* is setup when launching applications. We store the current * is setup when launching applications. We store the current

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* tree.c: Everything that primarily modifies the layout tree data structure. * tree.c: Everything that primarily modifies the layout tree data structure.
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* util.c: Utility functions, which can be useful everywhere within i3 (see * util.c: Utility functions, which can be useful everywhere within i3 (see
* also libi3). * also libi3).
@ -106,14 +106,6 @@ void exec_i3_utility(char *name, char *argv[]);
void check_error(xcb_connection_t *conn, xcb_void_cookie_t cookie, void check_error(xcb_connection_t *conn, xcb_void_cookie_t cookie,
char *err_message); char *err_message);
/**
* This function resolves ~ in pathnames.
* It may resolve wildcards in the first part of the path, but if no match
* or multiple matches are found, it just returns a copy of path as given.
*
*/
char *resolve_tilde(const char *path);
/** /**
* Checks if the given path exists by calling stat(). * Checks if the given path exists by calling stat().
* *

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* window.c: Updates window attributes (X11 hints/properties). * window.c: Updates window attributes (X11 hints/properties).
* *
@ -56,6 +56,12 @@ void window_update_strut_partial(i3Window *win, xcb_get_property_reply_t *prop);
*/ */
void window_update_role(i3Window *win, xcb_get_property_reply_t *prop, bool before_mgmt); void window_update_role(i3Window *win, xcb_get_property_reply_t *prop, bool before_mgmt);
/**
* Updates the _NET_WM_WINDOW_TYPE property.
*
*/
void window_update_type(i3Window *window, xcb_get_property_reply_t *reply);
/** /**
* Updates the WM_HINTS (we only care about the input focus handling part). * Updates the WM_HINTS (we only care about the input focus handling part).
* *
@ -75,3 +81,10 @@ void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *ur
* *
*/ */
void window_update_motif_hints(i3Window *win, xcb_get_property_reply_t *prop, border_style_t *motif_border_style); void window_update_motif_hints(i3Window *win, xcb_get_property_reply_t *prop, border_style_t *motif_border_style);
/**
* Returns the window title considering the current title format.
* If no format is set, this will simply return the window's name.
*
*/
i3String *window_parse_title_format(i3Window *win);

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
* *
* workspace.c: Modifying workspaces, accessing them, moving containers to * workspace.c: Modifying workspaces, accessing them, moving containers to
* workspaces. * workspaces.
@ -25,7 +25,16 @@
*/ */
Con *workspace_get(const char *num, bool *created); Con *workspace_get(const char *num, bool *created);
/* /**
* Extracts workspace names from keybindings (e.g. web from bindsym $mod+1
* workspace web), so that when an output needs a workspace, i3 can start with
* the first configured one. Needs to be called before reorder_bindings() so
* that the config-file order is used, not the i3-internal order.
*
*/
void extract_workspace_names_from_bindings(void);
/**
* Returns a pointer to a new workspace in the given output. The workspace * Returns a pointer to a new workspace in the given output. The workspace
* is created attached to the tree hierarchy through the given content * is created attached to the tree hierarchy through the given content
* container. * container.

Some files were not shown because too many files have changed in this diff Show More