Menubar
Menubar has got pushed to Awesome repository! If you use awesome built from git then please refer to this article.
This page describes the installation and configuration of Menubar for Awesome v.3.4.X.
Contents |
Description
Menubar is a dmenu-like applications menu extension for Awesome.
Awesome certainly lacks a nice menu widget out of the box. Default debian.menu works only on Debian and is not very fancy. Another option is freedesktop.menu that parses directories for .desktop files and generates the menu from them. Still it is not fully keyboard-centric (which is controversial to Awesome ideology).
Menubar uses the same data source as freedesktop.menu (it actually uses freedesktop's code under the hood). After a hotkey is pressed menu appears that contains all categories (defined in menu_gen.lua) and all applications. Typing the text will filter the entries in a way similar to dmenu - first come the entries which names match the text from the beginning, after them come entries that match the text in the middle of their names.
You can also go inside the category by hitting Return on it. This will result in menubar showing only application from the selected category.
How to start
- First you need to download the widget itself. You can clone the latest copy from https://github.com/alexander-yakushev/menubar .
Also you can download the tarball directly: https://github.com/alexander-yakushev/menubar/tarball/master
- Create a new folder called "menubar" in your ~/.config/awesome/ folder. Copy the downloaded files (init.lua. menu_gen.lua, prompt.lua, utils.lua) into it (so they become ~/.config/awesome/awesompd/init.lua etc.).
- Open your rc.lua file and add these lines:
require("menubar")
menubar.cache_entries = true
menubar.app_folders = { "/usr/share/applications/" }
menubar.show_categories = true -- Change to false if you want only programs to appear in the menu
menubar.set_icon_theme("theme name")
You should also add a key combination to trigger the menu. Find the place in rc.lua where the globalkeys are defined and add this line:
awful.key({ modkey }, "s", function () menubar.show() end),
Caching
Walking through all files in the shortcut directories can take a noticeable amount of time (it takes up to 1 second on my machine). That may be rather annoying if you use menubar often (and on slower machines it can be even longer), so the entries caching option is enabled by default. It means that when launched the first time menubar parses .desktop files and keeps them in memory. This makes the consequent uses of menubar instant. The drawback is that you need to update menubar manually when new software is installed. You can do this by calling menubar.refresh() from Run Lua code prompt (Modkey-X by default).
Controls
- Left/Right or Control-J/K - move through entry list
- Return - launch highlighted application or enter the highlighted category
- Escape - exit category (if inside one) or close the menubar
- Backspace - if no text is entered exit the category
All other key combinations are the same as in awful.util.prompt.
Customization
You can change the category list by editing menu_gen.lua. Each category is a table with the following fields:
- name - how the category would be displayed
- app_type - the category name that appears in Category tag in .desktop files
- icon - icon of the category, could be either a full path to the file or just the name of the file to be found in default icon folders (like /usr/share/icons/)
- use - if false, the category (and all applications from it) will be ignored
You can use a few lines like below to change names without editing menu_gen.lua (the example is hungarian).
local menubar_change = {
AudioVideo = "Média",
Development = "Fejlesztés",
Education = "Oktatás",
Game = "Játékok",
Graphics = "Grafika",
Office = "Iroda",
Network = "Hálózat",
Settings = "Beállítások",
System = "Rendszer",
Utility = "Eszközök",
}
for i,j in ipairs(menubar.menu_gen.all_categories) do
menubar.menu_gen.all_categories[i].name =
menubar_change[j.app_type] or j.name
end
You can change where popups the menubar and menubar's size too:
menubar.g = {
height = 30,
width = 600,
x = 0,
y = 700
}