Make generic-modifier-only binds press-order-independent
Browse files at this commit75db0a3c700e7587bff847f995d5b0c0fe8c7efbParent: cbd94d15 changed files +300 -20
- docs/wiki/Configuration:-Key-Bindings.md +14 -0
- niri-config/src/binds.rs +16 -10
- src/input/mod.rs +35 -4
- src/tests/binds.rs +227 -6
- src/ui/mru.rs +8 -0
docs/wiki/Configuration:-Key-Bindings.mdmodified+14 -0
| @@ -50,6 +50,20 @@ binds { | |||
| 50 | } | 50 | } |
| 51 | ``` | 51 | ``` |
| 52 | 52 | ||
| 53 | +<sup>Since: next release</sup> Generic modifiers like `Shift` or `Alt` can be used as trigger keys. | ||
| 54 | +Binds consisting only of generic modifiers do not depend on the order that you press them: | ||
| 55 | + | ||
| 56 | +```kdl | ||
| 57 | +binds { | ||
| 58 | + // Will trigger both when pressing Alt then Shift, and Shift then Alt. | ||
| 59 | + Alt+Shift { spawn "alacritty"; } | ||
| 60 | + | ||
| 61 | + // The trigger is not a generic modifier, so | ||
| 62 | + // you need to press it last. Only Ctrl then Left Shift will work. | ||
| 63 | + Ctrl+Shift_L { spawn "alacritty"; } | ||
| 64 | +} | ||
| 65 | +``` | ||
| 66 | + | ||
| 53 | <sup>Since: 25.05</sup> You can customize the `Mod` key [in the `input` section of the config](./Configuration:-Input.md#mod-key-mod-key-nested). | 67 | <sup>Since: 25.05</sup> You can customize the `Mod` key [in the `input` section of the config](./Configuration:-Input.md#mod-key-mod-key-nested). |
| 54 | 68 | ||
| 55 | > [!TIP] | 69 | > [!TIP] |
niri-config/src/binds.rsmodified+16 -10
| @@ -127,6 +127,10 @@ impl Trigger { | |||
| 127 | } | 127 | } |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | + pub fn is_generic_modifier(self) -> bool { | ||
| 131 | + matches!(self, Self::CompositorMod | Self::Modifier(_)) | ||
| 132 | + } | ||
| 133 | + | ||
| 130 | /// The modifier flags that this trigger sets, if it is a modifier key. | 134 | /// The modifier flags that this trigger sets, if it is a modifier key. |
| 131 | pub fn implied_modifier(self) -> Modifiers { | 135 | pub fn implied_modifier(self) -> Modifiers { |
| 132 | match self { | 136 | match self { |
| @@ -138,15 +142,6 @@ impl Trigger { | |||
| 138 | } | 142 | } |
| 139 | } | 143 | } |
| 140 | 144 | ||
| 141 | - /// Whether the same key press can trigger both of these triggers. | ||
| 142 | - fn overlaps(self, other: Self) -> bool { | ||
| 143 | - match (self, other) { | ||
| 144 | - (Self::Modifier(modifier), Self::Keysym(keysym)) | ||
| 145 | - | (Self::Keysym(keysym), Self::Modifier(modifier)) => modifier.matches_keysym(keysym), | ||
| 146 | - (a, b) => a == b, | ||
| 147 | - } | ||
| 148 | - } | ||
| 149 | - | ||
| 150 | pub fn is_keyboard(self) -> bool { | 145 | pub fn is_keyboard(self) -> bool { |
| 151 | matches!( | 146 | matches!( |
| 152 | self, | 147 | self, |
| @@ -174,7 +169,10 @@ impl Key { | |||
| 174 | return false; | 169 | return false; |
| 175 | } | 170 | } |
| 176 | 171 | ||
| 177 | - self.trigger.overlaps(other.trigger) | 172 | + // Generic-modifier-only binds are press-order-independent, so only their modifier set |
| 173 | + // (which already includes the trigger implied modifier) has to match. | ||
| 174 | + (self.trigger.is_generic_modifier() && other.trigger.is_modifier()) | ||
| 175 | + || (self.trigger.is_modifier() && other.trigger.is_generic_modifier()) | ||
| 178 | } | 176 | } |
| 179 | } | 177 | } |
| 180 | 178 | ||
| @@ -1555,6 +1553,14 @@ mod tests { | |||
| 1555 | let compositor_mod = key("Mod"); | 1553 | let compositor_mod = key("Mod"); |
| 1556 | assert!(!compositor_mod.conflicts_with(&key("Super_L"))); | 1554 | assert!(!compositor_mod.conflicts_with(&key("Super_L"))); |
| 1557 | assert!(!compositor_mod.conflicts_with(&key("Super"))); | 1555 | assert!(!compositor_mod.conflicts_with(&key("Super"))); |
| 1556 | + | ||
| 1557 | + // Generic-modifier-only keys are order-independent. | ||
| 1558 | + assert!(key("Ctrl+Alt").conflicts_with(&key("Alt+Ctrl"))); | ||
| 1559 | + assert!(key("Mod+Shift+Alt").conflicts_with(&key("Shift+Alt+Mod"))); | ||
| 1560 | + assert!(key("Ctrl+Alt").conflicts_with(&key("Alt+Control_L"))); | ||
| 1561 | + assert!(key("Ctrl+Alt_L").conflicts_with(&key("Alt+Ctrl"))); | ||
| 1562 | + | ||
| 1563 | + assert!(!key("Ctrl+Alt").conflicts_with(&key("Ctrl+Alt+A"))); | ||
| 1558 | } | 1564 | } |
| 1559 | 1565 | ||
| 1560 | #[test] | 1566 | #[test] |
src/input/mod.rsmodified+35 -4
| @@ -4892,16 +4892,47 @@ fn find_bind<'a>( | |||
| 4892 | bindings | 4892 | bindings |
| 4893 | .into_iter() | 4893 | .into_iter() |
| 4894 | .find(|bind| { | 4894 | .find(|bind| { |
| 4895 | + let bind_trigger = bind.key.trigger; | ||
| 4896 | + // Check that the bind modifiers match the held modifiers. | ||
| 4897 | + // | ||
| 4898 | + // Pass the bind's trigger itself since we'll check the trigger match below. | ||
| 4899 | + // (Note that this means mod_key is not properly checked when it matches the trigger.) | ||
| 4900 | + if !bind_matches_trigger(bind, bind_trigger, mod_key, modifiers) { | ||
| 4901 | + return false; | ||
| 4902 | + } | ||
| 4903 | + | ||
| 4904 | + // Binds that consist only of generic modifiers can be hit in any order (trigger key | ||
| 4905 | + // does not have to be the last). This is consistent with how these types of binds work | ||
| 4906 | + // elsewhere. | ||
| 4907 | + // | ||
| 4908 | + // For example: | ||
| 4909 | + // - Alt + Shift to switch keyboard layout on Windows | ||
| 4910 | + // - Ctrl + Alt to show inlay hints in VSCode | ||
| 4911 | + if bind_trigger.is_generic_modifier() { | ||
| 4912 | + // Bind trigger matching compositor mod isn't properly checked above. | ||
| 4913 | + // Check it here. | ||
| 4914 | + if (bind_trigger == Trigger::CompositorMod | ||
| 4915 | + || bind_trigger == Trigger::Modifier(mod_key)) | ||
| 4916 | + && !modifiers.contains(mod_key.to_modifiers()) | ||
| 4917 | + { | ||
| 4918 | + return false; | ||
| 4919 | + } | ||
| 4920 | + | ||
| 4921 | + // Check that the key we pressed is one of the bind modifiers. | ||
| 4922 | + let mut raw_mods = Trigger::Keysym(raw).implied_modifier(); | ||
| 4923 | + if mod_key.matches_keysym(raw) { | ||
| 4924 | + raw_mods |= Modifiers::COMPOSITOR; | ||
| 4925 | + } | ||
| 4926 | + return !raw_mods.is_empty() && bind.key.modifiers.intersects(raw_mods); | ||
| 4927 | + } | ||
| 4928 | + | ||
| 4895 | // Modifier-only binds can be written in several ways: | 4929 | // Modifier-only binds can be written in several ways: |
| 4896 | // - `Mod { quit; }` - Trigger::CompositorMod | 4930 | // - `Mod { quit; }` - Trigger::CompositorMod |
| 4897 | // - `Super { quit; }` - Trigger::Modifier(_) | 4931 | // - `Super { quit; }` - Trigger::Modifier(_) |
| 4898 | // - `Super_L { quit; }` - Trigger::Keysym(_) | 4932 | // - `Super_L { quit; }` - Trigger::Keysym(_) |
| 4899 | // | 4933 | // |
| 4900 | - // These only matter for keyboard keys and not for mouse or others. So, check them here, | 4934 | + // These only matter for keyboard keys and not for mouse or others. So, check them here. |
| 4901 | - // and then pass the bind's trigger itself to the simpler matching function. | ||
| 4902 | - let bind_trigger = bind.key.trigger; | ||
| 4903 | trigger_matches_keysym(bind_trigger, raw, mod_key) | 4935 | trigger_matches_keysym(bind_trigger, raw, mod_key) |
| 4904 | - && bind_matches_trigger(bind, bind_trigger, mod_key, modifiers) | ||
| 4905 | }) | 4936 | }) |
| 4906 | .cloned() | 4937 | .cloned() |
| 4907 | } | 4938 | } |
src/tests/binds.rsmodified+227 -6
| @@ -982,10 +982,10 @@ fn generic_modifier_press_release() { | |||
| 982 | surface key pressed: 42 | 982 | surface key pressed: 42 |
| 983 | surface modifiers: depressed=1, latched=0, locked=0, group=0 | 983 | surface modifiers: depressed=1, latched=0, locked=0, group=0 |
| 984 | +LWIN 133 XK_Super_L | 984 | +LWIN 133 XK_Super_L |
| 985 | - surface key pressed: 125 | 985 | + niri test-action |
| 986 | surface modifiers: depressed=65, latched=0, locked=0, group=0 | 986 | surface modifiers: depressed=65, latched=0, locked=0, group=0 |
| 987 | -LWIN 133 XK_Super_L | 987 | -LWIN 133 XK_Super_L |
| 988 | - surface key released: 125 | 988 | + niri test-action |
| 989 | surface modifiers: depressed=1, latched=0, locked=0, group=0 | 989 | surface modifiers: depressed=1, latched=0, locked=0, group=0 |
| 990 | -LFSH 50 XK_Shift_L | 990 | -LFSH 50 XK_Shift_L |
| 991 | surface key released: 42 | 991 | surface key released: 42 |
| @@ -998,14 +998,14 @@ fn generic_modifier_press_release() { | |||
| 998 | surface key pressed: 42 | 998 | surface key pressed: 42 |
| 999 | surface modifiers: depressed=1, latched=0, locked=0, group=0 | 999 | surface modifiers: depressed=1, latched=0, locked=0, group=0 |
| 1000 | +LWIN 133 XK_Super_L | 1000 | +LWIN 133 XK_Super_L |
| 1001 | - surface key pressed: 125 | 1001 | + niri test-action |
| 1002 | surface modifiers: depressed=65, latched=0, locked=0, group=0 | 1002 | surface modifiers: depressed=65, latched=0, locked=0, group=0 |
| 1003 | +RWIN 134 XK_Super_R | 1003 | +RWIN 134 XK_Super_R |
| 1004 | - surface key pressed: 126 | 1004 | + niri test-action |
| 1005 | -RWIN 134 XK_Super_R | 1005 | -RWIN 134 XK_Super_R |
| 1006 | - surface key released: 126 | 1006 | + niri test-action |
| 1007 | -LWIN 133 XK_Super_L | 1007 | -LWIN 133 XK_Super_L |
| 1008 | - surface key released: 125 | 1008 | + niri test-action |
| 1009 | surface modifiers: depressed=1, latched=0, locked=0, group=0 | 1009 | surface modifiers: depressed=1, latched=0, locked=0, group=0 |
| 1010 | -LFSH 50 XK_Shift_L | 1010 | -LFSH 50 XK_Shift_L |
| 1011 | surface key released: 42 | 1011 | surface key released: 42 |
| @@ -1033,6 +1033,60 @@ fn generic_modifier_press_release() { | |||
| 1033 | surface key released: 125 | 1033 | surface key released: 125 |
| 1034 | surface modifiers: depressed=0, latched=0, locked=0, group=0 | 1034 | surface modifiers: depressed=0, latched=0, locked=0, group=0 |
| 1035 | "); | 1035 | "); |
| 1036 | + | ||
| 1037 | + // Regressions. | ||
| 1038 | + let c = " | ||
| 1039 | + binds { | ||
| 1040 | + Shift+Mod { close-window; } | ||
| 1041 | + Ctrl+Super { close-window; } | ||
| 1042 | + } | ||
| 1043 | + "; | ||
| 1044 | + | ||
| 1045 | + assert_snapshot!(run(c, "+LFSH -LFSH"), @" | ||
| 1046 | + +LFSH 50 XK_Shift_L | ||
| 1047 | + surface key pressed: 42 | ||
| 1048 | + surface modifiers: depressed=1, latched=0, locked=0, group=0 | ||
| 1049 | + -LFSH 50 XK_Shift_L | ||
| 1050 | + surface key released: 42 | ||
| 1051 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1052 | + "); | ||
| 1053 | + | ||
| 1054 | + assert_snapshot!(run(c, "+LFSH +LWIN -LWIN -LFSH"), @" | ||
| 1055 | + +LFSH 50 XK_Shift_L | ||
| 1056 | + surface key pressed: 42 | ||
| 1057 | + surface modifiers: depressed=1, latched=0, locked=0, group=0 | ||
| 1058 | + +LWIN 133 XK_Super_L | ||
| 1059 | + niri test-action | ||
| 1060 | + surface modifiers: depressed=65, latched=0, locked=0, group=0 | ||
| 1061 | + -LWIN 133 XK_Super_L | ||
| 1062 | + surface modifiers: depressed=1, latched=0, locked=0, group=0 | ||
| 1063 | + -LFSH 50 XK_Shift_L | ||
| 1064 | + surface key released: 42 | ||
| 1065 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1066 | + "); | ||
| 1067 | + | ||
| 1068 | + assert_snapshot!(run(c, "+LCTL -LCTL"), @" | ||
| 1069 | + +LCTL 37 XK_Control_L | ||
| 1070 | + surface key pressed: 29 | ||
| 1071 | + surface modifiers: depressed=4, latched=0, locked=0, group=0 | ||
| 1072 | + -LCTL 37 XK_Control_L | ||
| 1073 | + surface key released: 29 | ||
| 1074 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1075 | + "); | ||
| 1076 | + | ||
| 1077 | + assert_snapshot!(run(c, "+LCTL +LWIN -LWIN -LCTL"), @" | ||
| 1078 | + +LCTL 37 XK_Control_L | ||
| 1079 | + surface key pressed: 29 | ||
| 1080 | + surface modifiers: depressed=4, latched=0, locked=0, group=0 | ||
| 1081 | + +LWIN 133 XK_Super_L | ||
| 1082 | + niri test-action | ||
| 1083 | + surface modifiers: depressed=68, latched=0, locked=0, group=0 | ||
| 1084 | + -LWIN 133 XK_Super_L | ||
| 1085 | + surface modifiers: depressed=4, latched=0, locked=0, group=0 | ||
| 1086 | + -LCTL 37 XK_Control_L | ||
| 1087 | + surface key released: 29 | ||
| 1088 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1089 | + "); | ||
| 1036 | } | 1090 | } |
| 1037 | 1091 | ||
| 1038 | #[test] | 1092 | #[test] |
| @@ -1679,6 +1733,173 @@ fn mru_close_forwards_key_release_without_bind() { | |||
| 1679 | "); | 1733 | "); |
| 1680 | } | 1734 | } |
| 1681 | 1735 | ||
| 1736 | +#[test] | ||
| 1737 | +fn mru_ignores_generic_modifier_binds() { | ||
| 1738 | + let c = " | ||
| 1739 | + binds { | ||
| 1740 | + Alt+Ctrl { screenshot; } | ||
| 1741 | + } | ||
| 1742 | + "; | ||
| 1743 | + | ||
| 1744 | + // If a press runs the screenshot action, | ||
| 1745 | + // we will get surface enter after it. | ||
| 1746 | + assert_snapshot!(run(c, "+LALT +TAB -TAB +LFSH -LFSH -LALT"), @" | ||
| 1747 | + +LALT 64 XK_Alt_L | ||
| 1748 | + surface key pressed: 56 | ||
| 1749 | + surface modifiers: depressed=8, latched=0, locked=0, group=0 | ||
| 1750 | + +TAB 23 XK_Tab | ||
| 1751 | + surface leave | ||
| 1752 | + -TAB 23 XK_Tab | ||
| 1753 | + +LFSH 50 XK_Shift_L | ||
| 1754 | + -LFSH 50 XK_Shift_L | ||
| 1755 | + -LALT 64 XK_Alt_L | ||
| 1756 | + surface enter: [56] | ||
| 1757 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1758 | + surface key released: 56 | ||
| 1759 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1760 | + "); | ||
| 1761 | + | ||
| 1762 | + assert_snapshot!(run(c, "+LALT +TAB -TAB +LCTL -LCTL -LALT"), @" | ||
| 1763 | + +LALT 64 XK_Alt_L | ||
| 1764 | + surface key pressed: 56 | ||
| 1765 | + surface modifiers: depressed=8, latched=0, locked=0, group=0 | ||
| 1766 | + +TAB 23 XK_Tab | ||
| 1767 | + surface leave | ||
| 1768 | + -TAB 23 XK_Tab | ||
| 1769 | + +LCTL 37 XK_Control_L | ||
| 1770 | + -LCTL 37 XK_Control_L | ||
| 1771 | + -LALT 64 XK_Alt_L | ||
| 1772 | + surface enter: [56] | ||
| 1773 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1774 | + surface key released: 56 | ||
| 1775 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1776 | + "); | ||
| 1777 | + | ||
| 1778 | + let c = " | ||
| 1779 | + binds { | ||
| 1780 | + Ctrl+Shift { screenshot; } | ||
| 1781 | + } | ||
| 1782 | + "; | ||
| 1783 | + | ||
| 1784 | + assert_snapshot!(run(c, "+LALT +TAB -TAB +LFSH -LFSH -LALT"), @" | ||
| 1785 | + +LALT 64 XK_Alt_L | ||
| 1786 | + surface key pressed: 56 | ||
| 1787 | + surface modifiers: depressed=8, latched=0, locked=0, group=0 | ||
| 1788 | + +TAB 23 XK_Tab | ||
| 1789 | + surface leave | ||
| 1790 | + -TAB 23 XK_Tab | ||
| 1791 | + +LFSH 50 XK_Shift_L | ||
| 1792 | + -LFSH 50 XK_Shift_L | ||
| 1793 | + -LALT 64 XK_Alt_L | ||
| 1794 | + surface enter: [56] | ||
| 1795 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1796 | + surface key released: 56 | ||
| 1797 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1798 | + "); | ||
| 1799 | + | ||
| 1800 | + assert_snapshot!(run(c, "+LALT +TAB -TAB +LCTL +LFSH -LFSH -LCTL -LALT"), @" | ||
| 1801 | + +LALT 64 XK_Alt_L | ||
| 1802 | + surface key pressed: 56 | ||
| 1803 | + surface modifiers: depressed=8, latched=0, locked=0, group=0 | ||
| 1804 | + +TAB 23 XK_Tab | ||
| 1805 | + surface leave | ||
| 1806 | + -TAB 23 XK_Tab | ||
| 1807 | + +LCTL 37 XK_Control_L | ||
| 1808 | + +LFSH 50 XK_Shift_L | ||
| 1809 | + -LFSH 50 XK_Shift_L | ||
| 1810 | + -LCTL 37 XK_Control_L | ||
| 1811 | + -LALT 64 XK_Alt_L | ||
| 1812 | + surface enter: [56] | ||
| 1813 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1814 | + surface key released: 56 | ||
| 1815 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1816 | + "); | ||
| 1817 | + | ||
| 1818 | + // Now with a normal trigger. | ||
| 1819 | + let c = " | ||
| 1820 | + binds { | ||
| 1821 | + Alt+Control_L { screenshot; } | ||
| 1822 | + } | ||
| 1823 | + "; | ||
| 1824 | + | ||
| 1825 | + assert_snapshot!(run(c, "+LALT +TAB -TAB +LFSH -LFSH -LALT"), @" | ||
| 1826 | + +LALT 64 XK_Alt_L | ||
| 1827 | + surface key pressed: 56 | ||
| 1828 | + surface modifiers: depressed=8, latched=0, locked=0, group=0 | ||
| 1829 | + +TAB 23 XK_Tab | ||
| 1830 | + surface leave | ||
| 1831 | + -TAB 23 XK_Tab | ||
| 1832 | + +LFSH 50 XK_Shift_L | ||
| 1833 | + -LFSH 50 XK_Shift_L | ||
| 1834 | + -LALT 64 XK_Alt_L | ||
| 1835 | + surface enter: [56] | ||
| 1836 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1837 | + surface key released: 56 | ||
| 1838 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1839 | + "); | ||
| 1840 | + | ||
| 1841 | + assert_snapshot!(run(c, "+LALT +TAB -TAB +LCTL -LCTL -LALT"), @" | ||
| 1842 | + +LALT 64 XK_Alt_L | ||
| 1843 | + surface key pressed: 56 | ||
| 1844 | + surface modifiers: depressed=8, latched=0, locked=0, group=0 | ||
| 1845 | + +TAB 23 XK_Tab | ||
| 1846 | + surface leave | ||
| 1847 | + -TAB 23 XK_Tab | ||
| 1848 | + +LCTL 37 XK_Control_L | ||
| 1849 | + surface enter: [56] | ||
| 1850 | + surface modifiers: depressed=12, latched=0, locked=0, group=0 | ||
| 1851 | + -LCTL 37 XK_Control_L | ||
| 1852 | + surface modifiers: depressed=8, latched=0, locked=0, group=0 | ||
| 1853 | + -LALT 64 XK_Alt_L | ||
| 1854 | + surface key released: 56 | ||
| 1855 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1856 | + "); | ||
| 1857 | + | ||
| 1858 | + let c = " | ||
| 1859 | + binds { | ||
| 1860 | + Ctrl+Shift_L { screenshot; } | ||
| 1861 | + } | ||
| 1862 | + "; | ||
| 1863 | + | ||
| 1864 | + assert_snapshot!(run(c, "+LALT +TAB -TAB +LFSH -LFSH -LALT"), @" | ||
| 1865 | + +LALT 64 XK_Alt_L | ||
| 1866 | + surface key pressed: 56 | ||
| 1867 | + surface modifiers: depressed=8, latched=0, locked=0, group=0 | ||
| 1868 | + +TAB 23 XK_Tab | ||
| 1869 | + surface leave | ||
| 1870 | + -TAB 23 XK_Tab | ||
| 1871 | + +LFSH 50 XK_Shift_L | ||
| 1872 | + surface enter: [56] | ||
| 1873 | + surface modifiers: depressed=9, latched=0, locked=0, group=0 | ||
| 1874 | + -LFSH 50 XK_Shift_L | ||
| 1875 | + surface modifiers: depressed=8, latched=0, locked=0, group=0 | ||
| 1876 | + -LALT 64 XK_Alt_L | ||
| 1877 | + surface key released: 56 | ||
| 1878 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1879 | + "); | ||
| 1880 | + | ||
| 1881 | + assert_snapshot!(run(c, "+LALT +TAB -TAB +LCTL +LFSH -LFSH -LCTL -LALT"), @" | ||
| 1882 | + +LALT 64 XK_Alt_L | ||
| 1883 | + surface key pressed: 56 | ||
| 1884 | + surface modifiers: depressed=8, latched=0, locked=0, group=0 | ||
| 1885 | + +TAB 23 XK_Tab | ||
| 1886 | + surface leave | ||
| 1887 | + -TAB 23 XK_Tab | ||
| 1888 | + +LCTL 37 XK_Control_L | ||
| 1889 | + +LFSH 50 XK_Shift_L | ||
| 1890 | + surface enter: [29, 56] | ||
| 1891 | + surface modifiers: depressed=13, latched=0, locked=0, group=0 | ||
| 1892 | + -LFSH 50 XK_Shift_L | ||
| 1893 | + surface modifiers: depressed=12, latched=0, locked=0, group=0 | ||
| 1894 | + -LCTL 37 XK_Control_L | ||
| 1895 | + surface key released: 29 | ||
| 1896 | + surface modifiers: depressed=8, latched=0, locked=0, group=0 | ||
| 1897 | + -LALT 64 XK_Alt_L | ||
| 1898 | + surface key released: 56 | ||
| 1899 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | ||
| 1900 | + "); | ||
| 1901 | +} | ||
| 1902 | + | ||
| 1682 | #[test] | 1903 | #[test] |
| 1683 | fn vt_switch_runs_release_actions_of_held_binds() { | 1904 | fn vt_switch_runs_release_actions_of_held_binds() { |
| 1684 | // A VT switch can take the input away without ever delivering the releases of everything held | 1905 | // A VT switch can take the input away without ever delivering the releases of everything held |
src/ui/mru.rsmodified+8 -0
| @@ -1886,6 +1886,14 @@ fn make_dynamic_opened_binds(config: &Config) -> Vec<Bind> { | |||
| 1886 | continue; | 1886 | continue; |
| 1887 | }; | 1887 | }; |
| 1888 | 1888 | ||
| 1889 | + // The idea with dynamic binds is that their modifiers are ignored | ||
| 1890 | + // (set to whatever the user is currently holding). This idea does not | ||
| 1891 | + // make sense with order-independent generic-modifier-only binds. | ||
| 1892 | + // Effectively, they would trigger on every key press. | ||
| 1893 | + if bind.key.trigger.is_generic_modifier() { | ||
| 1894 | + continue; | ||
| 1895 | + } | ||
| 1896 | + | ||
| 1889 | let action = match press_action { | 1897 | let action = match press_action { |
| 1890 | Action::FocusColumnRight | 1898 | Action::FocusColumnRight |
| 1891 | | Action::FocusColumnRightOrFirst | 1899 | | Action::FocusColumnRightOrFirst |