Skip to content

Commit

Permalink
Add settings GUI and new configuration options (#69)
Browse files Browse the repository at this point in the history
* �[200~Add support for vala-panel to the terminate_appmenu_registrar function.

* Use new get_desktop_env() wrapper function to check for Budgie too.

* Add gsettings option to pin HUD to screen rather that window.

* Try importing xfconf regardless of desktop environment.

* use gdk_screen_get_resolution to get DPI and use the get_dpi method as a fallback.

* Better checking for avoiding panel overlap.

* Speed up getting the process command line by only get the process command line for the process we care about.

* Add internal settings store to ease keeping track of settings. Make location, menu separator, and width customizable. Try to do work only when a setting changes rather than every time we call the HUD.

* Minor fixes

* Actually set the custom width.

* Don't use a negative margin

* Fix list of valid locations and add more logging.

* Add a GUI for changing the settings. Move common functions and defaults into a common file.

* Update README

* Actually install the common.py file. Whoops.

* Improve isrtl function and add custom CSS for invalid fields.

* Add custom CSS for changed values.

* Rewrite hud-settings.py to split all the class methods out from __init__.

* Add a dialog from kupfer to configure the keyboard shortcut. TODO: doesn't let us select a single modifier key like the default Alt_L

* Update README

* Move duplicate code getting the rofi theme list into common.py

* Add ability to save recently selected menu items per application and show them at the top of the HUD list

* Change the menu separator to being selectable from a list of left/right arrow pairs rather than a free for all.

* Make sure the session store of the recently used list is updated when updating from gsettings or the settings app.

* Add a way to select single modifier keys for the shortcut in the settings app.

* Give the fields in the settings app better names.

* Groundwork for making the program translatable.

* Change the gettext domain to 'mate-hud'

* Change all the python script shebangs to python3 from python

* Add some comments. Update the separator on each invocation in case interface direction changes.

* Store the menu separator pair so we don't query from gsettings every invocation but can still set to the LTR or RTL variant.

* Set the preferences-system icon in the desktop file too (pending our own)

* Update README

* Remove validate_menu_separator function that was based on the old way of storing it

* Change the width entry to a SpinButton. Don't allow invalid entries for width or theme -- if the value in gsettings is wrong, change it back to the default. Remove invalid style.

* Don't accidentally add 'Recently Used ------...' to the list of recently used menu items.

* Change how the values for 'recently-used-max' are interpreted to give an option to disable saving recently used menu items

* Add our own icon

* Update the keyboard shortcut dialog ui file against GTK3 (3.16+)

* Install the rofi themes to rofi's prefix regardless where we set the prefix for the mate-hud installation.

* Add plotinus service as a last method to try to retrieve menus (credit to gnome-hud).

* Support plotinus from  original repo: https://github.com/p-e-w/plotinus or unityx-plotinus.

* Remove deprecated functions. Correctly return whether the GTK interface succeeded or not.

* Remove an duplicate output option passed to inkscape in the gen_icons script

* Add @2 png icons and install the scalable icon to the right directory in the hicolor icon theme.

* Watch for changes to the panel and update the margin asynchronously as needed.

* Get xfconf information over dbus rather than through GI -- removes optional dependency on gir1.2-xfconf0

* Add some budgie support.

* Make the panel property listeners work.

* Remove last xfconf gi code and switch to dbus.

* Fix checking if appmenu loaded when running mate-panel

* Remove unused get_desktop_env function

* Add support for avoiding overlapping vala-panel.

* Check which plank dock is running in case it's not the default when we're calculating the margin.

* Terminate registrar (if appmenu isn't running) and kill plotinus on keyboard interrupt.

* Only look in the user config dir for vala-panel config.

* Try to make hud_settings.py a little more maintainable and fix using a custom width in units other than pixels.

* Make sure the vala panel config directory exists before we try to watch it.

* Add recently used max and none to the defaults constants.

* Make HUD prompt configurable.

* Add placeholder text for the prompt so you can see what the default is

* Only create the settings store once. Try using a color from the theme to indicate changes in the settings app.

* Do a better job using the theme color to indicate changes in the settings app.

* Pipe menu items to rofi one at a time so we can show the HUD before we have collected all the menu items. For programs with many menu items makes the HUD launch almost instantly instead of having a lag. (Credit to zren/plasma-hud)

* Explore the menus from first to last when using the GTK interface too.

* Add HUD transparency option in gsettings.

* Add transparency controls to the settings app.

* Wait until we're sure we have a menu to display to start rofi.

Co-authored-by: Martin Wimpress <[email protected]>
  • Loading branch information
twa022 and flexiondotorg authored Sep 21, 2022
1 parent 59f5a69 commit d6cd57e
Show file tree
Hide file tree
Showing 31 changed files with 2,240 additions and 216 deletions.
31 changes: 14 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ includes an implementation of the `com.canonical.AppMenu.Registrar` DBus
service. Applications exporting their menu via `dbusmenu` need this
service to run. `mate-hud.py` tries to get the menu of the currently
focused window, lists possible actions and asks the user which one to
run. `mate-hud.py`, binds itself to the `<Ctrl><Alt>space` keyboard
shortcut by default.
run. `mate-hud.py`, binds itself to the `Alt_L` keyboard
shortcut by default (can be changed in the settings GUI).

### Gsettings
### Settings

`mate-hud.py` reads two gsettings keys:
`mate-hud` includes a small GUI for configuring settings: `hud-settings.py`
which should show up in your applications menu. `mate-hud.py` reads two gsettings keys:

* `org.mate.hud`: `shortcut` (Default: `'Alt_L'`)
* `org.mate.hud`: `rofi-theme` (Default: `mate-hud`)
Expand All @@ -44,25 +45,18 @@ shortcut by default.
which the `mate-hud` Debian package will do, and the `enabled` key
is set to *True* using something like `dconf-editor`.

`mate-hud`
can be enabled or disabled by MATE Tweak under `Panel > Panel Features > Enable HUD`.
`mate-hud` can be enabled or disabled by MATE Tweak under `Panel > Panel Features > Enable HUD`.

### Themes

`mate-hud.py` uses the `mate-hud` theme by default.
The included `mate-hud` and `mate-hud-rounded` themes try to use colors
from your GTK theme. You can see the available rofi themes in
`/usr/share/rofi/themes` or add your own to `~/.local/share/rofi/themes`
Theme files are named `<theme name>.rasi` and you can change the theme using
the following command:

```
gsettings set org.mate.hud rofi-theme <theme name>
```
`mate-hud.py` uses the `mate-hud-rounded` theme by default.
The included `mate-hud` and `mate-hud-rounded` themes and their HiDPI variants
try to use colors from your GTK theme and your system font. You can see
the available themes and make changes with the included settings program.

### Manual Setup

* The `vala-panel-appmenu` applet for MATE should be added to a panel.
* The `vala-panel-appmenu` applet for MATE or XFCE should be added to a panel.
* `mate-hud.py` should be started on session start-up.
* The following should be added to the users `~/.profile` or `/etc/profile.d` or `/etc/X11/Xsession.d/`.

Expand All @@ -84,11 +78,14 @@ export UBUNTU_MENUPROXY=1
* `mate-desktop`
* `python3`
* `python3-dbus`
* `python3-pkgconfig`
* `python3-pyinotify`
* `python3-setproctitle`
* `python3-xlib`
* `rofi`
* `unity-gtk2-module`
* `unity-gtk3-module`
* `plotinus` (optional - additional menu backend for some GTK3 programs without a traditional menu)

A reference package for Debian/Ubuntu is available from:

Expand Down
31 changes: 31 additions & 0 deletions gen_icons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

dir="$( dirname "$(readlink -f "$0")" )"

if [ ! -f "${dir}"/usr/share/pixmaps/mate-hud.svg ] ; then
echo "mate-hud.svg not found" >&2
exit 1
fi

if [ ! `which inkscape 2>/dev/null` ] ; then
echo "inkscape required to convert svg to png"
exit 1
fi

rm -fr "${dir}"/usr/share/icons

for d in 16 22 24 32 48 64 128 256 512 1024; do
install -dm755 "${dir}"/usr/share/icons/hicolor/${d}x${d}/apps
inkscape -w ${d} -h ${d} "${dir}"/usr/share/pixmaps/mate-hud.svg \
-o "${dir}"/usr/share/icons/hicolor/${d}x${d}/apps/mate-hud.png
done

for d in 16 22 24 32 48 64 128 256; do
d2=$(( $d * 2 ))
install -dm755 "${dir}"/usr/share/icons/hicolor/${d}x${d}@2/apps
inkscape -w ${d2} -h ${d2} "${dir}"/usr/share/pixmaps/mate-hud.svg \
-o "${dir}"/usr/share/icons/hicolor/${d}x${d}@2/apps/mate-hud.png
done

install -Dm644 "${dir}"/usr/share/pixmaps/mate-hud.svg \
"${dir}"/usr/share/icons/hicolor/scalable/apps/mate-hud.svg
35 changes: 31 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import DistUtilsExtra.command.build_i18n
import DistUtilsExtra.command.clean_i18n

import pkgconfig
rofi_prefix = pkgconfig.variables('rofi').get('prefix')

__VERSION__ = '22.04.4'

def datafilelist(installbase, sourcebase):
Expand All @@ -41,12 +44,36 @@ def datafilelist(installbase, sourcebase):

data_files = [
('{prefix}/lib/mate-hud/'.format(prefix=sys.prefix), ['usr/lib/mate-hud/mate-hud']),
('{prefix}/lib/mate-hud/'.format(prefix=sys.prefix), ['usr/lib/mate-hud/common.py']),
('{prefix}/lib/mate-hud/'.format(prefix=sys.prefix), ['usr/lib/mate-hud/hud-settings.py']),
('{prefix}/lib/mate-hud/'.format(prefix=sys.prefix), ['usr/lib/mate-hud/i18n.py']),
('{prefix}/lib/mate-hud/'.format(prefix=sys.prefix), ['usr/lib/mate-hud/getkey_dialog.py']),
('{prefix}/lib/mate-hud/'.format(prefix=sys.prefix), ['usr/lib/mate-hud/getkey_dialog.ui']),
('{prefix}/share/applications/'.format(prefix=sys.prefix), ['usr/share/applications/hud-settings.desktop']),
('{prefix}/share/mate/autostart/'.format(prefix=sys.prefix), ['usr/share/mate/autostart/mate-hud.desktop']),
('{prefix}/share/glib-2.0/schemas/'.format(prefix=sys.prefix), ['usr/share/glib-2.0/schemas/org.mate.hud.gschema.xml']),
('{prefix}/share/rofi/themes/'.format(prefix=sys.prefix), ['usr/share/rofi/themes/mate-hud.rasi']),
('{prefix}/share/rofi/themes/'.format(prefix=sys.prefix), ['usr/share/rofi/themes/mate-hud-hidpi.rasi']),
('{prefix}/share/rofi/themes/'.format(prefix=sys.prefix), ['usr/share/rofi/themes/mate-hud-rounded.rasi']),
('{prefix}/share/rofi/themes/'.format(prefix=sys.prefix), ['usr/share/rofi/themes/mate-hud-rounded-hidpi.rasi']),
('{prefix}/share/pixmaps/'.format(prefix=sys.prefix), ['usr/share/pixmaps/mate-hud.svg']),
('{prefix}/share/icons/hicolor/16x16/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/16x16/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/22x22/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/22x22/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/24x24/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/24x24/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/32x32/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/32x32/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/48x48/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/48x48/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/64x64/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/64x64/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/128x128/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/128x128/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/256x256/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/256x256/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/512x512/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/512x512/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/16x16@2/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/16x16@2/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/22x22@2/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/22x22@2/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/24x24@2/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/24x24@2/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/32x32@2/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/32x32@2/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/48x48@2/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/48x48@2/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/64x64@2/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/64x64@2/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/128x128@2/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/128x128@2/apps/mate-hud.png']),
('{prefix}/share/icons/hicolor/scalable/apps'.format(prefix=sys.prefix), ['usr/share/icons/hicolor/scalable/apps/mate-hud.svg']),
('{prefix}/share/rofi/themes/'.format(prefix=rofi_prefix), ['usr/share/rofi/themes/mate-hud.rasi']),
('{prefix}/share/rofi/themes/'.format(prefix=rofi_prefix), ['usr/share/rofi/themes/mate-hud-hidpi.rasi']),
('{prefix}/share/rofi/themes/'.format(prefix=rofi_prefix), ['usr/share/rofi/themes/mate-hud-rounded.rasi']),
('{prefix}/share/rofi/themes/'.format(prefix=rofi_prefix), ['usr/share/rofi/themes/mate-hud-rounded-hidpi.rasi']),
]

cmdclass = {
Expand Down
Loading

0 comments on commit d6cd57e

Please sign in to comment.