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

Fix index handling in a taglist example #2810

Merged

Conversation

psychon
Copy link
Member

@psychon psychon commented Jul 2, 2019

Quote (with some minor changes) from 1:

I'd like to use the code presented at the top of the documentation
page for the taglist widget 2. However, I prefer my taglist to be
filtered and display only noempty tags BUT to keep the numbering so
that pressing Mod+3 always shows the same tag.

If I only update the

  filter  = awful.widget.taglist.filter.all,

so that it reads

  filter  = awful.widget.taglist.filter.noempty,

then my tags are displayed with a wrong number, since the index
parameter in the callback function (a few lines below) is based on the
list of selected_tags and not the global list of tags.

The answers by Veratil are:

Prefix index with c3. so that it becomes c3.index in the
update_callback.

Thanks for pointing this out, I can make a PR to fix it.

and

Maybe update the one in create_callback as well.

I just reproduced the problem and tested that the proposed change makes
things work as expected. Since the comments were written two months ago
and nothing happened yet, I am just turning this into a PR. The idea is
that the PR is only accepted if someone who understands this code
decides that this change is correct. Let's see if that works out...

Signed-off-by: Uli Schlachter [email protected]

CC @Veratil

Quote (with some minor changes) from [1]:

  I'd like to use the code presented at the top of the documentation
  page for the taglist widget [2]. However, I prefer my taglist to be
  filtered and display only noempty tags BUT to keep the numbering so
  that pressing Mod+3 always shows the same tag.

  If I only update the

      filter  = awful.widget.taglist.filter.all,

  so that it reads

      filter  = awful.widget.taglist.filter.noempty,

  then my tags are displayed with a wrong number, since the index
  parameter in the callback function (a few lines below) is based on the
  list of selected_tags and not the global list of tags.

The answers by Veratil are:

  Prefix index with c3. so that it becomes c3.index in the
  update_callback.

  Thanks for pointing this out, I can make a PR to fix it.

and

  Maybe update the one in create_callback as well.

I just reproduced the problem and tested that the proposed change makes
things work as expected. Since the comments were written two months ago
and nothing happened yet, I am just turning this into a PR. The idea is
that the PR is only accepted if someone who understands this code
decides that this change is correct. Let's see if that works out...

[1]: https://www.reddit.com/r/awesomewm/comments/bhmgd1/tag_list_with_indexes_and_filternoempty/
[2]: https://awesomewm.org/doc/api/classes/awful.widget.taglist.html

Signed-off-by: Uli Schlachter <[email protected]>
@codecov
Copy link

codecov bot commented Jul 2, 2019

Codecov Report

Merging #2810 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2810      +/-   ##
==========================================
+ Coverage   86.48%   86.48%   +<.01%     
==========================================
  Files         569      569              
  Lines       38099    38099              
==========================================
+ Hits        32949    32950       +1     
+ Misses       5150     5149       -1
Flag Coverage Δ
#gcov 74.98% <ø> (+0.01%) ⬆️
#luacov 89.37% <100%> (ø) ⬆️
Impacted Files Coverage Δ
tests/examples/wibox/awidget/taglist/indexed.lua 93.75% <100%> (ø) ⬆️
property.c 80.75% <0%> (+0.46%) ⬆️

@Veratil
Copy link
Contributor

Veratil commented Jul 2, 2019

Thanks, I forgot to open the PR!

@Elv13 Elv13 merged commit fe37eeb into awesomeWM:master Jul 3, 2019
@Elv13
Copy link
Member

Elv13 commented Jul 3, 2019

thanks

@psychon psychon deleted the tag_list_witg_filternoempty_and_index branch July 4, 2019 15:22
actionless pushed a commit to actionless/awesome that referenced this pull request Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants