Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: format-padding only applies to left side of workspaces block in i3 module #2814

Open
5 tasks done
gctypo opened this issue Sep 5, 2022 · 3 comments · May be fixed by #2898
Open
5 tasks done

[Bug]: format-padding only applies to left side of workspaces block in i3 module #2814

gctypo opened this issue Sep 5, 2022 · 3 comments · May be fixed by #2898

Comments

@gctypo
Copy link

gctypo commented Sep 5, 2022

Checklist

  • I have read the appropriate section in the contributing guidelines
  • I believe this issue is a problem with polybar itself and not a misconfiguration on my part
  • I have searched for other open and closed issues that may have already reported this problem
  • I have checked the known issues page for this problem.
  • I have followed the debugging guide to narrow down the problem to a minimal config.

Steps to reproduce

  1. Setup i3 module that makes use of format-padding
  2. Launch bar
  3. Open low-numbered workspace and higher-numbered workspace
  4. Observe leftmost workspace has format-padding space to the left of it
  5. Observe rightmost workspace does not

Minimal config

[bar/main]
monitor = HDMI-1
monitor-strict = false

module-padding = 12px

border-color = #444

overline-size = 4
underline-size = 4

font-0 = "Liberation Sans:size=11;4"

modules-left = i3

height = 28

border-top-size = 4px
border-bottom-size = 4px

padding = 20px


[module/i3]
type = internal/i3

pin-workspaces = true
index-sort = true
show-urgent = true

fuzzy-match = true

format = "<label-state> <label-mode> "
format-background = #046
format-padding = 13px

ws-label = %index%
label-focused = ${self.ws-label}
label-unfocused = ${self.ws-label}
label-visible = ${self.ws-label}
label-urgent = ${self.ws-label}

background = #bbb
foreground = #444

; fg/bg settings exist to make the issue most visible
ws-padding = 8px
label-focused-padding = ${self.ws-padding}
label-focused-background = #860
label-focused-foreground = #eee
label-focused-overline = #608
label-focused-underline = #608

label-unfocused-padding = ${self.ws-padding}
label-unfocused-background = ${self.background}
label-unfocused-foreground = ${self.foreground}

label-mode-padding = 8px
label-mode-background = #040
label-mode-foreground = #eee

Polybar log

polybar|notice:  Parsing config file: /home/gctypo/.config/polybar/test.ini
polybar|notice:  Loading module 'i3' of type 'internal/i3'
polybar|notice:  Loading module 'title' of type 'internal/xwindow'
polybar|notice:  Loaded 2 modules
polybar|notice:  Loaded font "Liberation Sans:size=11" (name=Liberation Sans, offset=4, file=/usr/share/fonts/liberation/LiberationSans-Regular.ttf)

Expected behavior

Expected format-padding in i3 module to show an equal amount of padding (13px in demo ini) both to the left of leftmost workspace (shows) and right of rightmost workspace (doesn't show).

Actual behavior

Observed format-padding amount of space only applied to left side of leftmost workspace, and is absent after rightmost workspace.

Window Manager and Version

i3-gaps 4.20.1-2

Linux Distribution

Arch Linux

Polybar version

polybar 3.6.3

Features: +alsa +curl +i3 +mpd +network(libnl) +pulseaudio +xkeyboard

X extensions: +randr (+monitors) +composite +xkb +xrm +xcursor

Build type: Release
Compiler: /usr/bin/c++
Compiler flags: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/polybar/src=/usr/src/debug -flto=auto -O3 -DNDEBUG -Wall -Wextra -Wpedantic -Wsuggest-override
Linker flags: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto -Wall -Wextra -Wpedantic -Wsuggest-override  -Wall -Wextra -Wpedantic -Wsuggest-override

Additional Context / Screenshots

Space from format-padding in i3 module is highlighted in teal, which comes from format-background. The space granted from this is only visible on the right side of the workspaces block of the module.

2022-09-05_01-40
2022-09-05_01-40_1

Other colors:

  • Purple over/underline (label-focused-overline = #608)
  • Dark gray bar border (border-color = #444)
  • Gold focused workspace (label-focused-background = #860)
  • Green mode block (label-mode-foreground = #040 - padding inside this block works as expected)
  • Black bar background
@patrick96
Copy link
Member

The padding is not applied after the workspace list, it is applied after the entire format (which is after <label-mode>).

There is a bug here though, the padding doesn't have the right color. In this case it happens because <label-mode> has a background color, which means that the background color is reset to the bar background (using %{B-}) after <label-mode> is done, and that causes everything after it to use the bar background instead of the format background.

We can solve this by reapplying all the format colors before rendering the padding. But this is part of a larger issue that we have no good way to go back to the previous background color and always reset to the bar background (see #1623)

@vaibhavshukla06
Copy link

A potential solution to this issue would be to add a flag to the i3 module that would allow users to specify the amount of padding to be applied to the right side of the rightmost workspace. This would allow users to achieve the desired behaviour of having an equal amount of padding on both sides of the workspace block.
Is my approach correct?

@vaibhavshukla06
Copy link

If it is then i would like to PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants