Skip to content

Feature Request: Event System for Walker Rust Version #500

@f-o-o-g-s

Description

@f-o-o-g-s

Summary

Request to add an event system to the Rust version of Walker similar to the one that existed in the Go version, allowing users to execute custom commands on various Walker lifecycle events.

Background

The Go version of Walker had a comprehensive event system that allowed users to hook into various Walker lifecycle events with custom shell commands. This was particularly useful for adding sound effects, notifications, and other custom behaviors.

I loved this gimmick!

Current State

The current Rust version of Walker does not have an event system, which means users cannot easily add custom behaviors like sound effects or notifications when Walker events occur.

Previous Implementation (Go Version)

The Go version had the following event types:

type EventType int

const (
    EventLaunch EventType = iota
    EventSelection
    EventExit
    EventActivate
    EventQueryChange
)

Configuration Structure

[events]
on_launch = "command_to_run_on_startup"
on_exit = "command_to_run_on_exit"
on_activate = "command_to_run_on_item_activation"
on_selection = "command_to_run_on_selection_change"
on_query_change = "command_to_run_on_query_change"

Use Case: Sound Effects

Personal Implementation

I used the event system extensively for sound effects to enhance the user experience:

[events]
on_selection = "paplay ~/.config/walker/sounds/selection-$((RANDOM % 3 + 1)).mp3"
on_query_change = "paplay ~/.config/walker/sounds/selection-1.mp3"

This provided:

  • Random selection sounds: 3 different sound files played randomly when navigating through results
  • Typing feedback: Sound played when changing the search query

Sound Files Used

  • selection-1.mp3 - Primary selection sound
  • selection-2.mp3 - Alternative selection sound
  • selection-3.mp3 - Third selection sound
  • walker_open.mp3 - Walker launch sound
  • walker_close.mp3 - Walker exit sound

Advanced Implementation

After walker was rewrote in Rust I moved to using hyde-ipc for layer-based events:

# Walker open sound
[[reactions]]
event_type = { Layer = "Opened" }
layer_filter = "walker"
dispatchers = [
  { name = "exec", args = ["/home/foogs/.local/share/hyde-ipc/play_walker_sound.sh", "open"] }
]

# Walker close sound
[[reactions]]
event_type = { Layer = "Closed" }
layer_filter = "walker"
dispatchers = [
  { name = "exec", args = ["/home/foogs/.local/share/hyde-ipc/play_walker_sound.sh", "close"] }
]

Alternative Solutions

Currently, users must rely on external tools like hyde-ipc for layer-based events, but this doesn't provide the granular control that the built-in event system offered.

Conclusion

The event system was a valuable feature in the Go version that significantly enhanced the user experience. Re-implementing this feature in the Rust version would restore this functionality and allow users to customize Walker's behavior to their preferences.

This feature would be particularly valuable for users who want to add audio feedback, notifications, or other custom behaviors to enhance their workflow with Walker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions