Giter VIP home page Giter VIP logo

hud-menu's Introduction

hud-menu

Provides a way to run menubar commands through a searchable list.

Dependencies

  • python-dbus
  • rofi (or alternatively: dmenu)
  • appmenu-qt
  • unity-gtk-modules
    • Some systems may need unity-gtk-module-standalone-bzr installed instead.
      • If using the bzr packge you may need to set com.canonical.unity-gtk-module gtk2-shell-shows-menubar to false under dconf.

Setup

  1. hud-menu-service.py should be started (with python 3+) on the session's startup.

  2. The following should be added to the user's .profile:

    if [ -n "$GTK_MODULES" ]
    then
      GTK_MODULES="$GTK_MODULES:unity-gtk-module"
    else
      GTK_MODULES="unity-gtk-module"
    fi
    
    if [ -z "$UBUNTU_MENUPROXY" ]
    then
      UBUNTU_MENUPROXY=1
    fi 
    

    You can also add export APPMENU_DISPLAY_BOTH=1 to this file on some distributions to show the menubar in apps that may otherwise hide it when the hud-menu-service is running.

  3. hud-menu.py should be bound to run (with python 3+) with a shortcut (such as a keyboard shortcut).

Usage

The user should active the shortcut when the window they wish to show the application menu entries for has focus. This will open the dmenu at the top. The user can then use the keyboard to search and navigate the entries. Pressing enter will execute the selected entry and pressing escape will close the dmenu without executing anything.

Explanation

hud-menu-service.py is an implementation of the com.canonical.AppMenu.Registrar DBus service. Applications exporting their menu through dbusmenu need this service to run. hud-menu.py tries to get the menu of the currently focused X11 window, lists possible actions and asks the user which one to run.

Using dmenu in place of rofi

If you wish to use dmenu in place of rofi ensure all calls to hud-menu.py (shortcuts and bindings) supply dmeny as an argument.

Warning

Installation of unity-gtk-modules may disable the global-menu on some distributions as its constituent packages conflict with those the menus may depend on. This is very problematic for applications that can't support the hud-menu like FireFox and Libreoffice.

hud-menu's People

Contributors

jamcnaughton avatar rafaelbocquet 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  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  avatar

hud-menu's Issues

[Feature] Feed synapse launcher

Thanks for your brilliant script, it is extremelly useful. However, it would be a complete killer if it would integrate into synapse. Is this possible? The guys out on synapse resist to put their project into github, but I suspect it would be relatively easy to add it as a plugin.

IndexError: list index out of range

When I run i3-hud-menu.py I get this error

Window id is : 0x1400007
Traceback (most recent call last):
  File "./i3-hud-menu.py", line 168, in <module>
    try_gtk_interface(gtk_bus_name_cmd, gtk_object_path_cmd)
  File "./i3-hud-menu.py", line 81, in try_gtk_interface
    gtk_bus_name = gtk_bus_name_cmd.split(' ')[2].split('\n')[0].split('"')[1]
IndexError: list index out of range

Service is running in the background and .profile is set according to documentation.

Rofi is good, but different too.

Hi. I use dmenu with a nice font for many things in my i3 setup, so when you guys changed into rofi, it made it the hud stand out. I just reverted back to dmenu locally, but I would also like to suggest that maybe making it into an option could interest other people too.

Thanks for sharing this great piece of software!

Libre-office: Can open dmenu and search menu items, but not execute action

Environment:
Linux Mint XFCE x86
Python 3.4.3
LibreOffice 5.0.3.2 00m0(Build:2)

steps to reproduce:

  1. while libreoffice (for example libreoffice-writer) is focused, invoke the hud menu
  2. select an action from the list
  3. press enter

expected behavior:
the selected action is run

actual behavior:
libreoffice does not execute the selected menu item action

errors encountered:

jard@jard-VirtualBox ~ $ sleep 3 && python3 ~/applications/i3-hud-menu.py
(user switching focus to libreoffice writer and selecting action)
ERROR:dbus.connection:Unable to set arguments ('win..uno:Cut', [], {}) according to signature None: <class 'ValueError'>: Unable to guess signature from an empty list
Traceback (most recent call last):
File "/home/jard/applications/i3-hud-menu.py", line 181, in
try_gtk_interface(gtk_bus_name_cmd, gtk_object_path_cmd)
File "/home/jard/applications/i3-hud-menu.py", line 158, in try_gtk_interface
gtk_action_object_actions_iface.Activate(action.replace('unity.', ''), [], dict())
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in call
**keywords)
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 641, in call_blocking
message.append(signature=signature, *args)
ValueError: Unable to guess signature from an empty list

further information

I consider this issue especially severe, because libreoffice detects that an external menu us being used and hides the normal menubar. I know of no way to restore the menubar in libreoffice

Mozilla Apps (firefox and thunderbird): cannot use the hud-menu at all

Environment
Linux Mint XFCE x86
Python 3.4.3
Mozilla Firefox 46.0.1
Thunderbird 38.8.0

upon invoking the Hud-menu, the hud menu is not opened.
errors, logs:

jard@jard-VirtualBox ~ $ sleep 3 && python3 ~/applications/i3-hud-menu.py 
Traceback (most recent call last):
  File "/home/jard/applications/i3-hud-menu.py", line 181, in <module>
    try_gtk_interface(gtk_bus_name_cmd, gtk_object_path_cmd)
  File "/home/jard/applications/i3-hud-menu.py", line 143, in try_gtk_interface
    head, *tail = dmenuKeys
ValueError: need more than 0 values to unpack

thus, hud-menu cannot be used with firefox or thunderbird.
known workarounds
access the menus the old fashioned way. in thunderbird, do this through the hamburger/application menu.
in firefox, set the about:config setting ui.use_unity_menubar to false to display the menu bar and use it the old fashioned way.

xubuntu with i3wm - dmenu list with options is shown but non is executed

Environment:

Xubuntu 14.04
Python 3.4.3
i3wm (i3 version 4.12.31)

Environment Setup:

I use xfce4 environment for which I disabled xfwm4, xfdesktop and replaced them with i3

Issue:

For applications eg.: google-chrome, thunar, gimp, available menu entries are shown via dmenu. But no one is executed upon selection.

When I debug the i3-hud-menu.py script, it falls back to line try_gtk_interface

Neither error or warning is thrown.

I would be more then willing to debug the issue further, however I would need help with what I should look for, 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.