Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'vanilla/next' into gaps-next
Browse files Browse the repository at this point in the history
  • Loading branch information
Airblader committed Oct 23, 2018
2 parents ccb1947 + a319860 commit b45cbe7
Show file tree
Hide file tree
Showing 24 changed files with 361 additions and 50 deletions.
10 changes: 8 additions & 2 deletions .github/ISSUE_TEMPLATE.md
Expand Up @@ -15,10 +15,16 @@ IMPORTANT NOTE: If your issue is not specific to any feature provided by i3-gaps
</pre>

## Current Behavior
<!-- Describe the current behavior, e.g., »When pressing Alt+j (focus left), the window above the current window is focused.« -->
<!--
Describe the current behavior,
e.g., »When pressing Alt+j (focus left), the window above the current window is focused.«
-->

## Expected Behavior
<!-- Describe the desired behavior you expect after mitigation of the issue, e.g., »The window left next to the current window should be focused.« -->
<!--
Describe the desired behavior you expect after mitigation of the issue,
e.g., »The window left next to the current window should be focused.«
-->

## Reproduction Instructions
<!--
Expand Down
71 changes: 71 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,71 @@
---
name: Bug report
about: Create a report to help us improve
---

<!--
PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.
-->

## I'm submitting a…
<!-- Please check one of the following options with "x" -->
<pre>
[x] Bug
[ ] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)
</pre>

## Current Behavior
<!--
Describe the current behavior,
e.g., »When pressing Alt+j (focus left), the window above the current window is focused.«
-->

## Expected Behavior
<!--
Describe the desired behavior you expect after mitigation of the issue,
e.g., »The window left next to the current window should be focused.«
-->

## Reproduction Instructions
<!--
Please provide detailed instructions on how the bug can be reproduced.
E.g., »Open three windows in a V[A H[B C]] layout on a new workspace«
-->

## Environment
<!--
Please include your exact i3 version.
Note that we only support the latest major release and the current development version. If you are using an older version of i3, please first update to the current release version and reproduce the issue there.
-->
Output of `i3 --moreversion 2>&-`:
<pre>
i3 version:
</pre>

<!--
Please include your (complete) i3 config with which the issue occurs. You can either paste the file directly or provide a link to a service such as pastebin.
If you would like to help debugging the issue, please try to reduce the config such that it is as close to the default config as possible while still reproducing the issue. This can help us bisect the root cause.
-->
<pre>
</pre>

<!--
Providing a logfile can help us trace the root cause of an issue much quicker. You can learn how to generate the logfile here:
https://i3wm.org/docs/debugging.html
Providing the logfile is optional.
-->
<pre>
Logfile URL:
</pre>

<!--
Please also answer the questions below to help us process your issue faster. If you have any other information to share, please add it here as well.
-->
<pre>
- Linux Distribution & Version:
- Are you using a compositor (e.g., xcompmgr or compton):
</pre>
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,47 @@
---
name: Feature request
about: Suggest an idea for this project
---

<!--
PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.
-->

## I'm submitting a…
<!-- Please check one of the following options with "x" -->
<pre>
[ ] Bug
[x] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)
</pre>

## Current Behavior
<!--
Describe the current behavior,
e.g., »When pressing Alt+j (focus left), the window above the current window is focused.«
-->

## Desired Behavior
<!--
Describe the desired behavior you expect after mitigation of the issue,
e.g., »The window left next to the current window should be focused.«
-->

## Environment
<!--
Please include your exact i3 version.
Note that we only support the latest major release and the current development version. If you are using an older version of i3, please first update to the current release version and reproduce the issue there.
-->
Output of `i3 --moreversion 2>&-`:
<pre>
i3 version:
</pre>

<!--
Please also answer the questions below to help us process your issue faster. If you have any other information to share, please add it here as well.
-->
<pre>
- Linux Distribution & Version:
- Are you using a compositor (e.g., xcompmgr or compton):
</pre>
1 change: 1 addition & 0 deletions Makefile.am
Expand Up @@ -301,6 +301,7 @@ libi3_a_SOURCES = \
libi3/fake_configure_notify.c \
libi3/font.c \
libi3/format_placeholders.c \
libi3/g_utf8_make_valid.c \
libi3/get_colorpixel.c \
libi3/get_config_path.c \
libi3/get_exe_path.c \
Expand Down
27 changes: 21 additions & 6 deletions configure.ac
Expand Up @@ -110,12 +110,27 @@ AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_LN_S

AC_PATH_PROG([PATH_ASCIIDOC], [asciidoc])
AC_PATH_PROG([PATH_XMLTO], [xmlto])
AC_PATH_PROG([PATH_POD2MAN], [pod2man])

AM_CONDITIONAL([BUILD_MANS], [test x$PATH_ASCIIDOC != x && test x$PATH_XMLTO != x && test x$PATH_POD2MAN != x])
AM_CONDITIONAL([BUILD_DOCS], [test x$PATH_ASCIIDOC != x])
AC_ARG_ENABLE(docs,
AS_HELP_STRING(
[--disable-docs],
[disable building documentation]),
[ax_docs=$enableval],
[ax_docs=yes])
AC_ARG_ENABLE(mans,
AS_HELP_STRING(
[--disable-mans],
[disable building manual pages]),
[ax_mans=$enableval],
[ax_mans=yes])
AS_IF([test x$ax_docs = xyes || test x$ax_mans = xyes], [
AC_PATH_PROG([PATH_ASCIIDOC], [asciidoc])
])
AS_IF([test x$ax_mans = xyes], [
AC_PATH_PROG([PATH_XMLTO], [xmlto])
AC_PATH_PROG([PATH_POD2MAN], [pod2man])
])
AM_CONDITIONAL([BUILD_MANS], [test x$ax_mans = xyes && test x$PATH_ASCIIDOC != x && test x$PATH_XMLTO != x && test x$PATH_POD2MAN != x])
AM_CONDITIONAL([BUILD_DOCS], [test x$ax_docs = xyes && test x$PATH_ASCIIDOC != x])

AM_PROG_AR

Expand Down
2 changes: 1 addition & 1 deletion debian/control
Expand Up @@ -40,7 +40,7 @@ Description: metapackage (i3 window manager, screen locker, menu, statusbar)

Package: i3-wm
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, x11-utils
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}
Provides: x-window-manager
Recommends: xfonts-base, fonts-dejavu-core, libanyevent-i3-perl (>= 0.12), libjson-xs-perl, rxvt-unicode | x-terminal-emulator
Description: improved dynamic tiling window manager
Expand Down
28 changes: 19 additions & 9 deletions docs/userguide
Expand Up @@ -755,14 +755,23 @@ set_from_resource $black i3wm.color0 #000000

To automatically make a specific window show up on a specific workspace, you
can use an *assignment*. You can match windows by using any criteria,
see <<command_criteria>>. It is recommended that you match on window classes
(and instances, when appropriate) instead of window titles whenever possible
because some applications first create their window, and then worry about
setting the correct title. Firefox with Vimperator comes to mind. The window
starts up being named Firefox, and only when Vimperator is loaded does the
title change. As i3 will get the title as soon as the application maps the
window (mapping means actually displaying it on the screen), you’d need to have
to match on 'Firefox' in this case.
see <<command_criteria>>. The difference between +assign+ and
+for_window <criteria> move to workspace+ is that the former will only be
executed when the application maps the window (mapping means actually displaying
it on the screen) but the latter will be executed whenever a window changes its
properties to something that matches the specified criteria.

Thus, it is recommended that you match on window classes (and instances, when
appropriate) instead of window titles whenever possible because some
applications first create their window, and then worry about setting the correct
title. Firefox with Vimperator comes to mind. The window starts up being named
Firefox, and only when Vimperator is loaded does the title change. As i3 will
get the title as soon as the application maps the window, you’d need to have to
match on 'Firefox' in this case.
Another known issue is with Spotify, which doesn't set the class hints when
mapping the window, meaning you'll have to use a +for_window+ rule to assign
Spotify to a specific workspace.
Finally, using +assign [tiling]+ and +assign [floating]+ is not supported.

You can also assign a window to show up on a specific output. You can use RandR
names such as +VGA1+ or names relative to the output with the currently focused
Expand Down Expand Up @@ -995,7 +1004,7 @@ ipc-socket ~/.i3/i3-ipc.sock
----------------------------

You can then use the +i3-msg+ application to perform any command listed in
the next section.
<<list_of_commands>>.

=== Focus follows mouse

Expand Down Expand Up @@ -1733,6 +1742,7 @@ bar {
}
--------------------------------------

[[list_of_commands]]
== List of commands

Commands are what you bind to specific keypresses. You can also issue commands
Expand Down
2 changes: 1 addition & 1 deletion etc/config
Expand Up @@ -147,7 +147,7 @@ bindsym Mod1+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym Mod1+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym Mod1+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
bindsym Mod1+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"

# resize window (you can also use the mouse for that)
mode "resize" {
Expand Down
2 changes: 1 addition & 1 deletion etc/config.keycodes
Expand Up @@ -133,7 +133,7 @@ bindcode $mod+Shift+54 reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindcode $mod+Shift+27 restart
# exit i3 (logs you out of your X session)
bindcode $mod+Shift+26 exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
bindcode $mod+Shift+26 exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"

# resize window (you can also use the mouse for that)
mode "resize" {
Expand Down
49 changes: 38 additions & 11 deletions i3-msg/main.c
Expand Up @@ -166,16 +166,18 @@ int main(int argc, char *argv[]) {
uint32_t message_type = I3_IPC_MESSAGE_TYPE_RUN_COMMAND;
char *payload = NULL;
bool quiet = false;
bool monitor = false;

static struct option long_options[] = {
{"socket", required_argument, 0, 's'},
{"type", required_argument, 0, 't'},
{"version", no_argument, 0, 'v'},
{"quiet", no_argument, 0, 'q'},
{"monitor", no_argument, 0, 'm'},
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}};

char *options_string = "s:t:vhq";
char *options_string = "s:t:vhqm";

while ((o = getopt_long(argc, argv, options_string, long_options, &option_index)) != -1) {
if (o == 's') {
Expand Down Expand Up @@ -204,25 +206,34 @@ int main(int argc, char *argv[]) {
message_type = I3_IPC_MESSAGE_TYPE_GET_CONFIG;
} else if (strcasecmp(optarg, "send_tick") == 0) {
message_type = I3_IPC_MESSAGE_TYPE_SEND_TICK;
} else if (strcasecmp(optarg, "subscribe") == 0) {
message_type = I3_IPC_MESSAGE_TYPE_SUBSCRIBE;
} else {
printf("Unknown message type\n");
printf("Known types: run_command, get_workspaces, get_outputs, get_tree, get_marks, get_bar_config, get_binding_modes, get_version, get_config, send_tick\n");
printf("Known types: run_command, get_workspaces, get_outputs, get_tree, get_marks, get_bar_config, get_binding_modes, get_version, get_config, send_tick, subscribe\n");
exit(EXIT_FAILURE);
}
} else if (o == 'q') {
quiet = true;
} else if (o == 'm') {
monitor = true;
} else if (o == 'v') {
printf("i3-msg " I3_VERSION "\n");
return 0;
} else if (o == 'h') {
printf("i3-msg " I3_VERSION "\n");
printf("i3-msg [-s <socket>] [-t <type>] <message>\n");
printf("i3-msg [-s <socket>] [-t <type>] [-m] <message>\n");
return 0;
} else if (o == '?') {
exit(EXIT_FAILURE);
}
}

if (monitor && message_type != I3_IPC_MESSAGE_TYPE_SUBSCRIBE) {
fprintf(stderr, "The monitor option -m is used with -t SUBSCRIBE exclusively.\n");
exit(EXIT_FAILURE);
}

/* Use all arguments, separated by whitespace, as payload.
* This way, you don’t have to do i3-msg 'mark foo', you can use
* i3-msg mark foo */
Expand All @@ -246,9 +257,6 @@ int main(int argc, char *argv[]) {
err(EXIT_FAILURE, "IPC: write()");
free(payload);

if (quiet)
return 0;

uint32_t reply_length;
uint32_t reply_type;
uint8_t *reply;
Expand All @@ -275,8 +283,9 @@ int main(int argc, char *argv[]) {
errx(EXIT_FAILURE, "IPC: Could not parse JSON reply.");
}

/* NB: We still fall-through and print the reply, because even if one
* command failed, that doesn’t mean that all commands failed. */
if (!quiet) {
printf("%.*s\n", reply_length, reply);
}
} else if (reply_type == I3_IPC_REPLY_TYPE_CONFIG) {
yajl_handle handle = yajl_alloc(&config_callbacks, NULL, NULL);
yajl_status state = yajl_parse(handle, (const unsigned char *)reply, reply_length);
Expand All @@ -289,12 +298,30 @@ int main(int argc, char *argv[]) {
case yajl_status_error:
errx(EXIT_FAILURE, "IPC: Could not parse JSON reply.");
}
} else if (reply_type == I3_IPC_REPLY_TYPE_SUBSCRIBE) {
do {
free(reply);
if ((ret = ipc_recv_message(sockfd, &reply_type, &reply_length, &reply)) != 0) {
if (ret == -1)
err(EXIT_FAILURE, "IPC: read()");
exit(1);
}

goto exit;
if (!(reply_type & I3_IPC_EVENT_MASK)) {
errx(EXIT_FAILURE, "IPC: Received reply of type %d but expected an event", reply_type);
}

if (!quiet) {
fprintf(stdout, "%.*s\n", reply_length, reply);
fflush(stdout);
}
} while (monitor);
} else {
if (!quiet) {
printf("%.*s\n", reply_length, reply);
}
}
printf("%.*s\n", reply_length, reply);

exit:
free(reply);

close(sockfd);
Expand Down

0 comments on commit b45cbe7

Please sign in to comment.