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

Adds auto_read_buffer which marks a buffer as read upon switching #551

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kindrowboat
Copy link

@kindrowboat kindrowboat commented Mar 5, 2024

Script info

  • Script name: auto_read_buffer.py
  • Version: 1.0.0
  • Requirements: 
  • Min WeeChat version: 
  • Script tags: buffer, read

Description

Automatically marks a buffer as read upon switching away from it to another buffer.

Checklist (new script)

  • Single commit, single file added
  • Commit message: New script name.py: short description…
  • No similar script already exists
  • Name: max 32 chars, only lower case letters, digits and underscores
  • Unique name, does not already exist in repository
  • No shebang on the first line
  • Comment in script with name/pseudo, e-mail and license
  • Only English in code/comments
  • Pure WeeChat API used, no extra API
  • Function hook_process is used for any blocking call
  • For Python script: works with Python 3 (Python 2 support is optional)
  • Score 100 / 100 displayed by weechat-script-lint

Checklist (script update)

  • Author has been contacted
  • Single commit, single file added
  • Commit message format: script_name.py X.Y: …
  • Script version and Changelog have been updated
  • For Python script: works with Python 3 (Python 2 support is optional)
  • Score 100 / 100 displayed by weechat-script-lint

Checklist (script deletion)

  • Author has been contacted
  • Single commit, single file deleted
  • Commit message format: Remove script name.py with reasons in description

@kindrowboat kindrowboat marked this pull request as ready for review March 5, 2024 18:50
@flashcode flashcode self-assigned this May 13, 2024
@flashcode flashcode added the new script New script label May 13, 2024
@flashcode
Copy link
Member

Hi,
Sorry for the delay, does this script fix a bug in WeeChat?
What's the use case where the buffer is not marked as read?

@flashcode flashcode added the waiting info Waiting for info from author of issue label Aug 26, 2024
@kindrowboat
Copy link
Author

Hey, no problem! I think this is an issue when you're using a weechat relay. Before this script, when I moved off of a buffer, it was still marked yellow/unread. I'd have to switch off and back onto to the buffer to get it to to be marked as read. This is true for only the relay host, I think. I swear I saw a known issue/wontfix for this, but I can't seem to find it now.

@flashcode
Copy link
Member

OK, for relay (weechat protocol), this is caused by the option weechat.look.hotlist_add_conditions whose default value is ${away} || ${buffer.num_displayed} == 0 || ${info:relay_client_count,weechat,connected} > 0.
So the last condition means if there's at least one client of the weechat relay, always add the buffer to the hotlist, even if it's the current one.
It's done like this because the relay client may not see the same buffer as active, and thus you don't miss any notification in the client.
If needed, you can remove this condition, but then that means the weechat current buffer will not be added to hotlist and not visible in the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new script New script waiting info Waiting for info from author of issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants