Awesome-menu in Awesome Window Manager

Awesomewm50.png

In awesome 2.3, there’s a menu mechanism. There’s two sections to the menu, the first is the command being ran, and the rest of the bar is the menu. The first portion can take input from stdin, so any command can be typed there instead of using a menu option.

To add a list of items to the menu, you can cat a file of contents to it as shown in the following:

~/.awesome/menu contents:

 xterm
 firefox
 pidgin

Then add this to your .awesomerc:

 key {
   modkey = {"Mod4"}
   key = "p"
   command = "spawn"
   arg = "exec `cat ~/.awesome/menu | awesome-menu 'Run:'`"
 }

Or, another alternative, which displays everything in /usr/bin as a menu:

 key {
   modkey = {"Mod4"}
   key = "p"
   command = "spawn"
   arg = "ls /usr/bin | awesome-menu -e 'exec ' 'Run:'"
 }

Or, you can display everything in $PATH as a menu with dmenu script

 key {
   modkey = {"Mod4"}
   key = "p"
   command = "spawn"
   arg = "dmenu_path | awesome-menu -e 'exec ' 'Run:'"
 }

PS If you dont have dmenu installed, there is dmenu_path script

#!/bin/sh
CACHE=$HOME/.dmenu_cache
IFS=:
uptodate() {
test ! -f $CACHE && return 1
for dir in $PATH
do
      test $dir -nt $CACHE && return 1
done
return 0
}
if ! uptodate
then
       for dir in $PATH
       do
               for file in "$dir"/*
               do
                       test -x "$file" && echo "${file##*/}"
               done
       done | sort | uniq > $CACHE.$$
       mv $CACHE.$$ $CACHE
fi
cat $CACHE

[edit] Stylizing awesome-menu

The awesome-menu stylized using the .awesomerc. When calling awesome-menu, a label can be defined, and awesome-menu uses this to stylize the menu.

 menu Run:
 {
   styles
   {
       normal {
         bg = "#0a0a0a"
         fg = "#a0a0a0"
         shadow = "#111111"
         shadow_offset = "1"
       }
       focus {
         bg = "#285577"
         fg ="#ffffff"
         shadow = "#111111"
         shadow_offset = "1"
       }
   }
   y = "0"
   x = "180"
   height = "14"
 }

[edit]

Related Posts

Comments are closed.