Merge pull request #5061 from buzz/fix/hyprland-workspaces-scroll

fix(hyprland): support custom scroll commands
This commit is contained in:
Alexis Rouillard
2026-07-03 20:59:12 +02:00
committed by GitHub
2 changed files with 16 additions and 1 deletions
+8
View File
@@ -135,6 +135,14 @@ This setting is ignored if *workspace-taskbar.enable* is set to true.
default: false ++ default: false ++
If set to false, you can't scroll to cycle throughout workspaces from the entire bar. If set to true this behaviour is enabled. If set to false, you can't scroll to cycle throughout workspaces from the entire bar. If set to true this behaviour is enabled.
*on-scroll-up*: ++
typeof: string ++
Command to execute when scrolling up on the module. This replaces the default behaviour of workspace cycling.
*on-scroll-down*: ++
typeof: string ++
Command to execute when scrolling down on the module. This replaces the default behaviour of workspace cycling.
*ignore-workspaces*: ++ *ignore-workspaces*: ++
typeof: array ++ typeof: array ++
default: [] ++ default: [] ++
+8 -1
View File
@@ -50,7 +50,8 @@ void Workspaces::init() {
if (m_scrollEventConnection_.connected()) { if (m_scrollEventConnection_.connected()) {
m_scrollEventConnection_.disconnect(); m_scrollEventConnection_.disconnect();
} }
if (barScroll()) { bool hasScrollConfig = config_["on-scroll-up"].isString() || config_["on-scroll-down"].isString();
if (barScroll() || hasScrollConfig) {
auto& window = const_cast<Bar&>(m_bar).window; auto& window = const_cast<Bar&>(m_bar).window;
window.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK); window.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
m_scrollEventConnection_ = m_scrollEventConnection_ =
@@ -1188,6 +1189,12 @@ bool Workspaces::handleScroll(GdkEventScroll* e) {
if (gdk_event_get_pointer_emulated((GdkEvent*)e)) { if (gdk_event_get_pointer_emulated((GdkEvent*)e)) {
return false; return false;
} }
// Check for custom scroll commands first; delegate to base class
if (config_["on-scroll-up"].isString() || config_["on-scroll-down"].isString()) {
return AModule::handleScroll(e);
}
auto dir = AModule::getScrollDir(e); auto dir = AModule::getScrollDir(e);
if (dir == SCROLL_DIR::NONE) { if (dir == SCROLL_DIR::NONE) {
return true; return true;