[PR #1403] [MERGED] feat(bar): send commands by mouse/touchpad/screen #1385

Closed
opened 2026-01-05 14:55:06 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/LGUG2Z/komorebi/pull/1403
Author: @CtByte
Created: 4/4/2025
Status: Merged
Merged: 5/11/2025
Merged by: @LGUG2Z

Base: masterHead: bar_mouse_scrolling


📝 Commits (1)

  • aaf90a2 feat(bar): send commands by mouse/touchpad/screen

📊 Changes

8 files changed (+55045 additions, -10 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 Cargo.toml (+1 -0)
📝 komorebi-bar/Cargo.toml (+1 -0)
📝 komorebi-bar/src/bar.rs (+251 -7)
📝 komorebi-bar/src/config.rs (+146 -0)
📝 komorebi/Cargo.toml (+1 -1)
📝 komorebi/src/core/pathext.rs (+2 -2)
📝 schema.bar.json (+54642 -0)

📄 Description

This commit makes it possible to send commands from the bar by using the
mouse/touchpad/touchscreen.

Komorebi or custom commands can be sent by clicking on the
mouse's primary, secondary, middle, back or forward buttons.

As the primary single click is already used by widgets, only primary double clicks can
send commands. This limitation is due to Egui also triggering 2 single clicks
before a double click is triggered. Egui does not have an
implementation for stopping event propagation out of the box and would
be too much work to include.

Similarly, commands can be sent on every "tick" of mouse scrolling, touchpad or
touchscreen swiping in any of the 4 directions. This "tick" can be
adjusted to fit user's preference.

This is due to the fact, that Egui does not have an event for when a mouse "tick" occurs. It instead
gives a number of points that the user scrolled/swiped on each frame.

  "mouse": {
    // The variable will be resolved
    //"on_primary_double_click": "komorebic replace-configuration $Env:USERPROFILE/komorebi.json",
    
    // This is the same as below but executed in a persistent powershell instance
    // "on_primary_double_click": "komorebic toggle-pause",
    "on_primary_double_click": {
      "focus_monitor_at_cursor": false,
      "ignore_mouse_follows_focus": false,
      "message": {
        "type": "TogglePause"
      }
    },
    "on_secondary_click": {
      "message": {
        "type": "NewWorkspace"
      }
    },
    "on_middle_click": {
      "message": {
        "type": "CloseWorkspace"
      }
    },
    "on_extra2_click": {
      "message": {
        "type": "CycleStack",
        "content": "Next"
      }
    },
    "on_extra1_click": {
      "message": {
        "type": "CycleStack",
        "content": "Previous"
      }
    },
    "vertical_scroll_threshold": 100,
    "on_scroll_up": {
      "message": {
        "type": "CycleFocusWorkspace",
        "content": "Next"
      }
    },
    "on_scroll_down": {
      "message": {
        "type": "CycleFocusWorkspace",
        "content": "Previous"
      }
    },
    "horizontal_scroll_threshold": 100,
    "on_scroll_left": {
      "message": {
        "type": "CycleStackIndex",
        "content": "Previous"
      }
    },
    "on_scroll_right": {
      "message": {
        "type": "CycleStackIndex",
        "content": "Next"
      }
    }
  },

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/LGUG2Z/komorebi/pull/1403 **Author:** [@CtByte](https://github.com/CtByte) **Created:** 4/4/2025 **Status:** ✅ Merged **Merged:** 5/11/2025 **Merged by:** [@LGUG2Z](https://github.com/LGUG2Z) **Base:** `master` ← **Head:** `bar_mouse_scrolling` --- ### 📝 Commits (1) - [`aaf90a2`](https://github.com/LGUG2Z/komorebi/commit/aaf90a2f129a2a11af90c19f3a0c9054d9fda698) feat(bar): send commands by mouse/touchpad/screen ### 📊 Changes **8 files changed** (+55045 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `Cargo.toml` (+1 -0) 📝 `komorebi-bar/Cargo.toml` (+1 -0) 📝 `komorebi-bar/src/bar.rs` (+251 -7) 📝 `komorebi-bar/src/config.rs` (+146 -0) 📝 `komorebi/Cargo.toml` (+1 -1) 📝 `komorebi/src/core/pathext.rs` (+2 -2) 📝 `schema.bar.json` (+54642 -0) </details> ### 📄 Description This commit makes it possible to send commands from the bar by using the mouse/touchpad/touchscreen. Komorebi or custom commands can be sent by clicking on the mouse's primary, secondary, middle, back or forward buttons. As the primary single click is already used by widgets, only primary double clicks can send commands. This limitation is due to Egui also triggering 2 single clicks before a double click is triggered. Egui does not have an implementation for stopping event propagation out of the box and would be too much work to include. Similarly, commands can be sent on every "tick" of mouse scrolling, touchpad or touchscreen swiping in any of the 4 directions. This "tick" can be adjusted to fit user's preference. This is due to the fact, that Egui does not have an event for when a mouse "tick" occurs. It instead gives a number of points that the user scrolled/swiped on each frame. ```json "mouse": { // The variable will be resolved //"on_primary_double_click": "komorebic replace-configuration $Env:USERPROFILE/komorebi.json", // This is the same as below but executed in a persistent powershell instance // "on_primary_double_click": "komorebic toggle-pause", "on_primary_double_click": { "focus_monitor_at_cursor": false, "ignore_mouse_follows_focus": false, "message": { "type": "TogglePause" } }, "on_secondary_click": { "message": { "type": "NewWorkspace" } }, "on_middle_click": { "message": { "type": "CloseWorkspace" } }, "on_extra2_click": { "message": { "type": "CycleStack", "content": "Next" } }, "on_extra1_click": { "message": { "type": "CycleStack", "content": "Previous" } }, "vertical_scroll_threshold": 100, "on_scroll_up": { "message": { "type": "CycleFocusWorkspace", "content": "Next" } }, "on_scroll_down": { "message": { "type": "CycleFocusWorkspace", "content": "Previous" } }, "horizontal_scroll_threshold": 100, "on_scroll_left": { "message": { "type": "CycleStackIndex", "content": "Previous" } }, "on_scroll_right": { "message": { "type": "CycleStackIndex", "content": "Next" } } }, ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-01-05 14:55:06 +01:00
adam closed this issue 2026-01-05 14:55:06 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#1385