awesome/my.lua
changeset 15 73df43769340
parent 14 6348b9f842b2
child 17 171cba5d3e3a
--- a/awesome/my.lua	Sun Sep 13 14:47:26 2015 -0400
+++ b/awesome/my.lua	Sun Sep 13 22:53:18 2015 -0400
@@ -91,15 +91,6 @@
    awesome.quit()
 end
 
-function show_clients()
-   if instance then
-      instance:hide()
-      instance = nil
-   else
-      instance = awful.menu.clients({width=250})
-   end
-end
-
 local function widgets_cpu()
    local w = awful.widget.graph()
    -- Graph properties
@@ -185,7 +176,26 @@
    decorated = widgets_decorated,
 
 }
+
+function split_modifiers(key)
+   local modifiers = {}
+   local pattern = capi.string.format("([^+]+)", sep)
+   key:gsub(pattern, function(mod) table.insert(modifiers, mod) end)
+   key = table.remove(modifiers)
+   return modifiers, key
+end
+
+function normalize_key(k)
+   mods, key = split_modifiers(k)
+   if #mods > 0 then
+      table.sort(mods)
+      k = table.concat(mods, "+") .. "+" .. key
+   end
+   return k
+end
+   
 function make_key(k, n, f)
+   k = normalize_key(k)
    return { key = k, name = n, func = f}
 end
 
@@ -193,7 +203,11 @@
    if f == nil then
       log("name: " .. n .. " is nil", 3)
    end
-   return make_key(k, n, function (c) f(c); return true ; end)
+   return make_key(k, n, function (c) f(c); return false ; end)
+end
+
+function make_interactive_key(k, n, f)
+   return make_key(k, n, function (c) f(c); return true; end)
 end
 
 function show_kt(keytable, title)
@@ -225,7 +239,7 @@
       end
    end
    skey = skey .. (keynames[key] or key)
-   return skey
+   return normalize_key(skey)
 end
 
 local function kt_handler(keytable, mod, key, event)
@@ -237,7 +251,7 @@
       return false
    end
    local skey = capi.string.lower(translate_key(mod, key))
-   if skey == "control+h" or skey == "shift+?" then
+   if skey == "control+h" or skey == "shift+?" or skey == "f1" then
       show_kt(keytable, "Current binding")
       return true
    end
@@ -300,14 +314,6 @@
       return true
    end
 end
-
-function split_modifiers(key)
-   local modifiers = {}
-   local pattern = capi.string.format("([^+]+)", sep)
-   key:gsub(pattern, function(mod) table.insert(modifiers, mod) end)
-   key = table.remove(modifiers)
-   return modifiers, key
-end
       
 function make_globalkeys(modifiers, keytable)
    local t = {}