Skip to content

For event_closewindow, how do I get the target window's WINDOWADDRESS? #109

@kohane27

Description

@kohane27

Program

shellevents

Maintainers of the program

trippwill

Bug or Regression?

Bug

Description

Hello! Hope you're doing well.

It's not exactly a bug. I'm trying to use event_closewindow but run into issues: how do I get the target window's WINDOWADDRESS?

event_openwindow provides WINDOWCLASS so it's easy to do so:

event_openwindow() {
    # WINDOWADDRESS WORKSPACENAME WINDOWCLASS WINDOWTITLE
    case "$WINDOWCLASS" in "firefox")
        bash "$HOME"/.config/zsh/scripts/enable-audio.sh
        ;;
    esac
}

But I can't do the same for event_closewindow because it only provides WINDOWADDRESS:

event_closewindow() {
    # WINDOWADDRESS
}

I tried the following:

event_closewindow() {
    # WINDOWADDRESS
    target_address=$(hyprctl --batch clients -j | jq -r '.[] | select(.class == "firefox") | .address')
    if [[ "$WINDOWADDRESS" == "$target_address" ]]; then
        bash "$HOME"/.config/zsh/scripts/disable-audio.sh
    fi
}

But the window is already closed so target_address is always null.

Any input is much appreciated. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions