Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/gaps-next' into gaps
Browse files Browse the repository at this point in the history
  • Loading branch information
Airblader committed Mar 10, 2018
2 parents 830696f + 12a4ae3 commit 667271b
Show file tree
Hide file tree
Showing 133 changed files with 2,951 additions and 1,494 deletions.
16 changes: 15 additions & 1 deletion AnyEvent-I3/lib/AnyEvent/I3.pm
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ use constant TYPE_GET_BAR_CONFIG => 6;
use constant TYPE_GET_VERSION => 7;
use constant TYPE_GET_BINDING_MODES => 8;
use constant TYPE_GET_CONFIG => 9;
use constant TYPE_SEND_TICK => 10;

our %EXPORT_TAGS = ( 'all' => [
qw(i3 TYPE_RUN_COMMAND TYPE_COMMAND TYPE_GET_WORKSPACES TYPE_SUBSCRIBE TYPE_GET_OUTPUTS
TYPE_GET_TREE TYPE_GET_MARKS TYPE_GET_BAR_CONFIG TYPE_GET_VERSION
TYPE_GET_BINDING_MODES TYPE_GET_CONFIG)
TYPE_GET_BINDING_MODES TYPE_GET_CONFIG TYPE_SEND_TICK)
] );

our @EXPORT_OK = ( @{ $EXPORT_TAGS{all} } );
Expand All @@ -120,6 +121,7 @@ my %events = (
barconfig_update => ($event_mask | 4),
binding => ($event_mask | 5),
shutdown => ($event_mask | 6),
tick => ($event_mask | 7),
_error => 0xFFFFFFFF,
);

Expand Down Expand Up @@ -519,6 +521,18 @@ sub get_config {
$self->message(TYPE_GET_CONFIG);
}

=head2 send_tick
Sends a tick event. Requires i3 >= 4.15
=cut
sub send_tick {
my ($self, $payload) = @_;

$self->_ensure_connection;

$self->message(TYPE_SEND_TICK, $payload);
}

=head2 command($content)
Expand Down
5 changes: 5 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ EXTRA_DIST = \
AnyEvent-I3/t/manifest.t \
AnyEvent-I3/t/pod-coverage.t \
AnyEvent-I3/t/pod.t \
contrib/dump-asy.pl \
contrib/gtk-tree-watch.pl \
contrib/i3-wsbar \
contrib/per-workspace-layout.pl \
contrib/trivial-bar-script.sh \
docs/asciidoc-git.conf \
docs/bigpicture.png \
docs/i3-pod2html \
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Please refer to the [wiki](https://github.com/Airblader/i3/wiki/Compiling-&-Inst

Note: Gaps will only work correctly if you disable window titlebars entirely. Unfortunately this is necessary due to the way i3 creates such bars on windows. You can disable them via `for_window [class="^.*"] border pixel 0` in your config. You can also use any non-zero value as long as you only use pixel-style borders.

Based on the patches provided by o4dev and jeanbroid, i3 supports gaps between containers. I extended those patches further to make changing the gaps size easier during runtime and also to expose more functionality for binding it to keys. Additionally, the gaps patch was fixed such that the gaps between containers and the gaps between containers and the edge of the screen are the same. But I didn't stop there: these gaps are called "inner" gaps. This fork also allows setting "outer" gaps which inset all containers independently.
Based on the patches provided by o4dev and jeanbroid, i3 supports gaps between containers. I extended those patches further to make changing the gaps size easier during runtime and also to expose more functionality for binding it to keys. Additionally, the gaps patch was fixed such that inner gaps (the gaps between adjacent containers) and outer gaps (gaps between the edge of the screen and a container) are the same. But I didn't stop there: these gaps are called "inner" gaps. This fork also allows setting "outer" gaps which inset all containers independently.

In your i3 config, you can set a global gap size as shown below. This is the default value that will be used for all workspaces:

Expand Down Expand Up @@ -130,7 +130,9 @@ Based on the patch from [i3-extras](https://github.com/ashinkarov/i3-extras), sm
```
smart_borders on|no_gaps
```
### Hide Edge Borders

An additional option `smart_no_gaps` is available for `hide_edge_borders`. This will hide all borders on a container if it is the only container in the worskpace *and* the gap size to the edge is `0`. Otherwise all borders will be drawn normally.

## i3bar

Expand Down
14 changes: 11 additions & 3 deletions contrib/dump-asy.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
use Data::Dumper;
use AnyEvent::I3;
use File::Temp;
use File::Basename;
use v5.10;
use IPC::Cmd qw[can_run];

# prerequisites check so we can be specific about failures caused
# by not having these tools in the path
can_run('asy') or die 'Please install asymptote';
can_run('gv') or die 'Please install gv';

my $i3 = i3();

Expand All @@ -30,15 +37,15 @@ sub dump_node {

my $o = ($n->{orientation} eq 'none' ? "u" : ($n->{orientation} eq 'horizontal' ? "h" : "v"));
my $w = (defined($n->{window}) ? $n->{window} : "N");
my $na = $n->{name};
my $na = ($n->{name} or "[Empty]");
$na =~ s/#/\\#/g;
$na =~ s/\$/\\\$/g;
$na =~ s/&/\\&/g;
$na =~ s/_/\\_/g;
$na =~ s/~/\\textasciitilde{}/g;
my $type = 'leaf';
if (!defined($n->{window})) {
$type = $n->{orientation} . '-split';
$type = $n->{layout};
}
my $name = qq|``$na'' ($type)|;

Expand Down Expand Up @@ -75,4 +82,5 @@ sub find_node_with_name {
close($tmp);
my $rep = "$tmp";
$rep =~ s/asy$/eps/;
system("cd /tmp && asy $tmp && gv --scale=-1000 --noresize --widgetless $rep && rm $rep");
my $tmp_dir = dirname($rep);
system("cd $tmp_dir && asy $tmp && gv --scale=-1000 --noresize --widgetless $rep && rm $rep");
1 change: 1 addition & 0 deletions contrib/per-workspace-layout.pl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use AnyEvent;
use AnyEvent::I3;
use v5.10;
use utf8;

my %layouts = (
'4' => 'tabbed',
Expand Down
14 changes: 13 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
i3-wm (4.14.2-1) unstable; urgency=medium

* UNRELEASED

-- Michael Stapelberg <[email protected]> Mon, 25 Sep 2017 08:55:22 +0200

i3-wm (4.14.1-1) unstable; urgency=medium

* New upstream release.

-- Michael Stapelberg <[email protected]> Sun, 24 Sep 2017 19:21:15 +0200

i3-wm (4.14-1) unstable; urgency=medium

* New upstream release.
Expand Down Expand Up @@ -307,7 +319,7 @@ i3-wm (4.0.2-1) unstable; urgency=low
* Bugfix: Use correct format string in load_layout (fixes crash in restart)
* Bugfix: Fix border rendering (border lines were "cutting" through)
* Bugfix: Raise floating windows immediately when dragging/resizing
* Bugfix: Make focus switching work accross outputs again
* Bugfix: Make focus switching work across outputs again
* Bugfix: migration-script: handle resize top/bottom correctly
* Bugfix: Fix focus issue when moving containers to workspaces
* Bugfix: Warp cursor when changing outputs again
Expand Down
5 changes: 5 additions & 0 deletions debian/i3-wm.install
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
debian/tmp/etc
debian/tmp/usr
contrib/dump-asy.pl usr/share/doc/i3-wm/examples/
contrib/gtk-tree-watch.pl usr/share/doc/i3-wm/examples/
contrib/i3-wsbar usr/share/doc/i3-wm/examples/
contrib/per-workspace-layout.pl usr/share/doc/i3-wm/examples/
contrib/trivial-bar-script.sh usr/share/doc/i3-wm/examples/
4 changes: 4 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ override_dh_auto_configure:
# The default is /usr/share/doc/i3
dh_auto_configure -- --docdir=/usr/share/doc/i3-wm

override_dh_builddeb:
# bintray does not support xz currently.
dh_builddeb -- -Zgzip

%:
dh $@ --parallel --builddirectory=build --with=autoreconf
2 changes: 1 addition & 1 deletion docs/debugging
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ When sending bug reports, please attach the *whole* log file. Even if you think
you found the section which clearly highlights the problem, additional
information might be necessary to completely diagnose the problem.

When debugging with us in IRC, be prepared to use a so called nopaste service
When debugging with us in IRC, be prepared to use a so-called nopaste service
such as https://pastebin.com because pasting large amounts of text in IRC
sometimes leads to incomplete lines (servers have line length limitations) or
flood kicks.
Expand Down
14 changes: 12 additions & 2 deletions docs/i3bar-protocol
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ separator_block_width::
markup::
A string that indicates how the text of the block should be parsed. Set to
+"pango"+ to use https://developer.gnome.org/pango/stable/PangoMarkupFormat.html[Pango markup].
Set to +"none"+ to not use any markup (default).
Set to +"none"+ to not use any markup (default). Pango markup only works
if you use a pango font.

If you want to put in your own entries into a block, prefix the key with an
underscore (_). i3bar will ignore all keys it doesn’t understand, and prefixing
Expand Down Expand Up @@ -236,6 +237,11 @@ x, y::
X11 root window coordinates where the click occurred
button::
X11 button ID (for example 1 to 3 for left/middle/right mouse button)
relative_x, relative_y::
Coordinates where the click occurred, with respect to the top left corner
of the block
width, height::
Width and height (in px) of the block

*Example*:
------------------------------------------
Expand All @@ -244,6 +250,10 @@ button::
"instance": "eth0",
"button": 1,
"x": 1320,
"y": 1400
"y": 1400,
"relative_x": 12,
"relative_y": 8,
"width": 50,
"height": 22
}
------------------------------------------
45 changes: 45 additions & 0 deletions docs/ipc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ to do that).
| 7 | +GET_VERSION+ | <<_version_reply,VERSION>> | Gets the i3 version.
| 8 | +GET_BINDING_MODES+ | <<_binding_modes_reply,BINDING_MODES>> | Gets the names of all currently configured binding modes.
| 9 | +GET_CONFIG+ | <<_config_reply,CONFIG>> | Returns the last loaded i3 config.
| 10 | +SEND_TICK+ | <<_tick_reply,TICK>> | Sends a tick event with the specified payload.
|======================================================

So, a typical message could look like this:
Expand Down Expand Up @@ -126,6 +127,8 @@ BINDING_MODES (8)::
Reply to the GET_BINDING_MODES message.
GET_CONFIG (9)::
Reply to the GET_CONFIG message.
TICK (10)::
Reply to the SEND_TICK message.

[[_command_reply]]
=== COMMAND reply
Expand Down Expand Up @@ -637,6 +640,19 @@ which is a string containing the config file as loaded by i3 most recently.
{ "config": "font pango:monospace 8\nbindsym Mod4+q exit\n" }
-------------------

[[_tick_reply]]
=== TICK reply

The reply is a map containing the "success" member. After the reply was
received, the tick event has been written to all IPC connections which subscribe
to tick events. UNIX sockets are usually buffered, but you can be certain that
once you receive the tick event you just triggered, you must have received all
events generated prior to the +SEND_TICK+ message (happened-before relation).

*Example:*
-------------------
{ "success": true }
-------------------

== Events

Expand Down Expand Up @@ -694,6 +710,10 @@ binding (5)::
mouse
shutdown (6)::
Sent when the ipc shuts down because of a restart or exit by user command
tick (7)::
Sent when the ipc client subscribes to the tick event (with +"first":
true+) or when any ipc client sends a SEND_TICK message (with +"first":
false+).

*Example:*
--------------------------------------------------------------------
Expand Down Expand Up @@ -866,6 +886,27 @@ because of a user action such as a +restart+ or +exit+ command. The +change
}
---------------------------

=== tick event

This event is triggered by a subscription to tick events or by a +SEND_TICK+
message.

*Example (upon subscription):*
--------------------------------------------------------------------------------
{
"first": true,
"payload": ""
}
--------------------------------------------------------------------------------

*Example (upon +SEND_TICK+ with a payload of +arbitrary string+):*
--------------------------------------------------------------------------------
{
"first": false,
"payload": "arbitrary string"
}
--------------------------------------------------------------------------------

== See also (existing libraries)

[[libraries]]
Expand All @@ -881,6 +922,7 @@ C++::
* https://github.com/drmgc/i3ipcpp
Go::
* https://github.com/mdirkse/i3ipc-go
* https://github.com/i3/go-i3
JavaScript::
* https://github.com/acrisci/i3ipc-gjs
Lua::
Expand Down Expand Up @@ -958,3 +1000,6 @@ detect the byte order i3 is using:
payload. Then, receive the pending +COMMAND+ message reply in big endian.

5. From here on out, send/receive all messages using the detected byte order.

Find an example implementation of this technique in
https://github.com/i3/go-i3/blob/master/byteorder.go
6 changes: 2 additions & 4 deletions docs/testsuite
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,8 @@ containing the appropriate i3 logfile for each testcase. The latest folder can
always be found under the symlink +latest/+. Unless told differently, it will
run the tests on a separate X server instance (using Xephyr).

Xephyr will open a window where you can inspect the running test. You can run
the tests without an X session with Xvfb, such as with +xvfb-run
./complete-run+. This will also speed up the tests significantly especially on
machines without a powerful video card.
Xephyr will open a window where you can inspect the running test. By default,
tests are run under Xvfb.

.Example invocation of +complete-run.pl+
---------------------------------------
Expand Down
Loading

0 comments on commit 667271b

Please sign in to comment.