From 207f4152e2b8b090b808e07f5fc815b1ca844da9 Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 24 Sep 2017 23:09:37 +0200 Subject: Help popup --- rc.lua | 228 ++++++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 177 insertions(+), 51 deletions(-) (limited to 'rc.lua') diff --git a/rc.lua b/rc.lua index fbc54f9..c533ddf 100644 --- a/rc.lua +++ b/rc.lua @@ -12,6 +12,7 @@ local vicious = require("vicious") local menubar = require("menubar") awful.screen = require("awful.screen") +local hotkeys = require("awful.hotkeys_popup") local hotkeys_popup = require("awful.hotkeys_popup").widget @@ -399,26 +400,130 @@ function showHide() end +function show_awesome_help() +--[[ + for group_name, group_data in pairs({ + ["URxvt"] = { color="#659FdF", rule_any=urxvt_rule_any, hide_others=true }, + ["ZSH"] = { color="#cF4F40", rule_any=urxvt_rule_any, hide_others=true } + }) do + hotkeys_popup.group_rules[group_name] = group_data + end + hotkeys_popup.group_rules["client"] = nil + hotkeys_popup.group_rules["launcher"] = nil + hotkeys_popup.group_rules["tag"] = nil + + local vim_keys = { + ["tag"] = { } + } +--]] + local test = hotkeys.widget:new() + +--[[ +local urxvt_keys = { + ["URxvt"] = { + { + modifiers = { "Mod1" }, + keys = { + c = "copy", + v = "Paste" + } + }, + { + modifiers = {"Mod1", "Shift"}, + keys = { + v = "Paste escaped" + } + } + }, + ["ZSH"] = { + { + modifiers = {}, + keys = { + Home = "Beginning of line", + End = "End of line", + Insert = "Overwrite mode", + Delete = "Delete char", + Left = "Backward char", + Right = "Forward char", + Prior = "Beginning of buffer or history", + Next = "End of buffer or history", + } + }, + { + modifiers = { "Mod1" }, + keys = { + Down = "Beginning of line", + Up = "End of line", + Left = "Backward word", + Right = "Forward word" + } + }, + { + modifiers = { "Control" }, + keys = { + k = "Kill whole line", + l = "clear screen" + } + } + }, + ["tag"] = { + { + modifiers = {}, + keys = { + Home = "Beginning of line", + End = "End of line", + Insert = "Overwrite mode", + Delete = "Delete char", + Left = "Backward char", + Right = "Forward char", + Prior = "Beginning of buffer or history", + Next = "End of buffer or history", + } + }, + { + modifiers = { "Mod1" }, + keys = { + Down = "Beginning of line", + Up = "End of line", + Left = "Backward word", + Right = "Forward word" + } + }, + { + modifiers = { "Control" }, + keys = { + k = "Kill whole line", + l = "clear screen" + } + } + }, + +} + test:add_hotkeys(urxvt_keys) + --]] + test:show_help(test) +end + + layoutKkb = 1 + -- {{{ Key bindings globalkeys = awful.util.table.join( - awful.key({ modkey, "Shift" }, "s", hotkeys_popup.show_help, - {description="show help", group="awesome"}), - awful.key({ modkey, }, "Escape", awful.tag.history.restore, - {description = "go back", group = "tag"}), +awful.key({ modkey, "Shift" }, "s", show_awesome_help , {description="Show help", group="awesome"}), + awful.key({ modkey, }, "Escape", awful.tag.history.restore --[[, {description = "go back", group = "tag"} --]]), -- Layout manipulation awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, - {description = "swap with next client by index", group = "client"}), + {description = "Swap with next client by index", group = "client"}), awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end, - {description = "swap with previous client by index", group = "client"}), + {description = "Swap with previous client by index", group = "client"}), awful.key({ modkey, }, "u", awful.client.urgent.jumpto, - {description = "jump to urgent client", group = "client"}), + {description = "Jump to urgent client", group = "client"}), @@ -437,27 +542,37 @@ globalkeys = awful.util.table.join( awful.key({ }, "XF86AudioPrev", function () awful.util.spawn("mpc prev") end), awful.key({ modkey}, "F1", function () - awful.util.spawn("roxterm -e bash -c \"mpd;mpc random on;mpc repeat on;ncmpcpp\"") end), + awful.util.spawn("roxterm -e bash -c \"mpd;mpc random on;mpc repeat on;ncmpcpp\"") end, + {description = "MPD", group = "awesome"}), awful.key({ modkey}, "F2", function () - awful.util.spawn("roxterm -e mutt") end), + awful.util.spawn("roxterm -e mutt") end, + {description = "mutt", group = "awesome"}), - awful.key({ modkey, "Mod1"}, "f", function () awful.util.spawn("firefox") end), + awful.key({ modkey, "Mod1"}, "f", function () awful.util.spawn("firefox") end, + {description = "Firefox", group = "awesome"}), awful.key({ modkey, }, "t", function () awful.util.spawn("uzbl-browser") end), -- awful.key({ modkey, }, "b", function () awful.util.spawn("vimb -c /usr/share/vimb/.vimbrc") end), awful.key({ modkey, "Mod1"}, "t", function () awful.util.spawn("proxychains uzbl-browser") end), awful.key({ modkey, "Mod1"}, "b", function () awful.util.spawn("proxychains vimb -c /usr/share/vimb/.vimbrc http://duckduckgo.com") end), awful.key({ modkey, "Mod1"}, "q", function () awful.util.spawn("uzbl-browser http://duckduckgo.com > /dev/null") end), - awful.key({ modkey, "Mod1"}, "r", function () awful.util.spawn_with_shell("xterm -e 'ranger'") end), + awful.key({ modkey, "Mod1"}, "r", function () awful.util.spawn_with_shell("xterm -e 'ranger'") end, + {description = "Ranger", group = "awesome"}), awful.key({ modkey, "Control"}, "r", function () awful.util.spawn("pcmanfm") end), awful.key({ modkey, "Mod1"}, "v", function () awful.util.spawn("gvim") end), - awful.key({ modkey, }, "s", function () awful.util.spawn("scrot") end), - awful.key({ modkey, "Control" }, "s", function () awful.util.spawn("scrot -u") end), - - - awful.key({ modkey, }, "Left", awful.tag.viewprev ), - awful.key({ modkey, }, "Right", awful.tag.viewnext ), - awful.key({ modkey, "Control" }, "Left", function() awful.screen.focus_relative(-1) end ), - awful.key({ modkey, "Control" }, "Right", function() awful.screen.focus_relative( 1) end ), + awful.key({ modkey, }, "s", function () awful.util.spawn("scrot") end, + {description = "Screenshot", group = "awesome"}), + awful.key({ modkey, "Control" }, "s", function () awful.util.spawn("scrot -u") end, + {description = "Screenshot selection", group = "awesome"}), + + + awful.key({ modkey, }, "Left", awful.tag.viewprev, + {description = "Previous", group = "tag"}), + awful.key({ modkey, }, "Right", awful.tag.viewnext, + {description = "Next", group = "tag"}), + awful.key({ modkey, "Control" }, "Left", function() awful.screen.focus_relative(-1) end, + {description = "Next screen", group = "awesome"}), + awful.key({ modkey, "Control" }, "Right", function() awful.screen.focus_relative( 1) end, + {description = "Previous screen", group = "awesome"}), awful.key({ modkey, }, "Escape", awful.tag.history.restore), @@ -465,30 +580,36 @@ globalkeys = awful.util.table.join( function () awful.client.focus.byidx( 1) if client.focus then client.focus:raise() end - end), + end, {description = "Next client", group = "client"}), awful.key({ modkey, "Shift" }, "Tab", function () awful.client.focus.byidx(-1) if client.focus then client.focus:raise() end - end), + end,{description = "Previous client", group = "client"}), -- - awful.key({ modkey, }, "w", function () awful.util.spawn("autoWall") end), - awful.key({ modkey, "Control" }, "w", function () act() end), - awful.key({ modkey, "Shift" }, "w", function () awful.util.spawn("passmenu") end), - awful.key({ modkey, "Control" }, "x", function () awful.util.spawn("xscreensaver-command --lock") end), + awful.key({ modkey, }, "w", function () awful.util.spawn("autoWall") end, + {description = "Switch wallpaper", group = "awesome"}), + awful.key({ modkey, "Control" }, "w", function () act() end, + {description = "Actualise Wibox", group = "awesome"}), + awful.key({ modkey, "Shift" }, "w", function () awful.util.spawn("passmenu") end, + {description = "Passwd promt", group = "awesome"}), + awful.key({ modkey, "Control" }, "x", function () awful.util.spawn("xscreensaver-command --lock") end, + {description = "Lock screen", group = "awesome"}), -- Layout manipulation - awful.key({ modkey, "Mod1" }, "k", function () awful.util.spawn("xkill") end), + awful.key({ modkey, "Mod1" }, "k", function () awful.util.spawn("xkill") end, + {description = "xkill", group = "awesome"}), awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end), awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end), awful.key({ modkey, }, "u", awful.client.urgent.jumpto), -- Standard program - awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), - awful.key({ modkey, "Shift" }, "r", awesome.restart), - awful.key({ modkey, "Shift" }, "q", awesome.quit), + awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end, + {description = "new term", group = "awesome"}), + awful.key({ modkey, "Shift" }, "r", awesome.restart, {description = "restart", group = "awesome"}), + awful.key({ modkey, "Shift" }, "q", awesome.quit,{description = "quit", group = "awesome"}), awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), @@ -499,10 +620,11 @@ globalkeys = awful.util.table.join( awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), awful.key({ modkey, }, "space", function () awful.layout.inc(1) - naughty.notify({ title = 'Layout', text = awful.layout.getname(), timeout = 1 }) end), + naughty.notify({ title = 'Layout', text = awful.layout.getname(), timeout = 1 }) end, {description = "Next layout", group = "client"}), awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) - naughty.notify({ title = 'Layout', text = awful.layout.getname(), timeout = 1 }) end), + naughty.notify({ title = 'Layout', text = awful.layout.getname(), timeout = 1 }) end, {description = "Previous layout", group = "client"}), +-- ## TODO : Add a description for it awful.key({ modkey, "Mod1" }, "Right", function () awful.tag.incmwfact( 0.01) end), awful.key({ modkey, "Mod1" }, "Left", function () awful.tag.incmwfact(-0.01) end), awful.key({ modkey, "Mod1" }, "Down", function () awful.client.incwfact( 0.01) end), @@ -510,14 +632,16 @@ globalkeys = awful.util.table.join( --~ awful.key({ modkey, "Control" }, "n", awful.client.restore), - awful.key({ modkey, }, "t", function () showHideWibox() end), - awful.key({ modkey, "Shift" }, "t", function () blockWibox = not blockWibox end), + awful.key({ modkey, }, "t", function () showHideWibox() end, + {description = "Toogle Wibox", group = "awesome"}), + awful.key({ modkey, "Shift" }, "t", function () blockWibox = not blockWibox end, + {description = "Lock Wibox", group = "awesome"}), awful.key({ modkey, "Control" }, "t", function () showHideWibox() end), -- Prompt - awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, - {description = "run prompt", group = "launcher"}), +-- awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, +-- {description = "run prompt", group = "launcher"}), awful.key({ modkey }, "x", function () --[[ @@ -529,7 +653,7 @@ globalkeys = awful.util.table.join( } ]] awful.util.spawn("rofi -show run -modi run") - end), + end,{description = "Run rofi prompt", group = "awesome"}), -- Menubar awful.key({ modkey }, "p", function() local list=client.get() @@ -554,7 +678,8 @@ globalkeys = awful.util.table.join( mouse.coords({ x=x_co, y=y_co }) end clientkeys = awful.util.table.join( - awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end), +awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end, + {description = "Set active client fullscreen", group = "client"}), awful.key({ modkey, }, "c", function (c) if c.name == "Lecteur multimédia VLC" then awful.util.spawn_with_shell('sleep 0.3;xte "keydown Control_L" "keydown v" "keyup v" "keyup Control_L"') @@ -564,7 +689,8 @@ clientkeys = awful.util.table.join( end), - awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ), + awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle, + {description = "Set floating layout", group = "client"}), awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end), awful.key({ modkey, }, "o", awful.client.movetoscreen ), awful.key({ modkey, }, "n", @@ -577,8 +703,9 @@ clientkeys = awful.util.table.join( mouse.coords({ x=0, y=0 }) c.minimized=true mouse.coords({ x=A, y=B }) - end), - awful.key({ modkey, "Control" }, "p", function () menubar.show() end), + end, {description = "Set minimized", group = "client"}), + awful.key({ modkey, "Control" }, "p", function () menubar.show() end, + {description = "Maximize all clients", group = "awesome"}), -- all minimized clients are restored awful.key({ modkey, }, "b", function() @@ -591,14 +718,14 @@ clientkeys = awful.util.table.join( awful.key({ modkey, }, "d", function (c) c.floating = not c.floating - end), + end, {description = "Set floating", group = "client"}), awful.key({ modkey, }, "m", function (c) c.maximized = not c.maximized -- Alternative : -- c.maximized_horizontal = not c.maximized_horizontal -- c.maximized_vertical = not c.maximized_vertical - end), + end, {description = "Set maximized", group = "client"}), awful.key({ modkey, "Control" }, "m", function (c) if c == client.focus then c.minimized = true @@ -626,7 +753,7 @@ clientkeys = awful.util.table.join( layoutKbd = 1 awful.util.spawn_with_shell("setxkbmap fr") end end end - end) + end,{description = "Switch keboard layout", group = "awesome"}) ) @@ -713,8 +840,8 @@ for i = 1, 9 do if tag then tag:view_only() end - end, - {description = "view tag #"..i, group = "tag"}), + end --[[, + {description = "view tag #"..i, group = "tag"}--]]), -- Toggle tag display. awful.key({ modkey, "Control" }, "#" .. i + 9, function () @@ -723,8 +850,8 @@ for i = 1, 9 do if tag then awful.tag.viewtoggle(tag) end - end, - {description = "toggle tag #" .. i, group = "tag"}), + end --[[, + {description = "toggle tag #" .. i, group = "tag"}--]]), -- Move client to tag. awful.key({ modkey, "Shift" }, "#" .. i + 9, function () @@ -734,8 +861,8 @@ for i = 1, 9 do client.focus:move_to_tag(tag) end end - end, - {description = "move focused client to tag #"..i, group = "tag"}), + end --[[, + {description = "move focused client to tag #"..i, group = "tag"}--]]), -- Toggle tag on focused client. awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, function () @@ -745,8 +872,7 @@ for i = 1, 9 do client.focus:toggle_tag(tag) end end - end, - {description = "toggle focused client on tag #" .. i, group = "tag"}) + end --[[, {description = "toggle focused client on tag #" .. i, group = "tag"}--]]) ) end -- cgit v1.2.3-54-g00ecf