[cfg-breaking] Rename Wheel* to WheelScroll* bindings
Browse files at this commitb09dbb80c7c507f34e194f2c5420054608cbf732Parent: 54e6a014 changed files +38 -35
- niri-config/src/lib.rs +14 -14
- resources/default-config.kdl +12 -12
- src/input.rs +8 -5
- src/ui/hotkey_overlay.rs +4 -4
niri-config/src/lib.rsmodified+14 -14
| @@ -733,10 +733,10 @@ pub struct Key { | |||
| 733 | #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] | 733 | #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] |
| 734 | pub enum Trigger { | 734 | pub enum Trigger { |
| 735 | Keysym(Keysym), | 735 | Keysym(Keysym), |
| 736 | - WheelDown, | 736 | + WheelScrollDown, |
| 737 | - WheelUp, | 737 | + WheelScrollUp, |
| 738 | - WheelLeft, | 738 | + WheelScrollLeft, |
| 739 | - WheelRight, | 739 | + WheelScrollRight, |
| 740 | } | 740 | } |
| 741 | 741 | ||
| 742 | bitflags! { | 742 | bitflags! { |
| @@ -1547,14 +1547,14 @@ impl FromStr for Key { | |||
| 1547 | } | 1547 | } |
| 1548 | } | 1548 | } |
| 1549 | 1549 | ||
| 1550 | - let trigger = if key.eq_ignore_ascii_case("WheelDown") { | 1550 | + let trigger = if key.eq_ignore_ascii_case("WheelScrollDown") { |
| 1551 | - Trigger::WheelDown | 1551 | + Trigger::WheelScrollDown |
| 1552 | - } else if key.eq_ignore_ascii_case("WheelUp") { | 1552 | + } else if key.eq_ignore_ascii_case("WheelScrollUp") { |
| 1553 | - Trigger::WheelUp | 1553 | + Trigger::WheelScrollUp |
| 1554 | - } else if key.eq_ignore_ascii_case("WheelLeft") { | 1554 | + } else if key.eq_ignore_ascii_case("WheelScrollLeft") { |
| 1555 | - Trigger::WheelLeft | 1555 | + Trigger::WheelScrollLeft |
| 1556 | - } else if key.eq_ignore_ascii_case("WheelRight") { | 1556 | + } else if key.eq_ignore_ascii_case("WheelScrollRight") { |
| 1557 | - Trigger::WheelRight | 1557 | + Trigger::WheelScrollRight |
| 1558 | } else { | 1558 | } else { |
| 1559 | let keysym = keysym_from_name(key, KEYSYM_CASE_INSENSITIVE); | 1559 | let keysym = keysym_from_name(key, KEYSYM_CASE_INSENSITIVE); |
| 1560 | if keysym.raw() == KEY_NoSymbol { | 1560 | if keysym.raw() == KEY_NoSymbol { |
| @@ -1771,7 +1771,7 @@ mod tests { | |||
| 1771 | Mod+Comma { consume-window-into-column; } | 1771 | Mod+Comma { consume-window-into-column; } |
| 1772 | Mod+1 { focus-workspace 1; } | 1772 | Mod+1 { focus-workspace 1; } |
| 1773 | Mod+Shift+E { quit skip-confirmation=true; } | 1773 | Mod+Shift+E { quit skip-confirmation=true; } |
| 1774 | - Mod+WheelDown cooldown-ms=150 { focus-workspace-down; } | 1774 | + Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } |
| 1775 | } | 1775 | } |
| 1776 | 1776 | ||
| 1777 | debug { | 1777 | debug { |
| @@ -2011,7 +2011,7 @@ mod tests { | |||
| 2011 | }, | 2011 | }, |
| 2012 | Bind { | 2012 | Bind { |
| 2013 | key: Key { | 2013 | key: Key { |
| 2014 | - trigger: Trigger::WheelDown, | 2014 | + trigger: Trigger::WheelScrollDown, |
| 2015 | modifiers: Modifiers::COMPOSITOR, | 2015 | modifiers: Modifiers::COMPOSITOR, |
| 2016 | }, | 2016 | }, |
| 2017 | action: Action::FocusWorkspaceDown, | 2017 | action: Action::FocusWorkspaceDown, |
resources/default-config.kdlmodified+12 -12
| @@ -523,22 +523,22 @@ binds { | |||
| 523 | // To avoid scrolling through workspaces really fast, you can use | 523 | // To avoid scrolling through workspaces really fast, you can use |
| 524 | // the cooldown-ms property. The bind will be rate-limited to this value. | 524 | // the cooldown-ms property. The bind will be rate-limited to this value. |
| 525 | // You can set a cooldown on any bind, but it's most useful for the wheel. | 525 | // You can set a cooldown on any bind, but it's most useful for the wheel. |
| 526 | - Mod+WheelDown cooldown-ms=150 { focus-workspace-down; } | 526 | + Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } |
| 527 | - Mod+WheelUp cooldown-ms=150 { focus-workspace-up; } | 527 | + Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } |
| 528 | - Mod+Ctrl+WheelDown cooldown-ms=150 { move-column-to-workspace-down; } | 528 | + Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; } |
| 529 | - Mod+Ctrl+WheelUp cooldown-ms=150 { move-column-to-workspace-up; } | 529 | + Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; } |
| 530 | 530 | ||
| 531 | - Mod+WheelRight { focus-column-right; } | 531 | + Mod+WheelScrollRight { focus-column-right; } |
| 532 | - Mod+WheelLeft { focus-column-left; } | 532 | + Mod+WheelScrollLeft { focus-column-left; } |
| 533 | - Mod+Ctrl+WheelRight { move-column-right; } | 533 | + Mod+Ctrl+WheelScrollRight { move-column-right; } |
| 534 | - Mod+Ctrl+WheelLeft { move-column-left; } | 534 | + Mod+Ctrl+WheelScrollLeft { move-column-left; } |
| 535 | 535 | ||
| 536 | // Usually scrolling up and down with Shift in applications results in | 536 | // Usually scrolling up and down with Shift in applications results in |
| 537 | // horizontal scrolling; these binds replicate that. | 537 | // horizontal scrolling; these binds replicate that. |
| 538 | - Mod+Shift+WheelDown { focus-column-right; } | 538 | + Mod+Shift+WheelScrollDown { focus-column-right; } |
| 539 | - Mod+Shift+WheelUp { focus-column-left; } | 539 | + Mod+Shift+WheelScrollUp { focus-column-left; } |
| 540 | - Mod+Ctrl+Shift+WheelDown { move-column-right; } | 540 | + Mod+Ctrl+Shift+WheelScrollDown { move-column-right; } |
| 541 | - Mod+Ctrl+Shift+WheelUp { move-column-left; } | 541 | + Mod+Ctrl+Shift+WheelScrollUp { move-column-left; } |
| 542 | 542 | ||
| 543 | // You can refer to workspaces by index. However, keep in mind that | 543 | // You can refer to workspaces by index. However, keep in mind that |
| 544 | // niri is a dynamic workspace system, so these commands are kind of | 544 | // niri is a dynamic workspace system, so these commands are kind of |
src/input.rsmodified+8 -5
| @@ -1116,7 +1116,7 @@ impl State { | |||
| 1116 | let horizontal_amount_v120 = event.amount_v120(Axis::Horizontal); | 1116 | let horizontal_amount_v120 = event.amount_v120(Axis::Horizontal); |
| 1117 | let vertical_amount_v120 = event.amount_v120(Axis::Vertical); | 1117 | let vertical_amount_v120 = event.amount_v120(Axis::Vertical); |
| 1118 | 1118 | ||
| 1119 | - // Handle wheel bindings. | 1119 | + // Handle wheel scroll bindings. |
| 1120 | if source == AxisSource::Wheel { | 1120 | if source == AxisSource::Wheel { |
| 1121 | let comp_mod = self.backend.mod_key(); | 1121 | let comp_mod = self.backend.mod_key(); |
| 1122 | let mods = self.niri.seat.get_keyboard().unwrap().modifier_state(); | 1122 | let mods = self.niri.seat.get_keyboard().unwrap().modifier_state(); |
| @@ -1124,9 +1124,10 @@ impl State { | |||
| 1124 | if let Some(v120) = horizontal_amount_v120 { | 1124 | if let Some(v120) = horizontal_amount_v120 { |
| 1125 | let config = self.niri.config.borrow(); | 1125 | let config = self.niri.config.borrow(); |
| 1126 | let bindings = &config.binds; | 1126 | let bindings = &config.binds; |
| 1127 | - let bind_left = find_configured_bind(bindings, comp_mod, Trigger::WheelLeft, mods); | 1127 | + let bind_left = |
| 1128 | + find_configured_bind(bindings, comp_mod, Trigger::WheelScrollLeft, mods); | ||
| 1128 | let bind_right = | 1129 | let bind_right = |
| 1129 | - find_configured_bind(bindings, comp_mod, Trigger::WheelRight, mods); | 1130 | + find_configured_bind(bindings, comp_mod, Trigger::WheelScrollRight, mods); |
| 1130 | drop(config); | 1131 | drop(config); |
| 1131 | 1132 | ||
| 1132 | // If we have a bind with current modifiers along the scroll direction, then | 1133 | // If we have a bind with current modifiers along the scroll direction, then |
| @@ -1152,8 +1153,10 @@ impl State { | |||
| 1152 | if let Some(v120) = vertical_amount_v120 { | 1153 | if let Some(v120) = vertical_amount_v120 { |
| 1153 | let config = self.niri.config.borrow(); | 1154 | let config = self.niri.config.borrow(); |
| 1154 | let bindings = &config.binds; | 1155 | let bindings = &config.binds; |
| 1155 | - let bind_up = find_configured_bind(bindings, comp_mod, Trigger::WheelUp, mods); | 1156 | + let bind_up = |
| 1156 | - let bind_down = find_configured_bind(bindings, comp_mod, Trigger::WheelDown, mods); | 1157 | + find_configured_bind(bindings, comp_mod, Trigger::WheelScrollUp, mods); |
| 1158 | + let bind_down = | ||
| 1159 | + find_configured_bind(bindings, comp_mod, Trigger::WheelScrollDown, mods); | ||
| 1157 | drop(config); | 1160 | drop(config); |
| 1158 | 1161 | ||
| 1159 | if bind_up.is_some() || bind_down.is_some() { | 1162 | if bind_up.is_some() || bind_down.is_some() { |
src/ui/hotkey_overlay.rsmodified+4 -4
| @@ -417,10 +417,10 @@ fn key_name(comp_mod: CompositorMod, key: &Key) -> String { | |||
| 417 | 417 | ||
| 418 | let pretty = match key.trigger { | 418 | let pretty = match key.trigger { |
| 419 | Trigger::Keysym(keysym) => prettify_keysym_name(&keysym_get_name(keysym)), | 419 | Trigger::Keysym(keysym) => prettify_keysym_name(&keysym_get_name(keysym)), |
| 420 | - Trigger::WheelDown => String::from("Wheel Down"), | 420 | + Trigger::WheelScrollDown => String::from("Wheel Scroll Down"), |
| 421 | - Trigger::WheelUp => String::from("Wheel Up"), | 421 | + Trigger::WheelScrollUp => String::from("Wheel Scroll Up"), |
| 422 | - Trigger::WheelLeft => String::from("Wheel Left"), | 422 | + Trigger::WheelScrollLeft => String::from("Wheel Scroll Left"), |
| 423 | - Trigger::WheelRight => String::from("Wheel Right"), | 423 | + Trigger::WheelScrollRight => String::from("Wheel Scroll Right"), |
| 424 | }; | 424 | }; |
| 425 | name.push_str(&pretty); | 425 | name.push_str(&pretty); |
| 426 | 426 | ||