Skip to content

Instantly share code, notes, and snippets.

@Airblader
Last active September 6, 2021 00:20
Show Gist options
  • Select an option

  • Save Airblader/72d6a03d05c111d33ad4 to your computer and use it in GitHub Desktop.

Select an option

Save Airblader/72d6a03d05c111d33ad4 to your computer and use it in GitHub Desktop.

Revisions

  1. Airblader revised this gist Feb 2, 2016. 1 changed file with 7 additions and 2 deletions.
    9 changes: 7 additions & 2 deletions i3bar-ws-spacing.patch
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c
    index 6878e29..cc4039d 100644
    index 6878e29..ced03c6 100644
    --- a/i3bar/src/xcb.c
    +++ b/i3bar/src/xcb.c
    @@ -129,7 +129,7 @@ static const int ws_hoff_px = 4;
    @@ -129,11 +129,11 @@ static const int ws_hoff_px = 4;
    static const int ws_voff_px = 3;

    /* Offset between two workspace buttons */
    @@ -11,6 +11,11 @@ index 6878e29..cc4039d 100644

    /* Offset between the statusline and 1) workspace buttons on the left
    * 2) the tray or screen edge on the right */
    -static const int sb_hoff_px = 4;
    +static const int sb_hoff_px = 0;

    /* Additional offset between the tray and the statusline, if the tray is not empty */
    static const int tray_loff_px = 2;
    @@ -304,17 +304,17 @@ void draw_statusline(i3_output *output, uint32_t clip_left, bool use_focus_color

    /* Draw the border. */
  2. Airblader revised this gist Feb 2, 2016. No changes.
  3. Airblader revised this gist Feb 2, 2016. 1 changed file with 43 additions and 1 deletion.
    44 changes: 43 additions & 1 deletion i3bar-ws-spacing.patch
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c
    index 6878e29..7663b36 100644
    index 6878e29..cc4039d 100644
    --- a/i3bar/src/xcb.c
    +++ b/i3bar/src/xcb.c
    @@ -129,7 +129,7 @@ static const int ws_hoff_px = 4;
    @@ -11,6 +11,28 @@ index 6878e29..7663b36 100644

    /* Offset between the statusline and 1) workspace buttons on the left
    * 2) the tray or screen edge on the right */
    @@ -304,17 +304,17 @@ void draw_statusline(i3_output *output, uint32_t clip_left, bool use_focus_color

    /* Draw the border. */
    draw_util_rectangle(xcb_connection, &output->statusline_buffer, border_color,
    - x, logical_px(1),
    + x, 0,
    full_render_width,
    - bar_height - logical_px(2));
    + bar_height);

    /* Draw the background. */
    bool is_border = !!block->border;
    draw_util_rectangle(xcb_connection, &output->statusline_buffer, bg_color,
    x + is_border * logical_px(block->border_left),
    - logical_px(1) + is_border * logical_px(block->border_top),
    + is_border * logical_px(block->border_top),
    full_render_width - is_border * logical_px(block->border_right + block->border_left),
    - bar_height - is_border * logical_px(block->border_bottom + block->border_top) - logical_px(2));
    + bar_height - is_border * logical_px(block->border_bottom + block->border_top));
    }

    draw_util_text(block->full_text, &output->statusline_buffer, fg_color, colors.bar_bg,
    @@ -1979,16 +1979,16 @@ void draw_bars(bool unhide) {
    /* Draw the border of the button. */
    draw_util_rectangle(xcb_connection, &(outputs_walk->buffer), border_color,
    @@ -32,3 +54,23 @@ index 6878e29..7663b36 100644

    draw_util_text(ws_walk->name, &(outputs_walk->buffer), fg_color, bg_color,
    workspace_width + logical_px(ws_hoff_px) + logical_px(1),
    @@ -2009,15 +2009,15 @@ void draw_bars(bool unhide) {

    draw_util_rectangle(xcb_connection, &(outputs_walk->buffer), colors.binding_mode_border,
    workspace_width,
    - logical_px(1),
    + 0,
    binding.width + 2 * logical_px(ws_hoff_px) + 2 * logical_px(1),
    - bar_height - 2 * logical_px(1));
    + bar_height);

    draw_util_rectangle(xcb_connection, &(outputs_walk->buffer), bg_color,
    workspace_width + logical_px(1),
    - 2 * logical_px(1),
    + logical_px(1),
    binding.width + 2 * logical_px(ws_hoff_px),
    - bar_height - 4 * logical_px(1));
    + bar_height - 2 * logical_px(1));

    draw_util_text(binding.name, &(outputs_walk->buffer), fg_color, bg_color,
    workspace_width + logical_px(ws_hoff_px) + logical_px(1),
  4. Airblader created this gist Feb 2, 2016.
    34 changes: 34 additions & 0 deletions i3bar-ws-spacing.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c
    index 6878e29..7663b36 100644
    --- a/i3bar/src/xcb.c
    +++ b/i3bar/src/xcb.c
    @@ -129,7 +129,7 @@ static const int ws_hoff_px = 4;
    static const int ws_voff_px = 3;

    /* Offset between two workspace buttons */
    -static const int ws_spacing_px = 1;
    +static const int ws_spacing_px = 0;

    /* Offset between the statusline and 1) workspace buttons on the left
    * 2) the tray or screen edge on the right */
    @@ -1979,16 +1979,16 @@ void draw_bars(bool unhide) {
    /* Draw the border of the button. */
    draw_util_rectangle(xcb_connection, &(outputs_walk->buffer), border_color,
    workspace_width,
    - logical_px(1),
    + 0,
    ws_walk->name_width + 2 * logical_px(ws_hoff_px) + 2 * logical_px(1),
    - bar_height - 2 * logical_px(1));
    + bar_height);

    /* Draw the inside of the button. */
    draw_util_rectangle(xcb_connection, &(outputs_walk->buffer), bg_color,
    workspace_width + logical_px(1),
    - 2 * logical_px(1),
    + logical_px(1),
    ws_walk->name_width + 2 * logical_px(ws_hoff_px),
    - bar_height - 4 * logical_px(1));
    + bar_height - 2 * logical_px(1));

    draw_util_text(ws_walk->name, &(outputs_walk->buffer), fg_color, bg_color,
    workspace_width + logical_px(ws_hoff_px) + logical_px(1),