File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,10 @@ bool DMenu::on_key_press_event(GdkEventKey* key_event) {
106
106
this -> searchbox.set_text (this -> search_phrase);
107
107
this -> filter_view ();
108
108
return true ;
109
+ } else if (key_event -> keyval == GDK_KEY_Return) {
110
+ // Workaround to launch the single item which has been selected programmatically
111
+ this -> get_children ()[1 ] -> activate ();
112
+ return true ;
109
113
} else if (key_event -> keyval == GDK_KEY_Insert) {
110
114
this -> search_phrase = " " ;
111
115
case_sensitive = !case_sensitive;
@@ -157,6 +161,11 @@ void DMenu::filter_view() {
157
161
item -> signal_activate ().connect (sigc::bind<Glib::ustring>(sigc::mem_fun
158
162
(*this , &DMenu::on_item_clicked), command));
159
163
this -> append (*item);
164
+ // This will highlight 1st menu item, still it won't start on Enter.
165
+ // See workaround in on_key_press_event.
166
+ if (cnt == 0 ) {
167
+ item -> select ();
168
+ }
160
169
cnt++;
161
170
if (cnt > rows - 1 ) {
162
171
limit_exhausted = true ;
You can’t perform that action at this time.
0 commit comments