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 May 7, 2020
2 parents 49787b5 + f63a4be commit 66d2eba
Show file tree
Hide file tree
Showing 14 changed files with 239 additions and 265 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Expand Up @@ -38,4 +38,4 @@ Note that bug reports and feature requests for related projects should be filed
* 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](https://i3wm.org/docs/hacking-howto.html) available to get you started.
There's an [overview of the codebase](https://i3wm.org/docs/hacking-howto.html) available to get you started.
3 changes: 3 additions & 0 deletions RELEASE-NOTES-next
Expand Up @@ -17,6 +17,8 @@ strongly encouraged to upgrade.
• make dock client order deterministic (sorted by class/instance) as a
side effect, i3bars without an explicit bar-id will be sorted according
to their definition order in the config file
• update i3bar config when necessary (reduces redraws on bar mode changes)
• mention rofi in default config file

┌────────────────────────────┐
│ Bugfixes │
Expand All @@ -33,3 +35,4 @@ strongly encouraged to upgrade.
• i3-dmenu-desktop: Support symlinks in search path
• build: correctly provide auxiliary functions when needed
• build: fix issues with parallel build
• set _NET_DESKTOP_VIEWPORT after randr changes
19 changes: 19 additions & 0 deletions docs/bigpicture.asy
@@ -0,0 +1,19 @@
import drawtree;
treeLevelStep = 2cm;
TreeNode n94457831379296 = makeNode("``root'' (splith) []");
TreeNode n94457831380944 = makeNode(n94457831379296, "``\_\_i3'' (output) []");
TreeNode n94457831384048 = makeNode(n94457831380944, "``content'' (splith) []");
TreeNode n94457831387184 = makeNode(n94457831384048, "``\_\_i3\_scratch'' (splith) []");
TreeNode n94457831390576 = makeNode(n94457831379296, "``eDP-1'' (output) []");
TreeNode n94457831393744 = makeNode(n94457831390576, "``topdock'' (dockarea) []");
TreeNode n94457831396992 = makeNode(n94457831390576, "``content'' (splith) []");
TreeNode n94457831628304 = makeNode(n94457831396992, "``1'' (splith) []");
TreeNode n94457831571040 = makeNode(n94457831628304, "``Hacking i3: How To - Mozilla Firefox'' (leaf) []");
TreeNode n94457831246384 = makeNode(n94457831628304, "``vim'' (leaf) []");
TreeNode n94457831461088 = makeNode(n94457831396992, "``Named workspace'' (splith) []");
TreeNode n94457831471424 = makeNode(n94457831461088, "``[Empty]'' (tabbed) []");
TreeNode n94457831570576 = makeNode(n94457831471424, "``contrib/dump-asy.pl --no-gv'' (leaf) [Marks go here]");
TreeNode n94457831645488 = makeNode(n94457831471424, "``ipython'' (leaf) []");
TreeNode n94457831400192 = makeNode(n94457831390576, "``bottomdock'' (dockarea) []");
TreeNode n94457831424848 = makeNode(n94457831400192, "``i3bar for output eDP-1'' (leaf) []");
draw(n94457831379296, (0, 0));
Binary file modified docs/bigpicture.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/bigpicture.xcf
Binary file not shown.
331 changes: 155 additions & 176 deletions docs/hacking-howto

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions etc/config
Expand Up @@ -53,9 +53,10 @@ bindsym Mod1+Shift+q kill

# start dmenu (a program launcher)
bindsym Mod1+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# A more modern dmenu replacement is rofi:
# bindsym Mod1+d exec rofi -modi drun,run -show drun
# There also is i3-dmenu-desktop which only displays applications shipping a
# .desktop file. It is a wrapper around dmenu, so you need that installed.
# bindsym Mod1+d exec --no-startup-id i3-dmenu-desktop

# change focus
Expand Down
9 changes: 5 additions & 4 deletions etc/config.keycodes
Expand Up @@ -47,10 +47,11 @@ bindcode $mod+Shift+24 kill

# start dmenu (a program launcher)
bindcode $mod+40 exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# A more modern dmenu replacement is rofi:
# bindcode $mod+40 exec rofi -modi drun,run -show drun
# There also is i3-dmenu-desktop which only displays applications shipping a
# .desktop file. It is a wrapper around dmenu, so you need that installed.
bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop

# change focus
bindcode $mod+44 focus left
Expand Down
10 changes: 8 additions & 2 deletions include/commands.h
Expand Up @@ -315,10 +315,16 @@ void cmd_title_format(I3_CMD, const char *format);
void cmd_rename_workspace(I3_CMD, const char *old_name, const char *new_name);

/**
* Implementation of 'bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]'
* Implementation of 'bar mode dock|hide|invisible|toggle [<bar_id>]'
*
*/
void cmd_bar(I3_CMD, const char *bar_type, const char *bar_value, const char *bar_id);
void cmd_bar_mode(I3_CMD, const char *bar_mode, const char *bar_id);

/**
* Implementation of 'bar hidden_state hide|show|toggle [<bar_id>]'
*
*/
void cmd_bar_hidden_state(I3_CMD, const char *bar_hidden_state, const char *bar_id);

/**
* Implementation of 'shmlog <size>|toggle|on|off'
Expand Down
6 changes: 0 additions & 6 deletions include/configuration.h
Expand Up @@ -437,9 +437,3 @@ bool load_configuration(const char *override_configfile, config_load_t load_type
*
*/
void ungrab_all_keys(xcb_connection_t *conn);

/**
* Sends the current bar configuration as an event to all barconfig_update listeners.
*
*/
void update_barconfig(void);
14 changes: 8 additions & 6 deletions parser-specs/commands.spec
Expand Up @@ -478,15 +478,17 @@ state BAR:
-> BAR_MODE

state BAR_HIDDEN_STATE:
bar_value = 'hide', 'show', 'toggle'
-> BAR_W_ID
bar_hidden_state = 'hide', 'show', 'toggle'
->
bar_id = word
->
end
-> call cmd_bar_hidden_state($bar_hidden_state, $bar_id)

state BAR_MODE:
bar_value = 'dock', 'hide', 'invisible', 'toggle'
-> BAR_W_ID

state BAR_W_ID:
->
bar_id = word
->
end
-> call cmd_bar($bar_type, $bar_value, $bar_id)
-> call cmd_bar_mode($bar_value, $bar_id)
91 changes: 35 additions & 56 deletions src/commands.c
Expand Up @@ -1621,8 +1621,11 @@ void cmd_reload(I3_CMD) {
x_set_i3_atoms();
/* Send an IPC event just in case the ws names have changed */
ipc_send_workspace_event("reload", NULL, NULL);
/* Send an update event for the barconfig just in case it has changed */
update_barconfig();
/* Send an update event for each barconfig just in case it has changed */
Barconfig *current;
TAILQ_FOREACH (current, &barconfigs, configs) {
ipc_send_barconfig_update_event(current);
}

// XXX: default reply for now, make this a better reply
ysuccess(true);
Expand Down Expand Up @@ -2075,7 +2078,7 @@ void cmd_rename_workspace(I3_CMD, const char *old_name, const char *new_name) {
* Implementation of 'bar mode dock|hide|invisible|toggle [<bar_id>]'
*
*/
static bool cmd_bar_mode(const char *bar_mode, const char *bar_id) {
void cmd_bar_mode(I3_CMD, const char *bar_mode, const char *bar_id) {
int mode = M_DOCK;
bool toggle = false;
if (strcmp(bar_mode, "dock") == 0)
Expand All @@ -2088,39 +2091,38 @@ static bool cmd_bar_mode(const char *bar_mode, const char *bar_id) {
toggle = true;
else {
ELOG("Unknown bar mode \"%s\", this is a mismatch between code and parser spec.\n", bar_mode);
return false;
assert(false);
}

bool changed_sth = false;
Barconfig *current = NULL;
TAILQ_FOREACH (current, &barconfigs, configs) {
if (bar_id && strcmp(current->id, bar_id) != 0)
if (strcmp(current->id, bar_id) != 0) {
continue;
}

if (toggle)
if (toggle) {
mode = (current->mode + 1) % 2;
}

DLOG("Changing bar mode of bar_id '%s' to '%s (%d)'\n", current->id, bar_mode, mode);
current->mode = mode;
changed_sth = true;

if (bar_id)
break;
}
DLOG("Changing bar mode of bar_id '%s' from '%d' to '%s (%d)'\n",
current->id, current->mode, bar_mode, mode);
if ((int)current->mode != mode) {
current->mode = mode;
ipc_send_barconfig_update_event(current);
}

if (bar_id && !changed_sth) {
DLOG("Changing bar mode of bar_id %s failed, bar_id not found.\n", bar_id);
return false;
ysuccess(true);
return;
}

return true;
yerror("Changing bar mode of bar_id %s failed, bar_id not found.\n", bar_id);
}

/*
* Implementation of 'bar hidden_state hide|show|toggle [<bar_id>]'
*
*/
static bool cmd_bar_hidden_state(const char *bar_hidden_state, const char *bar_id) {
void cmd_bar_hidden_state(I3_CMD, const char *bar_hidden_state, const char *bar_id) {
int hidden_state = S_SHOW;
bool toggle = false;
if (strcmp(bar_hidden_state, "hide") == 0)
Expand All @@ -2131,54 +2133,31 @@ static bool cmd_bar_hidden_state(const char *bar_hidden_state, const char *bar_i
toggle = true;
else {
ELOG("Unknown bar state \"%s\", this is a mismatch between code and parser spec.\n", bar_hidden_state);
return false;
assert(false);
}

bool changed_sth = false;
Barconfig *current = NULL;
TAILQ_FOREACH (current, &barconfigs, configs) {
if (bar_id && strcmp(current->id, bar_id) != 0)
if (strcmp(current->id, bar_id) != 0) {
continue;
}

if (toggle)
if (toggle) {
hidden_state = (current->hidden_state + 1) % 2;
}

DLOG("Changing bar hidden_state of bar_id '%s' to '%s (%d)'\n", current->id, bar_hidden_state, hidden_state);
current->hidden_state = hidden_state;
changed_sth = true;

if (bar_id)
break;
}

if (bar_id && !changed_sth) {
DLOG("Changing bar hidden_state of bar_id %s failed, bar_id not found.\n", bar_id);
return false;
}

return true;
}

/*
* Implementation of 'bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]'
*
*/
void cmd_bar(I3_CMD, const char *bar_type, const char *bar_value, const char *bar_id) {
bool ret;
if (strcmp(bar_type, "mode") == 0)
ret = cmd_bar_mode(bar_value, bar_id);
else if (strcmp(bar_type, "hidden_state") == 0)
ret = cmd_bar_hidden_state(bar_value, bar_id);
else {
ELOG("Unknown bar option type \"%s\", this is a mismatch between code and parser spec.\n", bar_type);
ret = false;
}
DLOG("Changing bar hidden_state of bar_id '%s' from '%d' to '%s (%d)'\n",
current->id, current->hidden_state, bar_hidden_state, hidden_state);
if ((int)current->hidden_state != hidden_state) {
current->hidden_state = hidden_state;
ipc_send_barconfig_update_event(current);
}

ysuccess(ret);
if (!ret)
ysuccess(true);
return;
}

update_barconfig();
yerror("Changing bar hidden_state of bar_id %s failed, bar_id not found.\n", bar_id);
}

/*
Expand Down
11 changes: 0 additions & 11 deletions src/config.c
Expand Up @@ -28,17 +28,6 @@ void ungrab_all_keys(xcb_connection_t *conn) {
xcb_ungrab_key(conn, XCB_GRAB_ANY, root, XCB_BUTTON_MASK_ANY);
}

/*
* Sends the current bar configuration as an event to all barconfig_update listeners.
*
*/
void update_barconfig(void) {
Barconfig *current;
TAILQ_FOREACH (current, &barconfigs, configs) {
ipc_send_barconfig_update_event(current);
}
}

static void free_configuration(void) {
assert(conn != NULL);

Expand Down
1 change: 1 addition & 0 deletions src/randr.c
Expand Up @@ -1023,6 +1023,7 @@ void randr_query_outputs(void) {
}

/* render_layout flushes */
ewmh_update_desktop_properties();
tree_render();

FREE(primary);
Expand Down

0 comments on commit 66d2eba

Please sign in to comment.