sxyazi / yazi

💥 Blazing fast terminal file manager written in Rust, based on async I/O.
https://yazi-rs.github.io
MIT License
15.46k stars 348 forks source link

DDS static messages only work when at least two instances of Yazi are running #1460

Closed dedukun closed 2 months ago

dedukun commented 2 months ago

What system are you running Yazi on?

Linux Wayland

What terminal are you running Yazi in?

wezterm 20240203-110809-5046fc22

yazi --debug output

Yazi
    Version: 0.3.0 (dac72eb 2024-08-10)
    Debug  : false
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.3.0

Emulator
    Emulator.via_env: ("xterm-256color", "WezTerm")
    Emulator.via_csi: Ok(WezTerm)
    Emulator.detect : WezTerm

Adapter
    Adapter.matches: Iterm2

Desktop
    XDG_SESSION_TYPE: Some("wayland")
    WAYLAND_DISPLAY : Some("wayland-1")
    DISPLAY         : Some(":0")

SSH
    shared.in_ssh_connection: false

WSL
    /proc/sys/fs/binfmt_misc/WSLInterop: false

Variables
    SHELL              : Some("/usr/bin/zsh")
    EDITOR             : Some("nvim")
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None
    ZELLIJ_SESSION_NAME: None

Text Opener
    default: Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block  : Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })

tmux
    TMUX   : false
    Version: 3.4

Dependencies
    file             : 5.45
    ueberzugpp       : 2.9.6
    ffmpegthumbnailer: 2.2.2
    magick           : 7.1.1-36
    fzf              : 0.54.3
    fd               : 10.1.0
    rg               : 14.1.0
    chafa            : 1.14.1
    zoxide           : No such file or directory (os error 2)
    7z               : 17.05
    7zz              : No such file or directory (os error 2)
    jq               : 1.7.1

--------------------------------------------------
When reporting a bug, please also upload the `yazi.log` log file - only upload the most recent content by time.
You can find it in the "/home/dedukun/.local/state/yazi" directory.

Did you try the latest nightly build to see if the problem got fixed?

Yes, and I updated the debug information above (yazi --debug) to the nightly that I tried

Describe the bug

The DDS static messages only work when at least 2 instances of Yazi are running. I've done some tests and this issue seems to have been introduced when pub_static was replaced with pub_to in #1172.

It's being affecting users that are using bookmarks.yazi in Yazi v0.3, as reported in this issue .

Minimal reproducer

Add the following plugin test.yazi

local publish = ya.sync(function(_, msg)
    ya.err("Published Test Message: " .. tostring(msg))
    ps.pub_to(0, "@test", msg)
end)

local subscribe = ya.sync(function()
    ya.err("Subscribe")
    ps.sub_remote("@test", function(body) ya.err("Read Test Message: " .. tostring(body)) end)
end)

return {
    entry = function(_, args)
        if args[1] == "pub" then
            publish("Test")
        else
            publish(nil)
        end
    end,
    setup = function(_) subscribe() end,
}

Call the setup function in init.lua and add two entries in keymap.toml like, for example:

[[manager.prepend_keymap]]
on = [ "?", "P" ]
run = "plugin test --args=pub"
desc = "Publish test static message"

[[manager.prepend_keymap]]
on = [ "?", "C" ]
run = "plugin test"
desc = "Clear static messages"

Then:

If doing this steps are done with 2 instance of Yazi running it works

Anything else?

No response

sxyazi commented 2 months ago

Thanks for reporting, should be fixed in https://github.com/sxyazi/yazi/pull/1467

dedukun commented 2 months ago

It's working as expected now, thanks for the quick fix.

github-actions[bot] commented 1 month ago

I'm going to lock this issue because it has been closed for 30 days. ⏳ This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.