1818# You should have received a copy of the GNU Lesser General Public License along
1919# with this program; if not, see <http://www.gnu.org/licenses/>.
2020"""Search page for App Menu"""
21+ import subprocess
2122from typing import Dict , Optional , Set , Union
2223
2324from .desktop_file_manager import DesktopFileManager
24- from .custom_widgets import SearchVMRow , AnyVMRow , ControlList , KeynavController
25+ from .custom_widgets import SearchVMRow , AnyVMRow , ControlList , KeynavController , \
26+ HoverListBox , HoverEventBox
2527from .app_widgets import SearchAppEntry
2628from .vm_manager import VMEntry , VMManager
2729from .page_handler import MenuPage
@@ -41,14 +43,18 @@ class RecentSearchRow(Gtk.ListBoxRow):
4143 def __init__ (self , search_text : str ):
4244 super ().__init__ ()
4345 self .search_text = search_text
46+
47+ self .event_box = HoverEventBox (focus_widget = self )
48+ self .add (self .event_box )
49+
4450 self .hbox = Gtk .Box (orientation = Gtk .Orientation .HORIZONTAL )
4551
4652 self .recent_icon = Gtk .Image .new_from_pixbuf (load_icon ("qappmenu-search" ))
4753 self .hbox .pack_start (self .recent_icon , False , False , 5 )
4854 self .search_label = Gtk .Label (label = search_text , xalign = 0 )
4955 self .hbox .pack_start (self .search_label , False , False , 5 )
5056 self .get_style_context ().add_class ("app_entry" )
51- self .add (self .hbox )
57+ self .event_box . add (self .hbox )
5258 self .show_all ()
5359
5460
@@ -123,6 +129,7 @@ def add_new_recent_search(self, text: str):
123129
124130 def _row_clicked (self , _widget , row : RecentSearchRow ):
125131 self ._deselect_others ()
132+ self .recent_list_box .select_row (None )
126133 self .search_box .set_text (row .search_text )
127134
128135
@@ -205,6 +212,7 @@ def add_new_recent_app(self, _widget, app_path: str):
205212
206213 def _row_clicked (self , _widget , row : SearchAppEntry ):
207214 self ._deselect_others ()
215+ self .recent_list_box .select_row (None )
208216 if hasattr (row , "app_info" ):
209217 row .run_app (row .app_info .vm )
210218
@@ -295,13 +303,26 @@ def __init__(
295303 widgets_in_order = [self .app_list , self .control_list ]
296304 )
297305
306+ self .settings_buttons = [
307+ builder .get_object ("search_settings_button_1" ),
308+ builder .get_object ("search_settings_button_2" )
309+ ]
310+
311+ for button in self .settings_buttons :
312+ button .connect ('clicked' , self ._run_settings )
313+
298314 def _app_clicked (self , _widget , row ):
299315 self .recent_search_manager .add_new_recent_search (self .search_entry .get_text ())
300316 if self .selected_vm_row :
301317 row .run_app (self .selected_vm_row .vm_entry .vm )
302318 elif hasattr (row , "app_info" ):
303319 row .run_app (row .app_info .vm )
304320
321+ def _run_settings (self , widget , * _args ):
322+ subprocess .Popen (["qubes-appmenu-settings" ], stdin = subprocess .DEVNULL )
323+ widget .get_toplevel ().get_application ().hide_menu ()
324+
325+
305326 def _app_info_callback (self , app_info ):
306327 """
307328 Callback to be performed on all newly loaded ApplicationInfo instances.
0 commit comments