Rewrite budgie menu (#110)
* Re-implement the Budgie menu applet
This adds a new backend structure for tracking installed applications, inspired by the UbuntuBudgie application-menu repo. This allows much better and easier tracking of when applications are added and removed. Updates are quite fast on my system, with no noticeable lag.
The backend is taken advantage of by a re-worked UI for the menu. Views are abstracted, making it far easier to implement different types of views down the road.
A major change with the rework is that there is a new option for the menu to show or hide Control Center panels from the view. Even if they are hidden from the view, they are still searchable. By default, these items are not shown to match the current behavior of the menu.
Signed-off-by: Evan Maddock <email address hidden>
* Integrate functions from user-indicator applet to menu
This adds a footer to the Budgie Menu with two buttons: a user button and a power button. The user button doesn't currently do anything; its functionality will be added at a later time. The power button opens a menu with the various session and power controls.
The power menu is implemented as an overlay widget over the view widgets. This allows having a menu that doesn't resize the entire popover when it opens. However, this means that in a lot of themes, the menu will have a transparent background. The built-in theme has been modified to address this, but other themes will need editing to take this into account.
Speaking of theming, there are several new CSS classes used by various parts of the Budgie Menu:
- `budgie-menu-header`: Applied to the GtkBox holding the search entry widget
- `budgie-menu-footer`: Applied to the GtkBox holding the user and power buttons
- `budgie-menu-overlay`: Applied to the GtkListBox holding menu items. These widgets (in the event that there are more than one) are a part of a GtkOverlay as overlay widgets
- `user-icon-button`: Applied to the user button in the footer
Signed-off-by: Evan Maddock <email address hidden>
* Remove some excluded apps in categories
Signed-off-by: Evan Maddock <email address hidden>
* Update built-in style of budgie menu footer
* Update built-in style and widgets for new Budgie Menu
* Make sure the app list filter is updated when the user hits enter
This ensures that the search filter is always up to date when the user hits enter, expecting to launch a particular application.
Signed-off-by: Evan Maddock <email address hidden>
* Fix padding on user icon button
* Allow keyboard focusing menu items
Signed-off-by: Evan Maddock <email address hidden>
* Make sure popover closes when app launched in all cases
Signed-off-by: Evan Maddock <email address hidden>
* Add support for GPU switching when launching applications
This is done via switcheroo-control. If switcheroo-control is not installed or the system only has one GPU, it just starts the application as before. If those conditions are met, however, and the application asks to use either the default or non-default GPU, then the environment is applied to the launch context as appropriate.
Signed-off-by: Evan Maddock <email address hidden>
* Lower cairo version requirement for Ubuntu
Signed-off-by: Evan Maddock <email address hidden>
* Improve documentation for the filter and sort functions in the apps list
Signed-off-by: Evan Maddock <email address hidden>
* Move search checking to a new RelevancyService
This creates a new centralized place to keep track of every application's relevancy relative to a search term.
It works pretty similarly to the old searching, but adds some "fuzzyness" by calculating the Levenshtein Distance if the term doesn't quite match an app's name. Apps in the menu are filtered and sorted based on this calculated relevancy, with filtering using an arbitrary threshold.
It should be easier to tweak how relevancy is calculated going forward with this new API.
Signed-off-by: Evan Maddock <email address hidden>
* Disable focus on menu buttons (rows can be focused)
* Remove unused code
Signed-off-by: Evan Maddock <email address hidden>
* Address initial review items
Signed-off-by: Evan Maddock <email address hidden>
* Move the application index and tracking to its own module
This allows the system to be reused in multiple places, e.g. the Budgie Menu and the F2 Launcher.
To ensure we only have a single copy of the index, the category list has been made static, ensuring that we aren't wasting a bunch of memory and resources on multiple copies of the index.
Signed-off-by: Evan Maddock <email address hidden>
* Use a better way of ensuring there is only one index
Takes a cue from the AppInfoMonitor class and use a static method to return a shared instance of our index class.
Signed-off-by: Evan Maddock <email address hidden>
* Change back to changed because search_changed only emits every 150ms and makes search responsiveness much slower.
* Add support for custom categories
This adds a file monitor on ~/.local/share/desktop-directories to watch for file changes, and handling for creating new Categories from .directory files.
Signed-off-by: Evan Maddock <email address hidden>
* Add the custom category's filename without the extension during Category new_for_file
Menu editors like menulibre will set the Categories of a desktop file to the basename without the .directory extension, so when we create a category for the respective .directory, we need to make sure it is included in the included_categories.
* Fix a derp during rebase
* Add new dependency for the workflow
Signed-off-by: Evan Maddock <email address hidden>
* Finally added the XDG Directory menu support
* Remove User Indicator from default panel.ini
* Validate symlinks in our XDGDirTracker
Directories with broken symlinks should not be added to our list of existing dirs.
* Refine styling of overlay menus.
* Fix overlay menu style in built-in theme
* Make padding of overlay menu buttons the same
Co-authored-by: Campbell Jones <email address hidden>
Co-authored-by: Joshua Strobl <email address hidden>