Giter Site home page Giter Site logo

ubuntu-mate / mate-hud Goto Github PK

View Code? Open in Web Editor NEW
51.0 7.0 21.0 301 KB

Provides a way to run menubar commands through rofi, much like the Unity 7 Heads-Up Display (HUD).

License: GNU General Public License v2.0

Python 98.94% Shell 1.06%
hud unity7 vala-panel-appmenu

mate-hud's Introduction

mate-hud

Provides a way to run menubar commands through rofi, much like the Unity 7 Heads-Up Display (HUD). mate-hud was originally forked from i3-hud-menu:

It was subsequently improved by incorporating improvements from snippins

What is a HUD and why should I care?

A Heads-Up Display (HUD) allows you to search through an application's appmenu. So if you're trying to find that single filter in Gimp but can't remember which filter category it fits into or if you can't recall if preferences sits under File, Edit or Tools on your favourite browser, you can just search for it rather than hunting through the menus.

Implementation

vala-panel-appmenu 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 Alt_L keyboard shortcut by default (can be changed in the settings GUI).

Settings

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)

mate-hud.py will not execute until those gsettings keys are created, 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.

Themes

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 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/.
if [ -n "$GTK_MODULES" ]; then
    GTK_MODULES="$GTK_MODULES:unity-gtk-module"
else
    GTK_MODULES="unity-gtk-module"
fi

export GTK_MODULES
export UBUNTU_MENUPROXY=1

Dependencies

  • appmenu-qt
  • gir1.2-gtk-3.0
  • mate-desktop
  • python3
  • python3-dbus
  • 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:

Compatibility

Compatibility may depend on your environment's compatability with the rofi package, which means environments using Wayland (e.g. Ubuntu 21.04) may not work (see related rofi issue).

mate-hud's People

Contributors

evacks avatar fitojb avatar flexiondotorg avatar jamcnaughton avatar jwhitbeck avatar mcdonc avatar rafaelbocquet avatar seltzered avatar twa022 avatar vkareh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mate-hud's Issues

mate-hud in vlc (3.0.3)

So... vlc on kde neon 5.14.1 crashes every time mate-hud is issued. Minimal interface or not 👌

Becomes excruciatingly slow after runnig for a while

I don't really know if this is caused by it running for a while or some other bug, but it did work pretty quickly before (and I assume it will do so after restart). I'm using the HUD in a fresh Ubuntu Mate 18.04 install and the global menu seems to crash now and then. At the moment mate-hud seems to be incredibly slow. Every time I now hit Alt it seems to take about 11 seconds for it to show up the rofi menu.

Will this work in GTK4?

Hello, a lot of non-mate users still love this app as it is very useful. I would just like to know if this will work with GTk4 apps?

Use ▸ instead of » to separate menu levels in the HUD

This would be desirable in Romance languages like Catalan, Spanish and French, where we use guillemets as our first-level quotation marks, not as decorative arrows like in English. Both kind of usages can clash: for example, in French LibreOffice this menu item exists:

Éditer » Annuler : Insérer un tableau « Tableau 1 »

Here it’d be desirable to use another character as separator:

Éditer ▸ Annuler : Insérer un tableau « Tableau 1 »

This is the same character used in some areas in LibreOffice (guidelines), as well as in the Mallard help system.
Captura desde 2022-04-10 18-51-19
Captura desde 2022-04-10 18-56-37

The RTL version of ▸ is U+25C2 ◂

Migrate to Python 3

MATE Menu is written using Python 3. It would be beneficial to migrate it to Python 3 so only one Python interpreter is present on the live image, therefore making the iso smaller.

Mate HUD passing wrong DPI to rofi

@flexiondotorg
I see in commit 41d5de27e41b16a3f03e76648b7ca7293f5a36c5 you reverted to using the get_dpi function to calculate the DPI passed to rofi instead of using screen.get_resolution(). (gdk_screen_get_resolution)

Was there an instance where screen.get_resolution() was returning the wrong DPI and the get_dpi() function was returning the correct info?

Because for me get_dpi() returns 96.xxx (which would be the correct default DPI for my screen), but I have it overridden to 112. screen.get_resolution() returns the correct 112. If I disable the override and just use the default, both return 96 as expected. So I think the get_dpi() function doesn't do anything to catch custom DPI.

license issue: mention original Expat/MIT licensing

This project has been forked from i3-hud-menu which is Expat licensed. The mate-hud project has been re-licensed under GPL-2+.

Thus, the file usrlib/mate-hud/mate-hud needs an additional reference to the Expat MIT license as some portions of the file may still be in their original (pre-fork) state.

The GPL-2+ license in cases like this only apply to the code changes committed after the fork.

Overall, re-licensing an Expat code project as GPL-2+ is possible and the effective license will then also be GPL-2+. However, code-documentation-wise the file contains code fragments that either Expat or GPL-2+ applies to.

In debian/copyright, I will list the mate-hud file like this:

Files: usr/lib/mate-hud/mate-hud
Copyright: 2016-2018, Martin Wimpress <[email protected]>
          2015, JAMcNaughton
          2014, Rafaël Bocquet
License: GPL-2+ and Expat
Comment:
Copyright information obtained from upstream VCS log.
.
Project has originally been forked from i3-hud-menu
which is Expat-licensed.

In fact, mate-hud doesn't have a license header at all, so it would be good putting copyright years+holders, a copy of the GPL-2+ short form and a copy of the Expat license [1] to the file's header.

[1] https://github.com/jamcnaughton/hud-menu/blob/master/LICENSE

Feature: Populate HUD with dbus commands for GTK3 apps

GTK3 apps are increasingly common and they've dispensed with the traditional menus. This means that the HUD relying on appmenu modules will become increasingly obsolete.

However, you can still search the application functionality is still exposed via dbus and one developer has already made a HUD for these apps called Plotnus. It would be nice if this was integrated into Mate-Hud.

[ Feature Request ] Also display Keyboard Shortcuts

Thanks Guys! Really enjoy the HUD! Made work so much more faster and efficient.

Was wondering if it is also possible to Display the Assigned Keyboard Shortcut. as displayed in the normal menu.

Sorry not a Python Programmer (yet).

Peace!

mate-hud will not launch in openbox

Running archlinux / mate-hud from master
When trying to run mate-hud on openbox:

❯ /usr/lib/mate-hud/mate-hud 
Traceback (most recent call last):
  File "/usr/lib/mate-hud/mate-hud", line 19, in <module>
    if 'XFCE' in os.environ['XDG_CURRENT_DESKTOP']:
  File "/usr/lib/python3.10/os.py", line 679, in __getitem__
    raise KeyError(key) from None
KeyError: 'XDG_CURRENT_DESKTOP'

Hud shortcut messes with IntelliJ shortcuts

Hi there,

The hud shortcut messes with IntelliJ shortcuts.

I have mitigated this by changing the shortcut to the right alt by running the following on the terminal:

~ gsettings get org.mate.hud shortcut 'Alt_L' ~ gsettings set org.mate.hud shortcut Alt_R ~ gsettings get org.mate.hud shortcut 'Alt_R'

Not sure why the hud on Ubuntu doesn't have this issue.

Thanks for working on ubuntu mate - my favourite distribution since Unity was removed from Ubuntu 17.10!
Keep up the good work.

mate-hud in plasma

$ python3 /usr/lib/mate-hud/mate-hud 2>&1 | tee -a ~/Desktop/mate-hud.log

Gtk-Message: 20:53:18.893: Failed to load module "/home/raitaro/appmenu-gtk-module"
(mate-hud:7244): Gtk-WARNING **: 20:53:18.897: Theme parsing error: gtk.css:68:35: The style property GtkButton:child-displacement-x is deprecated and shouldn't be used anymore. It will be removed in a future version
(mate-hud:7244): Gtk-WARNING **: 20:53:18.897: Theme parsing error: gtk.css:69:35: The style property GtkButton:child-displacement-y is deprecated and shouldn't be used anymore. It will be removed in a future version
(mate-hud:7244): Gtk-WARNING **: 20:53:18.898: Theme parsing error: gtk.css:73:46: The style property GtkScrolledWindow:scrollbars-within-bevel is deprecated and shouldn't be used anymore. It will be removed in a future version
Gtk-Message: 20:53:18.918: Failed to load module "appmenu-gtk-moduleppmenu-gtk-module"
INFO:root:Press <Alt>space to handle keybinding
[1]    7244 terminated  python3 /usr/lib/mate-hud/mate-hud 2>&1 |
7245 done        tee -a ~/Desktop/mate-hud.log

Right there mate-hud crashed... that is the menu was not displayed, and the Alt key kept being active thus making any keyboard input... kinda impossible (tty works though). And in my case Alt plus mouse means move or resize or transparency (wheel) so... yeah, tty + htop kill is the only way to get this to behave.

Cache results and / or ignore subtrees with thousands of elements

It seems like mate-hud recreates the whole menu tree (instead of caching it) every time. For example, in Firefox it takes about 10 seconds after pressing Alt for the HUD to show up. I think the most likely reason is that in my and likely many cases the menu item Bookmarks > Bookmarks Toolbar contains thousands of elements. If the results were cached and / or huge subtrees ignored, the HUD should be able to pop up immediately.

Dulplicate menu bar

Instead of this:
Screenshot at 2019-05-20 22-38-44
I want something like this:
Screenshot at 2019-05-20 22-46-21

Or how to disable in application menubar for all programs?

Feature: opt-in predictive results like unity and/or "pinned" commands?

I think the HUD interface is eventually going to need some kind of way to store preferences per application, both to get around bugs and to add new functionality (like custom commands).

One idea would be to allow the user to store previous selections for predictive HUD search, or to allow the pinning of certain commands. This makes a great difference in productivity because it allows you to type just one or two letters and hit enter to do to where you need.

HUD should be activated via a single press of the ALT key

This is MATE HUD, which provides a way to run menubar commands through rofi, much like the Unity 7 Heads-Up Display (HUD). It should feature in Ubuntu MATE 17.10 soon.

However, to activate it I'm using keybinder 3.0 and the Ctrl + Alt + Space binding. The Unity 7 HUD is activated via a single press of the Alt key, much like how Super key works. Would you be interested in take a look to see if MATE HUD can be update to support activation via release of the Alt key with no other keys having been pressed while Alt was depressed?

You can test on a VM running Ubuntu MATE 17.10 daily.

  • Install Ubuntu MATE 17.10 daily in a VM.
  • Add the Global Menu PPA and install mate-applet-appmenu
    • sudo apt-add-repository ppa:ubuntu-mate-deb/global-menu
    • sudo apt update
    • sudo apt install mate-hud mate-applet-appmenu
  • Reboot.

@vkareh Given you recent involvement I wondered if you might be able to take a look at this?

Feature: allow the HUD menu to be easily extended with custom context-aware commands.

Let's say you are in an application and have some scripts that are relevant to that application. The user, developer, or packager can add these custom commands to the HUD for that particular application (or set of applications), which become searchable just like any other menu item.

(may also be a good idea to add this to the mate-appmenu applet)

The result would be an customizable and searchable command pallete (like "emacs-helm") for the entire desktop.

Only activate the HUD if Alt was tapped rather than a long hold

I've noticed the HUD is activated if Alt is long held, which means it is sometimes activated when I don't want it.

The original Unity 7 HUD implementation only reveals the HUD if the Alt key is tapped. @vkareh Is it possible to include a timer to Alt press and only activate the HUD if the Alt key has been pressed for less than, say, 100ms?

mate-hud crashed with TypeError in hud(): 'NoneType' object is not subscriptable

This is the first time I've faced a mate-hud crash. Below are relevant lines from the .crash file:

Title: mate-hud crashed with TypeError in hud(): 'NoneType' object is not subscriptable
Uname: Linux 4.15.0-34-generic x86_64
ProblemType: Crash
Date: Sun Sep 30 13:45:00 2018
ExecutablePath: /usr/lib/mate-hud/mate-hud
ExecutableTimestamp: 1522399569
ProcCmdline: mate-hud
PythonArgs: ['/usr/lib/mate-hud/mate-hud']
Traceback:
 Traceback (most recent call last):
   File "/usr/lib/mate-hud/mate-hud", line 445, in hud
     window_id = hex(ewmh._getProperty('_NET_ACTIVE_WINDOW')[0])
 TypeError: 'NoneType' object is not subscriptable
UserGroups: adm cdrom dialout dip lpadmin netdev plugdev sambashare sudo vboxusers
_LogindSession: c2
ApportVersion: 2.20.9-0ubuntu7.4
Architecture: amd64

Seems like None is getting returned through _NET_ACTIVE_WINDOW in the hud() function of mate-hud.

Distro version
Ubuntu MATE 18.04.1

If any other info is required, I'd be happy to investigate more...

"Unable to access dbusmenu items."

hi,

so I wanted to give mate-hud a try, but I can't seem to get it to work:

$ /usr/lib/mate-hud/mate-hud 
Gtk-Message: 15:58:05.384: Failed to load module "appmenu-gtk-module"
INFO:root:Press Alt_R to handle keybinding
INFO:root:Unable to access dbusmenu items.
INFO:root:Unable to access dbusmenu items.
INFO:root:Unable to access dbusmenu items.
INFO:root:Unable to access dbusmenu items.

is all I'm getting.

I'm on mint linux, using cinnamon, so I wasn't sure if it's because mate-hud only works with mate or not.

Crashes when invoked on calibre

When attempting to summon the HUD in a Calibre window (either the main book list or the book editor), the following traceback is generated from an error. Later, apport pops up with its complaint. (And the HUD doesn't work in Calibre, of course, given the error.)

Traceback (most recent call last):
  File "/usr/lib/mate-hud/mate-hud", line 464, in hud
    appmenu_success = try_appmenu_interface(int(window_id, 16))
  File "/usr/lib/mate-hud/mate-hud", line 299, in try_appmenu_interface
    expanse_all_menu_with_dbus(dbusmenu_root_item[1], True, "")
  File "/usr/lib/mate-hud/mate-hud", line 277, in expanse_all_menu_with_dbus
    dbusmenu_object_iface.AboutToShow(item_id)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.AttributeError: Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/utils/dbus_service.py", line 924, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/lib/calibre/calibre/gui2/dbus_export/menu.py", line 349, in AboutToShow
    return self.menu.handle_about_to_show(ac)
  File "/usr/lib/calibre/calibre/gui2/dbus_export/menu.py", line 268, in handle_about_to_show
    ac.menu().aboutToShow.emit()
AttributeError: 'ExportedMenuBar' object has no attribute 'aboutToShow'

Global menus switch to local menus when hud is used

With a fresh and updated install of Ubuntu MATE 19.04 and the contemporary preset, using the hud turns the global menu into a local menu and moves it into the respective window.

Please let me know if you need any version/config information or logs.

Instructions on how to use mate-hud

mate-hud is now on Ubuntu repositories (and probably on Debian and others distros), so it can be easily installed by something like apt install mate-hud. But how one can use it?
For example I'm on i3wm, I open a terminal and run:

GTK_MODULES="$GTK_MODULES:unity-gtk-module"
export $GTK_MODULES
export UBUNTU_MENUPROXY=1

Then from terminal I open a program (for example openoffice) and (1) the old menus are still there, and (2) I still can't figure out how to trigger the HUD to search for a menu entry.

Using with XFCE, how to style it?

I managed to integrate it with my XFCE desktop but I do not know how to make it use the default theme styling. Or can I style it manually? Thanks!

mate-hud is causing a complete input deadlock

@vkareh After some more thorough testing mate-hud 18.04.0 is causing a complete input lock up for keyboard and mouse.

This can be reproduced using mate-hud from git master on Ubuntu MATE 18.04 with a layout activated that uses the Global Menu, such as Mutiny, Cupertino or Contemporary. I was able to create the deadlock by invoking things that required Alt, such as Alt + PrtScn or Ctrl + Alt +t. It doesn't happen 100% of the time but after a few uses of Alt the lock up happens. The only recourse is to switch to a vt and kill mate-hud then switch back to the desktop vt.

The best way to test this is using the Ubuntu MATE 18.04 daily live image on actual hardware and replacing mate-hud with the version in git master.

Reverting this patch resolves the issue:

So I will publish a new .deb that reverts that commit via patch for the time being 😄

Put simple widgets into the HUD

The HUD is reliant on the presence of the Global Menu, which is less than ideal. What if clickable menus and buttons were integrated into the HUD? You'd probably have to move to GTK+ or QT to do this.

Mockups here: https://medium.com/@leftcrane/gui-hud-using-global-menu-features-hacks-572760272168

Further note:
If the HUD is extensible enough and implements KDE's DWD protocol, it could also display much more than just menu items even. In combination with server-side headerbars it could finally bring consistency to most Linux apps. (details here: https://medium.com/@leftcrane/unity-headers-concept-using-server-side-hearderbars-to-create-a-consistent-customizable-and-fbdb0d9696c)

(I am confident that there is a big need for such a project and that many users would donate money to get a good solution.)

Where are the HUD Settings stored?

I cannot find where the /usr/lib/mate-hud/hud-settings.py are stored for a user. I cannot find in the home directory any folder/file that might store them. Any help please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.