summaryrefslogtreecommitdiff
path: root/content/resources/mymenu.lua
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2014-10-04 16:59:06 +0200
committerSébastien Dailly <sebastien@chimrod.com>2014-10-04 16:59:06 +0200
commit2c3cf5179f16e8303ece57e3dbb191a46f3dcb85 (patch)
tree3d4ea31cd91388149ba43d3c8698c90532a51a59 /content/resources/mymenu.lua
parent19e71ce6cd7ca7540e0e004d180998e051c57402 (diff)
Moved resources to the blog site
Diffstat (limited to 'content/resources/mymenu.lua')
-rw-r--r--content/resources/mymenu.lua67
1 files changed, 67 insertions, 0 deletions
diff --git a/content/resources/mymenu.lua b/content/resources/mymenu.lua
new file mode 100644
index 0000000..b3e5be4
--- /dev/null
+++ b/content/resources/mymenu.lua
@@ -0,0 +1,67 @@
+-- Menu d'application
+
+local awbeautiful = require("beautiful")
+local awful = require("awful")
+local capi = {
+ screen = screen,
+}
+
+local function getStickyIcon(client)
+ if client.sticky then
+ return awbeautiful.get().titlebar_sticky_button_focus_active
+ end
+ return awbeautiful.get().titlebar_sticky_button_focus_inactive
+end
+
+local function getOnTopIcon(client)
+ if client.ontop then
+ return awbeautiful.get().titlebar_ontop_button_focus_active
+ end
+ return awbeautiful.get().titlebar_ontop_button_focus_inactive
+end
+
+function newAppMenu(client)
+ local data = {}
+ local myAppMenu = {}
+
+ local args = {}
+ args.keygrabber = true
+
+ -- Insert the ontop entry
+ -- When onTop is selelected, set in floating mode too
+ table.insert(myAppMenu, {"On Top", function()
+ -- We do not use floating.togle() but syncronize the floating on top value
+ awful.client.floating.set( client, not client.ontop )
+ client.ontop = not client.ontop
+ end , getOnTopIcon(client)} )
+
+ -- Insert the Sticky entry
+ table.insert(myAppMenu, {"Sticky", function() client.sticky = not client.sticky end , getStickyIcon(client)} )
+
+ -- Insert the Hide entry
+ if not client.minimized then
+ table.insert(myAppMenu, {"Minimize", function() client.minimized = true end } )
+ end
+ table.insert(myAppMenu, {"Close", function() client:kill() end, awbeautiful.get().titlebar_close_button_focus } )
+
+ -- Add the move to tag entry
+ local moveToTag = {}
+ local tags = capi.screen[1]:tags()
+ for i = 1, #tags do
+ -- We do not show the curent client tags
+ local isInTag = false
+ local clientTag = tags[i]:clients()
+ for j = 1, #clientTag do
+ isInTag = isInTag or clientTag[j] == client
+ end
+ if not isInTag then
+ table.insert(moveToTag, {tags[i].name, function() awful.client.movetotag(tags[i], client) end } )
+ end
+ end
+ table.insert(myAppMenu, {"Move To", moveToTag } )
+
+ data.menu = awful.menu.new( { items = myAppMenu} )
+ data.menu:show(args)
+
+ return data
+end