diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-07-12 15:45:45 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-07-12 15:45:45 -0300 |
commit | e5b5be048c087e04bd504d4c13a48317d7a45915 (patch) | |
tree | b18e8b9e75c148fc4a353b5b1da15ca849a8ddc6 | |
parent | 1d37c3c4cfd5c554ea018c9ff38ab4f4e9f3dae8 (diff) | |
download | awesome-e5b5be048c087e04bd504d4c13a48317d7a45915.tar.gz awesome-e5b5be048c087e04bd504d4c13a48317d7a45915.tar.bz2 |
Refactor for 4.x compatibility
-rw-r--r-- | config.dot/awesome.link/errors.lua | 24 | ||||
-rw-r--r-- | config.dot/awesome.link/functions.lua | 15 | ||||
-rw-r--r-- | config.dot/awesome.link/globalkeys.lua | 185 | ||||
-rw-r--r-- | config.dot/awesome.link/keys.lua | 89 | ||||
-rw-r--r-- | config.dot/awesome.link/layout.lua | 18 | ||||
-rw-r--r-- | config.dot/awesome.link/menu.lua | 22 | ||||
m--------- | config.dot/awesome.link/powerarrow | 0 | ||||
-rw-r--r-- | config.dot/awesome.link/rc.lua | 44 | ||||
-rw-r--r-- | config.dot/awesome.link/signals.lua | 110 | ||||
l--------- | config.dot/awesome.link/themes/powerarrow | 1 | ||||
-rw-r--r-- | config.dot/awesome.link/themes/simplex/theme.lua | 102 | ||||
-rw-r--r-- | config.dot/awesome.link/variables.lua | 18 | ||||
-rw-r--r-- | config.dot/awesome.link/wibar.lua | 111 | ||||
-rw-r--r-- | config.dot/awesome.link/wibox.lua | 123 | ||||
-rw-r--r-- | config.dot/awesome.link/widgets.lua | 236 | ||||
m--------- | config.dot/awesome.link/widgets/awesompd | 0 | ||||
-rw-r--r-- | config.dot/awesome.link/widgets/awesompd.lua | 57 | ||||
-rw-r--r-- | config.dot/awesome.link/widgets/leds.lua | 13 | ||||
-rw-r--r-- | config.dot/awesome.link/widgets/volume.lua | 34 |
19 files changed, 450 insertions, 752 deletions
diff --git a/config.dot/awesome.link/errors.lua b/config.dot/awesome.link/errors.lua new file mode 100644 index 0000000..3e82711 --- /dev/null +++ b/config.dot/awesome.link/errors.lua @@ -0,0 +1,24 @@ +-- {{{ Error handling +-- Check if awesome encountered an error during startup and fell back to +-- another config (This code will only ever execute for the fallback config) +if awesome.startup_errors then + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, there were errors during startup!", + text = awesome.startup_errors }) +end + +-- Handle runtime errors after startup +do + local in_error = false + awesome.connect_signal("debug::error", function (err) + -- Make sure we don't go into an endless error loop + if in_error then return end + in_error = true + + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, an error happened!", + text = tostring(err) }) + in_error = false + end) +end +-- }}} diff --git a/config.dot/awesome.link/functions.lua b/config.dot/awesome.link/functions.lua index aa98502..f596053 100644 --- a/config.dot/awesome.link/functions.lua +++ b/config.dot/awesome.link/functions.lua @@ -2,3 +2,18 @@ function file_exists(name) local f=io.open(name,"r") if f~=nil then io.close(f) return true else return false end end + +-- {{{ Helper functions +function client_menu_toggle_fn() + local instance = nil + + return function () + if instance and instance.wibox.visible then + instance:hide() + instance = nil + else + instance = awful.menu.clients({ theme = { width = 250 } }) + end + end +end +-- }}} diff --git a/config.dot/awesome.link/globalkeys.lua b/config.dot/awesome.link/globalkeys.lua index 949c07b..c213f07 100644 --- a/config.dot/awesome.link/globalkeys.lua +++ b/config.dot/awesome.link/globalkeys.lua @@ -1,27 +1,31 @@ -- {{{ Key bindings globalkeys = awful.util.table.join( - awful.key({ modkey, }, "Left", awful.tag.viewprev ), - awful.key({ modkey, }, "Right", awful.tag.viewnext ), - awful.key({ modkey, }, "Escape", awful.tag.history.restore), + awful.key({ modkey, }, "s", hotkeys_popup.show_help, {description = "show help", group = "awesome"}), + awful.key({ modkey, }, "Left", awful.tag.viewprev, {description = "view previous", group = "tag"}), + awful.key({ modkey, }, "Right", awful.tag.viewnext, {description = "view next", group = "tag"}), + awful.key({ modkey, }, "Escape", awful.tag.history.restore, {description = "go back", group = "tag"}), awful.key({ modkey, }, "j", function () awful.client.focus.byidx( 1) - if client.focus then client.focus:raise() end - end), + end, + {description = "focus next by index", group = "client"} + ), awful.key({ modkey, }, "k", function () awful.client.focus.byidx(-1) - if client.focus then client.focus:raise() end - end), - awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end), + end, + {description = "focus previous by index", group = "client"} + ), + awful.key({ modkey, }, "w", function () mymainmenu:show() end, + {description = "show main menu", group = "awesome"}), -- Layout manipulation - awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), - awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end), - 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), + awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, {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"}), + awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end, {description = "focus the next screen", group = "screen"}), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end, {description = "focus the previous screen", group = "screen"}), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto, {description = "jump to urgent client", group = "client"}), --- Default tab behavior awful.key({ modkey, }, "Tab", @@ -30,7 +34,8 @@ globalkeys = awful.util.table.join( if client.focus then client.focus:raise() end - end), + end, + {description = "go back", group = "client"}), --- Cyclic tab behavior --- See http://stackoverflow.com/questions/11697102/awesome-alttab-just-switches-between-two-apps @@ -41,7 +46,9 @@ globalkeys = awful.util.table.join( if client.focus then client.focus:raise() end - end), + end, + {description = "go back cyclically", group = "client"}), + awful.key({ "Mod1", }, "Tab", function () -- awful.client.focus.history.previous() @@ -49,87 +56,129 @@ globalkeys = awful.util.table.join( if client.focus then client.focus:raise() end - end), + end, + {description = "go forward cyclically", group = "client"}), -- Standard program - awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), - awful.key({ modkey, "Control" }, "r", awesome.restart), - awful.key({ modkey, "Shift" }, "q", awesome.quit), + awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, {description = "open a terminal", group = "launcher"}), + awful.key({ modkey, "Control" }, "r", awesome.restart, {description = "reload awesome", group = "awesome"}), + awful.key({ modkey, "Shift" }, "q", awesome.quit, {description = "quit awesome", group = "awesome"}), + + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end, {description = "increase master width factor", group = "layout"}), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end, {description = "decrease master width factor", group = "layout"}), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end, {description = "increase the number of master clients", group = "layout"}), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end, {description = "decrease the number of master clients", group = "layout"}), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, {description = "increase the number of columns", group = "layout"}), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, {description = "decrease the number of columns", group = "layout"}), + awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, {description = "select next", group = "layout"}), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end, {description = "select previous", group = "layout"}), - awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), - awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), - awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), - awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), - 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(layouts, 1) end), - awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), + awful.key({ modkey, "Control" }, "n", + function () + local c = awful.client.restore() + -- Focus restored client + if c then + client.focus = c + c:raise() + end + end, + {description = "restore minimized", group = "client"}), -- Prompt - awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end) + awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, + {description = "run prompt", group = "launcher"}), - --awful.key({ modkey }, "x", - -- function () - -- awful.prompt.run({ prompt = "Run Lua code: " }, - -- mypromptbox[mouse.screen].widget, - -- awful.util.eval, nil, - -- awful.util.getdir("cache") .. "/history_eval") - -- end) + awful.key({ modkey }, "x", + function () + awful.prompt.run { + prompt = "Run Lua code: ", + textbox = awful.screen.focused().mypromptbox.widget, + exe_callback = awful.util.eval, + history_path = awful.util.get_cache_dir() .. "/history_eval" + } + end, + {description = "lua execute prompt", group = "awesome"}) + + -- Menubar + --awful.key({ modkey }, "p", function() menubar.show() end, + -- {description = "show the menubar", group = "launcher"}), ) clientkeys = awful.util.table.join( - awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end), - awful.key({ modkey, }, "q", function (c) c:kill() end), - awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ), - awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end), - awful.key({ modkey, }, "o", awful.client.movetoscreen ), - awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end), - awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end), - awful.key({ modkey, }, "n", function (c) c.minimized = not c.minimized end), + awful.key({ modkey, }, "f", + function (c) + c.fullscreen = not c.fullscreen + c:raise() + end, + {description = "toggle fullscreen", group = "client"}), + awful.key({ modkey, }, "q", function (c) c:kill() end, {description = "close", group = "client"}), + awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle , {description = "toggle floating", group = "client"}), + awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end, {description = "move to master", group = "client"}), + awful.key({ modkey, }, "o", function (c) c:move_to_screen() end, {description = "move to screen", group = "client"}), + awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end, {description = "toggle keep on top", group = "client"}), + awful.key({ modkey, }, "n", + function (c) + -- The client currently has the input focus, so it cannot be + -- minimized, since minimized clients can't have the focus. + c.minimized = true + end , + {description = "minimize", group = "client"}), awful.key({ modkey, }, "m", function (c) - c.maximized_horizontal = not c.maximized_horizontal - c.maximized_vertical = not c.maximized_vertical - end) + c.maximized = not c.maximized + c:raise() + end , + {description = "maximize", group = "client"}) ) --- Compute the maximum number of digit we need, limited to 9 -keynumber = 0 -for s = 1, screen.count() do - keynumber = math.min(9, math.max(#tags[s], keynumber)); -end - -- Bind all key numbers to tags. -- Be careful: we use keycodes to make it works on any keyboard layout. -- This should map on the top row of your keyboard, usually 1 to 9. -for i = 1, keynumber do +for i = 1, 9 do globalkeys = awful.util.table.join(globalkeys, + -- View tag only. awful.key({ modkey }, "#" .. i + 9, function () - local screen = mouse.screen - if tags[screen][i] then - awful.tag.viewonly(tags[screen][i]) + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + tag:view_only() end - end), + end, + {description = "view tag #"..i, group = "tag"}), + -- Toggle tag display. awful.key({ modkey, "Control" }, "#" .. i + 9, function () - local screen = mouse.screen - if tags[screen][i] then - awful.tag.viewtoggle(tags[screen][i]) + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + awful.tag.viewtoggle(tag) end - end), + end, + {description = "toggle tag #" .. i, group = "tag"}), + -- Move client to tag. awful.key({ modkey, "Shift" }, "#" .. i + 9, function () - if client.focus and tags[client.focus.screen][i] then - awful.client.movetotag(tags[client.focus.screen][i]) - end - end), + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:move_to_tag(tag) + end + end + end, + {description = "move focused client to tag #"..i, group = "tag"}), + -- Toggle tag on focused client. awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, function () - if client.focus and tags[client.focus.screen][i] then - awful.client.toggletag(tags[client.focus.screen][i]) + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:toggle_tag(tag) + end end - end)) + end, + {description = "toggle focused client on tag #" .. i, group = "tag"}) + ) end clientbuttons = awful.util.table.join( diff --git a/config.dot/awesome.link/keys.lua b/config.dot/awesome.link/keys.lua index 1d02af6..d29ac00 100644 --- a/config.dot/awesome.link/keys.lua +++ b/config.dot/awesome.link/keys.lua @@ -1,63 +1,58 @@ -- Key bindings globalkeys = awful.util.table.join(root.keys(), - awful.key({ modkey, }, "a", function () awful.util.spawn("thunar") end), - awful.key({ modkey, }, "b", function () awful.util.spawn("firefox-profile default") end), - awful.key({ modkey, }, "c", function () awful.util.spawn("terminal xcalendar") end), - awful.key({ modkey, }, "d", function () awful.util.spawn("terminal shell local media") end), - awful.key({ modkey, }, "e", function () awful.util.spawn("scrot '%Y-%m-%d-%H:%M:%S_$wx$h.png' -e 'mv $f ~/load/'") end), - awful.key({ modkey, }, "g", function () awful.util.spawn("gimp") end), - awful.key({ modkey, }, "h", function () awful.util.spawn("terminal chat") end), - awful.key({ modkey, }, "i", function () awful.util.spawn("geeqie") end), - awful.key({ modkey, }, "m", function () awful.util.spawn("terminal xmail") end), - awful.key({ modkey, }, "n", function () awful.util.spawn("terminal news") end), - awful.key({ modkey, }, "o", function () awful.util.spawn("chromium-browser --incognito") end), - awful.key({ modkey, }, "p", function () awful.util.spawn("terminal keyringer default sclip") end), - awful.key({ modkey, }, "s", function () awful.util.spawn("xsuspend") end), - awful.key({ modkey, }, "t", function () awful.util.spawn("tor-browser") end), - awful.key({ modkey, }, "u", function () awful.util.spawn("qrpaste") end), - awful.key({ modkey, }, "v", function () awful.util.spawn("terminal vim") end), - awful.key({ modkey, }, "x", function () awful.util.spawn("terminal wicd-curses") end), - awful.key({ modkey, }, "y", function () awful.util.spawn("xclip-clean") end), - awful.key({ modkey, }, "z", function () awful.util.spawn("terminal shell root") end), + awful.key({ modkey, }, "a", function () awful.util.spawn("thunar") end, {description = "thunar", group = "client"}), + awful.key({ modkey, }, "b", function () awful.util.spawn("firefox-profile default") end, {description = "firefox", group = "client"}), + awful.key({ modkey, }, "c", function () awful.util.spawn("terminal xcalendar") end, {description = "calendar", group = "client"}), + awful.key({ modkey, }, "d", function () awful.util.spawn("terminal shell local media") end, {description = "media", group = "client"}), + awful.key({ modkey, }, "e", function () awful.util.spawn("scrot '%Y-%m-%d-%H:%M:%S_$wx$h.png' -e 'mv $f ~/load/'") end, {description = "screenshot", group = "client"}), + awful.key({ modkey, }, "g", function () awful.util.spawn("gimp") end, {description = "gimp", group = "client"}), + awful.key({ modkey, }, "h", function () awful.util.spawn("terminal chat") end, {description = "chat", group = "client"}), + awful.key({ modkey, }, "i", function () awful.util.spawn("geeqie") end, {description = "geeqie", group = "client"}), + awful.key({ modkey, }, "m", function () awful.util.spawn("terminal xmail") end, {description = "mail", group = "client"}), + awful.key({ modkey, }, "n", function () awful.util.spawn("terminal news") end, {description = "news", group = "client"}), + awful.key({ modkey, }, "o", function () awful.util.spawn("chromium-browser --incognito") end, {description = "chromium", group = "client"}), + awful.key({ modkey, }, "p", function () awful.util.spawn("terminal keyringer default sclip") end, {description = "keyringer", group = "client"}), + awful.key({ modkey, }, "s", function () awful.util.spawn("xsuspend") end, {description = "suspend", group = "client"}), + awful.key({ modkey, }, "t", function () awful.util.spawn("tor-browser") end, {description = "tor-browser", group = "client"}), + awful.key({ modkey, }, "u", function () awful.util.spawn("qrpaste") end, {description = "qrpaste", group = "client"}), + awful.key({ modkey, }, "v", function () awful.util.spawn("terminal vim") end, {description = "editor", group = "client"}), + awful.key({ modkey, }, "x", function () awful.util.spawn("terminal wicd-curses") end, {description = "network", group = "client"}), + awful.key({ modkey, }, "y", function () awful.util.spawn("xclip-clean") end, {description = "clear clipboard", group = "client"}), + awful.key({ modkey, }, "z", function () awful.util.spawn("terminal shell root") end, {description = "root", group = "client"}), -- Unused - --awful.key({ modkey, }, "e", function () awful.util.spawn("command") end), - --awful.key({ modkey, }, "u", function () awful.util.spawn("command") end), + --awful.key({ modkey, }, "e", function () awful.util.spawn("command") end, {description = "", group = "client"}), + --awful.key({ modkey, }, "u", function () awful.util.spawn("command") end, {description = "", group = "client"}), -- Xlock - awful.key({ modkey, }, "Print", function () awful.util.spawn("xlock") end), + awful.key({ modkey, }, "Print", function () awful.util.spawn("xlock") end, {description = "", group = "client"}), -- Volume keys - awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer set Master 9%+", false) end), - awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("amixer set Master 9%-", false) end), - awful.key({ }, "XF86AudioMute", function () awful.util.spawn("amixer set Master toggle", false) end), + awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer set Master 9%+", false) end, {description = "volume up", group = "client"}), + awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("amixer set Master 9%-", false) end, {description = "volume down", group = "client"}), + awful.key({ }, "XF86AudioMute", function () awful.util.spawn("amixer set Master toggle", false) end, {description = "mute", group = "client"}), -- Hibernate - awful.key({ }, "XF86Launch1", function () awful.util.spawn("xhibernate") end), + awful.key({ }, "XF86Launch1", function () awful.util.spawn("xhibernate") end, {description = "", group = "client"}), -- Virtual environments - awful.key({ modkey, "Control" }, "a", function () awful.util.spawn("kvmx up tails") end), - awful.key({ modkey, "Control" }, "b", function () awful.util.spawn("kvmx up bankline") end), - awful.key({ modkey, "Control" }, "e", function () awful.util.spawn("kvmx up test") end), - awful.key({ modkey, "Control" }, "s", function () awful.util.spawn("kvmx up signal") end), - awful.key({ modkey, "Control" }, "t", function () awful.util.spawn("kvmx up tor") end), - awful.key({ modkey, "Control" }, "v", function () awful.util.spawn("kvmx up vpn") end), - awful.key({ modkey, "Control" }, "x", function () awful.util.spawn("kvmx up tor-expendable") end), - awful.key({ modkey, "Control" }, "w", function () awful.util.spawn("kvmx up web") end), - awful.key({ modkey, "Shift" }, "a", function () awful.util.spawn("kvmx hibernate tails") end), - awful.key({ modkey, "Shift" }, "b", function () awful.util.spawn("kvmx hibernate bankline") end), - awful.key({ modkey, "Shift" }, "e", function () awful.util.spawn("kvmx hibernate test") end), - awful.key({ modkey, "Shift" }, "s", function () awful.util.spawn("kvmx hibernate signal") end), - awful.key({ modkey, "Shift" }, "t", function () awful.util.spawn("kvmx hibernate tor") end), - awful.key({ modkey, "Shift" }, "v", function () awful.util.spawn("kvmx hibernate vpn") end), - awful.key({ modkey, "Shift" }, "x", function () awful.util.spawn("kvmx hibernate tor-expendable") end), - awful.key({ modkey, "Shift" }, "w", function () awful.util.spawn("kvmx hibernate web") end) + awful.key({ modkey, "Control" }, "a", function () awful.util.spawn("kvmx up tails") end, {description = "vm: tails", group = "client"}), + awful.key({ modkey, "Control" }, "b", function () awful.util.spawn("kvmx up bankline") end, {description = "vm: bankline", group = "client"}), + awful.key({ modkey, "Control" }, "e", function () awful.util.spawn("kvmx up test") end, {description = "vm: test", group = "client"}), + awful.key({ modkey, "Control" }, "s", function () awful.util.spawn("kvmx up signal") end, {description = "vm: signal", group = "client"}), + awful.key({ modkey, "Control" }, "t", function () awful.util.spawn("kvmx up tor") end, {description = "vm: tor", group = "client"}), + awful.key({ modkey, "Control" }, "v", function () awful.util.spawn("kvmx up vpn") end, {description = "vm: vpn", group = "client"}), + awful.key({ modkey, "Control" }, "x", function () awful.util.spawn("kvmx up tor-expendable") end, {description = "vm: tor-expendable", group = "client"}), + awful.key({ modkey, "Control" }, "w", function () awful.util.spawn("kvmx up web") end, {description = "vm: web", group = "client"}), + awful.key({ modkey, "Shift" }, "a", function () awful.util.spawn("kvmx hibernate tails") end, {description = "vm: down: tails", group = "client"}), + awful.key({ modkey, "Shift" }, "b", function () awful.util.spawn("kvmx hibernate bankline") end, {description = "vm: down: bankline", group = "client"}), + awful.key({ modkey, "Shift" }, "e", function () awful.util.spawn("kvmx hibernate test") end, {description = "vm: down: test", group = "client"}), + awful.key({ modkey, "Shift" }, "s", function () awful.util.spawn("kvmx hibernate signal") end, {description = "vm: down: signal", group = "client"}), + awful.key({ modkey, "Shift" }, "t", function () awful.util.spawn("kvmx hibernate tor") end, {description = "vm: down: tor", group = "client"}), + awful.key({ modkey, "Shift" }, "v", function () awful.util.spawn("kvmx hibernate vpn") end, {description = "vm: down: vpn", group = "client"}), + awful.key({ modkey, "Shift" }, "x", function () awful.util.spawn("kvmx hibernate tor-expendable") end, {description = "vm: down: tor-expendable", group = "client"}), + awful.key({ modkey, "Shift" }, "w", function () awful.util.spawn("kvmx hibernate web") end, {description = "vm: down: web", group = "client"}) ) --- Append keys from music widget -if awesompd then - musicwidget:append_global_keys() -end - -- Set keys root.keys(globalkeys) diff --git a/config.dot/awesome.link/layout.lua b/config.dot/awesome.link/layout.lua new file mode 100644 index 0000000..22d95c4 --- /dev/null +++ b/config.dot/awesome.link/layout.lua @@ -0,0 +1,18 @@ +-- Table of layouts to cover with awful.layout.inc, order matters. +awful.layout.layouts = { + awful.layout.suit.max, + awful.layout.suit.floating, + awful.layout.suit.tile, + awful.layout.suit.tile.left, + awful.layout.suit.tile.bottom, + awful.layout.suit.tile.top, + --awful.layout.suit.fair, + --awful.layout.suit.fair.horizontal, + --awful.layout.suit.spiral, + --awful.layout.suit.spiral.dwindle, + --awful.layout.suit.max, + --awful.layout.suit.max.fullscreen, + --awful.layout.suit.magnifier, + --awful.layout.suit.corner.nw, +} +-- }}} diff --git a/config.dot/awesome.link/menu.lua b/config.dot/awesome.link/menu.lua index 2fa3c60..098291d 100644 --- a/config.dot/awesome.link/menu.lua +++ b/config.dot/awesome.link/menu.lua @@ -1,17 +1,25 @@ -- {{{ Menu --- Create a laucher widget and a main menu +-- Create a launcher widget and a main menu +menubar = require("menubar") +hotkeys_popup = require("awful.hotkeys_popup").widget + myawesomemenu = { - { "quit", awesome.quit }, - { "restart", awesome.restart }, - { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" } + { "hotkeys", function() return false, hotkeys_popup.show_help end}, + { "manual", terminal .. " -e man awesome" }, + { "edit config", editor_cmd .. " " .. awesome.conffile }, + { "restart", awesome.restart }, + { "quit", function() awesome.quit() end} } -mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, - { "debian", debian.menu.Debian_menu.Debian }, +mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, + { "debian", debian.menu.Debian_menu.Debian }, { "terminal", terminal } } }) -mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), +mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu }) + +-- Menubar configuration +menubar.utils.terminal = terminal -- Set the terminal for applications that require it -- }}} diff --git a/config.dot/awesome.link/powerarrow b/config.dot/awesome.link/powerarrow deleted file mode 160000 -Subproject 0417e1891b48f2843e3615e86d37c071bed0830 diff --git a/config.dot/awesome.link/rc.lua b/config.dot/awesome.link/rc.lua index b2ae653..3dcd828 100644 --- a/config.dot/awesome.link/rc.lua +++ b/config.dot/awesome.link/rc.lua @@ -3,20 +3,17 @@ homedir = os.getenv("HOME") configdir = homedir .. "/.config/awesome" themes_dir = configdir .. "/themes" --- Standard awesome library -require("awful") -require("awful.util") -require("awful.autofocus") -require("awful.rules") - --- Theme handling library -require("beautiful") - --- Notification library -require("naughty") - --- Widget libraries -require("vicious") +-- Awesome library dependencies +gears = require("gears") +awful = require("awful") +wibox = require("wibox") +autofocus = require("awful.autofocus") +beautiful = require("beautiful") +naughty = require("naughty") + +-- Theme +--beautiful.init(awful.util.get_themes_dir() .. "default/theme.lua") +beautiful.init(awful.util.get_themes_dir() .. "zenburn/theme.lua") -- Load Debian menu entries require("debian.menu") @@ -29,20 +26,20 @@ end -- Variables dofile(configdir .. "/variables.lua") --- Load theme -beautiful.init(themes_dir .. "/powerarrow/theme.lua") +-- Layout +dofile(configdir .. "/layout.lua") + +-- Check for errors +dofile(configdir .. "/errors.lua") -- Misc functions dofile(configdir .. "/functions.lua") --- Tags -dofile(configdir .. "/tags.lua") - -- Menu dofile(configdir .. "/menu.lua") --- Wibox -dofile(configdir .. "/wibox.lua") +-- Wibar +dofile(configdir .. "/wibar.lua") -- Mouse dofile(configdir .. "/mouse.lua") @@ -50,7 +47,7 @@ dofile(configdir .. "/mouse.lua") -- Global keys dofile(configdir .. "/globalkeys.lua") --- Custom keys +-- Key mappings dofile(configdir .. "/keys.lua") -- Rules @@ -58,6 +55,3 @@ dofile(configdir .. "/rules.lua") -- Signals dofile(configdir .. "/signals.lua") - --- Startup commands -dofile(configdir .. "/programs.lua") diff --git a/config.dot/awesome.link/signals.lua b/config.dot/awesome.link/signals.lua index c65409f..d6a9f8a 100644 --- a/config.dot/awesome.link/signals.lua +++ b/config.dot/awesome.link/signals.lua @@ -1,30 +1,98 @@ -- {{{ Signals -- Signal function to execute when a new client appears. -client.add_signal("manage", function (c, startup) - -- Add a titlebar - -- awful.titlebar.add(c, { modkey = modkey }) +--client.add_signal("manage", function (c, startup) +-- -- Add a titlebar +-- -- awful.titlebar.add(c, { modkey = modkey }) +-- +-- -- Enable sloppy focus (focus on mouse over) +-- --c:add_signal("mouse::enter", function(c) +-- -- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier +-- -- and awful.client.focus.filter(c) then +-- -- client.focus = c +-- -- end +-- --end) +-- +-- if not startup then +-- -- Set the windows at the slave, +-- -- i.e. put it at the end of others instead of setting it master. +-- -- awful.client.setslave(c) +-- +-- -- Put windows in a smart way, only if they does not set an initial position. +-- if not c.size_hints.user_position and not c.size_hints.program_position then +-- awful.placement.no_overlap(c) +-- awful.placement.no_offscreen(c) +-- end +-- end +--end) +-- +--client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end) +--client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) +-- }}} +-- {{{ Signals +-- Signal function to execute when a new client appears. +client.connect_signal("manage", function (c) + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- if not awesome.startup then awful.client.setslave(c) end - -- Enable sloppy focus (focus on mouse over) - --c:add_signal("mouse::enter", function(c) - -- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier - -- and awful.client.focus.filter(c) then - -- client.focus = c - -- end - --end) + if awesome.startup and + not c.size_hints.user_position + and not c.size_hints.program_position then + -- Prevent clients from being unreachable after screen count changes. + awful.placement.no_offscreen(c) + end +end) + +-- Add a titlebar if titlebars_enabled is set to true in the rules. +client.connect_signal("request::titlebars", function(c) + -- buttons for the titlebar + local buttons = awful.util.table.join( + awful.button({ }, 1, function() + client.focus = c + c:raise() + awful.mouse.client.move(c) + end), + awful.button({ }, 3, function() + client.focus = c + c:raise() + awful.mouse.client.resize(c) + end) + ) - if not startup then - -- Set the windows at the slave, - -- i.e. put it at the end of others instead of setting it master. - -- awful.client.setslave(c) + awful.titlebar(c) : setup { + { -- Left + awful.titlebar.widget.iconwidget(c), + buttons = buttons, + layout = wibox.layout.fixed.horizontal + }, + { -- Middle + { -- Title + align = "center", + widget = awful.titlebar.widget.titlewidget(c) + }, + buttons = buttons, + layout = wibox.layout.flex.horizontal + }, + { -- Right + awful.titlebar.widget.floatingbutton (c), + awful.titlebar.widget.maximizedbutton(c), + awful.titlebar.widget.stickybutton (c), + awful.titlebar.widget.ontopbutton (c), + awful.titlebar.widget.closebutton (c), + layout = wibox.layout.fixed.horizontal() + }, + layout = wibox.layout.align.horizontal + } +end) - -- Put windows in a smart way, only if they does not set an initial position. - if not c.size_hints.user_position and not c.size_hints.program_position then - awful.placement.no_overlap(c) - awful.placement.no_offscreen(c) - end +-- Enable sloppy focus, so that focus follows mouse. +client.connect_signal("mouse::enter", function(c) + if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier + and awful.client.focus.filter(c) then + client.focus = c end end) -client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end) -client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) +client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) +client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) -- }}} diff --git a/config.dot/awesome.link/themes/powerarrow b/config.dot/awesome.link/themes/powerarrow deleted file mode 120000 index 8917e4b..0000000 --- a/config.dot/awesome.link/themes/powerarrow +++ /dev/null @@ -1 +0,0 @@ -../powerarrow/themes/powerarrow
\ No newline at end of file diff --git a/config.dot/awesome.link/themes/simplex/theme.lua b/config.dot/awesome.link/themes/simplex/theme.lua deleted file mode 100644 index 0f64c38..0000000 --- a/config.dot/awesome.link/themes/simplex/theme.lua +++ /dev/null @@ -1,102 +0,0 @@ ---------------------------- --- Default awesome theme -- ---------------------------- - -theme = {} - -theme.font = "sans 8" ---theme.font = "inconsolata 8" ---theme.font = "terminus 8" ---theme.font = "mono 8" - ----theme.bg_normal = "#222222" -theme.bg_normal = "#000000" ----theme.bg_focus = "#535d6c" -theme.bg_focus = "#222222" -theme.bg_urgent = "#ff0000" -theme.bg_minimize = "#444444" - -theme.fg_normal = "#aaaaaa" -theme.fg_focus = "#ffffff" -theme.fg_urgent = "#ffffff" -theme.fg_minimize = "#ffffff" - -theme.border_width = "1" -theme.border_normal = "#000000" ----theme.border_focus = "#535d6c" -theme.border_focus = "#222222" -theme.border_marked = "#91231c" - --- There are other variable sets --- overriding the default one when --- defined, the sets are: --- [taglist|tasklist]_[bg|fg]_[focus|urgent] --- titlebar_[bg|fg]_[normal|focus] --- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color] --- mouse_finder_[color|timeout|animate_timeout|radius|factor] --- Example: ---theme.taglist_bg_focus = "#ff0000" - --- Display the taglist squares -theme.taglist_squares_sel = "/usr/share/awesome/themes/default/taglist/squarefw.png" -theme.taglist_squares_unsel = "/usr/share/awesome/themes/default/taglist/squarew.png" - -theme.tasklist_floating_icon = "/usr/share/awesome/themes/default/tasklist/floatingw.png" - --- Variables set for theming the menu: --- menu_[bg|fg]_[normal|focus] --- menu_[border_color|border_width] -theme.menu_submenu_icon = "/usr/share/awesome/themes/default/submenu.png" -theme.menu_height = "15" -theme.menu_width = "100" - --- You can add as many variables as --- you wish and access them by using --- beautiful.variable in your rc.lua ---theme.bg_widget = "#cc0000" - --- Define the image to load -theme.titlebar_close_button_normal = "/usr/share/awesome/themes/default/titlebar/close_normal.png" -theme.titlebar_close_button_focus = "/usr/share/awesome/themes/default/titlebar/close_focus.png" - -theme.titlebar_ontop_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/ontop_normal_inactive.png" -theme.titlebar_ontop_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/ontop_focus_inactive.png" -theme.titlebar_ontop_button_normal_active = "/usr/share/awesome/themes/default/titlebar/ontop_normal_active.png" -theme.titlebar_ontop_button_focus_active = "/usr/share/awesome/themes/default/titlebar/ontop_focus_active.png" - -theme.titlebar_sticky_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/sticky_normal_inactive.png" -theme.titlebar_sticky_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/sticky_focus_inactive.png" -theme.titlebar_sticky_button_normal_active = "/usr/share/awesome/themes/default/titlebar/sticky_normal_active.png" -theme.titlebar_sticky_button_focus_active = "/usr/share/awesome/themes/default/titlebar/sticky_focus_active.png" - -theme.titlebar_floating_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/floating_normal_inactive.png" -theme.titlebar_floating_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/floating_focus_inactive.png" -theme.titlebar_floating_button_normal_active = "/usr/share/awesome/themes/default/titlebar/floating_normal_active.png" -theme.titlebar_floating_button_focus_active = "/usr/share/awesome/themes/default/titlebar/floating_focus_active.png" - -theme.titlebar_maximized_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/maximized_normal_inactive.png" -theme.titlebar_maximized_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/maximized_focus_inactive.png" -theme.titlebar_maximized_button_normal_active = "/usr/share/awesome/themes/default/titlebar/maximized_normal_active.png" -theme.titlebar_maximized_button_focus_active = "/usr/share/awesome/themes/default/titlebar/maximized_focus_active.png" - --- You can use your own command to set your wallpaper ---theme.wallpaper_cmd = { "awsetbg " .. homedir .. "/themes/backgrounds/background.jpg" } ---theme.wallpaper_cmd = { "xsetroot -solid black" } - --- You can use your own layout icons like this: -theme.layout_fairh = "/usr/share/awesome/themes/default/layouts/fairhw.png" -theme.layout_fairv = "/usr/share/awesome/themes/default/layouts/fairvw.png" -theme.layout_floating = "/usr/share/awesome/themes/default/layouts/floatingw.png" -theme.layout_magnifier = "/usr/share/awesome/themes/default/layouts/magnifierw.png" -theme.layout_max = "/usr/share/awesome/themes/default/layouts/maxw.png" -theme.layout_fullscreen = "/usr/share/awesome/themes/default/layouts/fullscreenw.png" -theme.layout_tilebottom = "/usr/share/awesome/themes/default/layouts/tilebottomw.png" -theme.layout_tileleft = "/usr/share/awesome/themes/default/layouts/tileleftw.png" -theme.layout_tile = "/usr/share/awesome/themes/default/layouts/tilew.png" -theme.layout_tiletop = "/usr/share/awesome/themes/default/layouts/tiletopw.png" -theme.layout_spiral = "/usr/share/awesome/themes/default/layouts/spiralw.png" -theme.layout_dwindle = "/usr/share/awesome/themes/default/layouts/dwindlew.png" - -theme.awesome_icon = "/usr/share/awesome/icons/awesome16.png" - -return theme diff --git a/config.dot/awesome.link/variables.lua b/config.dot/awesome.link/variables.lua index 411940b..615f6f0 100644 --- a/config.dot/awesome.link/variables.lua +++ b/config.dot/awesome.link/variables.lua @@ -10,21 +10,3 @@ editor_cmd = terminal .. " " .. editor -- I suggest you to remap Mod4 to another key using xmodmap or other tools. -- However, you can use another modifier like Mod1, but it may interact with others. modkey = "Mod4" - --- Table of layouts to cover with awful.layout.inc, order matters. -layouts = -{ - awful.layout.suit.max, - awful.layout.suit.floating, - awful.layout.suit.tile, - awful.layout.suit.tile.left, - awful.layout.suit.tile.bottom, - awful.layout.suit.tile.top, - --awful.layout.suit.fair, - --awful.layout.suit.fair.horizontal, - --awful.layout.suit.spiral, - --awful.layout.suit.spiral.dwindle, - --awful.layout.suit.max.fullscreen, - --awful.layout.suit.magnifier -} --- }}} diff --git a/config.dot/awesome.link/wibar.lua b/config.dot/awesome.link/wibar.lua new file mode 100644 index 0000000..3a452ed --- /dev/null +++ b/config.dot/awesome.link/wibar.lua @@ -0,0 +1,111 @@ +-- {{{ Wibar +-- Keyboard map indicator and switcher +mykeyboardlayout = awful.widget.keyboardlayout() + +-- Create a textclock widget +mytextclock = wibox.widget.textclock() + +-- Create a wibox for each screen and add it +local taglist_buttons = awful.util.table.join( + awful.button({ }, 1, function(t) t:view_only() end), + awful.button({ modkey }, 1, function(t) + if client.focus then + client.focus:move_to_tag(t) + end + end), + awful.button({ }, 3, awful.tag.viewtoggle), + awful.button({ modkey }, 3, function(t) + if client.focus then + client.focus:toggle_tag(t) + end + end), + awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end), + awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) + ) + +local tasklist_buttons = awful.util.table.join( + awful.button({ }, 1, function (c) + if c == client.focus then + c.minimized = true + else + -- Without this, the following + -- :isvisible() makes no sense + c.minimized = false + if not c:isvisible() and c.first_tag then + c.first_tag:view_only() + end + -- This will also un-minimize + -- the client, if needed + client.focus = c + c:raise() + end + end), + awful.button({ }, 3, client_menu_toggle_fn()), + awful.button({ }, 4, function () + awful.client.focus.byidx(1) + end), + awful.button({ }, 5, function () + awful.client.focus.byidx(-1) + end)) + +local function set_wallpaper(s) + -- Wallpaper + if beautiful.wallpaper then + local wallpaper = beautiful.wallpaper + -- If wallpaper is a function, call it with the screen + if type(wallpaper) == "function" then + wallpaper = wallpaper(s) + end + gears.wallpaper.maximized(wallpaper, s, true) + end +end + +-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) +screen.connect_signal("property::geometry", set_wallpaper) + +awful.screen.connect_for_each_screen(function(s) + -- Wallpaper + set_wallpaper(s) + + -- Each screen has its own tag table. + awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) + + -- Create a promptbox for each screen + s.mypromptbox = awful.widget.prompt() + -- Create an imagebox widget which will contains an icon indicating which layout we're using. + -- We need one layoutbox per screen. + s.mylayoutbox = awful.widget.layoutbox(s) + s.mylayoutbox:buttons(awful.util.table.join( + awful.button({ }, 1, function () awful.layout.inc( 1) end), + awful.button({ }, 3, function () awful.layout.inc(-1) end), + awful.button({ }, 4, function () awful.layout.inc( 1) end), + awful.button({ }, 5, function () awful.layout.inc(-1) end))) + -- Create a taglist widget + s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons) + + -- Create a tasklist widget + s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons) + + -- Create the wibox + s.mywibox = awful.wibar({ position = "top", screen = s }) + + -- Add widgets to the wibox + s.mywibox:setup { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + mylauncher, + s.mytaglist, + s.mypromptbox, + }, + s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + mykeyboardlayout, + wibox.widget.systray(), + mytextclock, + s.mylayoutbox, + }, + } +end) +-- }}} diff --git a/config.dot/awesome.link/wibox.lua b/config.dot/awesome.link/wibox.lua deleted file mode 100644 index b44af6a..0000000 --- a/config.dot/awesome.link/wibox.lua +++ /dev/null @@ -1,123 +0,0 @@ --- {{{ Wibox - --- Create a wibox for each screen and add it -mywibox = {} -mypromptbox = {} -mylayoutbox = {} -mytaglist = {} -mytaglist.buttons = awful.util.table.join( - awful.button({ }, 1, awful.tag.viewonly), - awful.button({ modkey }, 1, awful.client.movetotag), - awful.button({ }, 3, awful.tag.viewtoggle), - awful.button({ modkey }, 3, awful.client.toggletag), - awful.button({ }, 4, awful.tag.viewnext), - awful.button({ }, 5, awful.tag.viewprev) - ) - -mytasklist = {} -mytasklist.buttons = awful.util.table.join( - awful.button({ }, 1, function (c) - if not c:isvisible() then - awful.tag.viewonly(c:tags()[1]) - end - client.focus = c - c:raise() - end), - awful.button({ }, 3, function () - if instance then - instance:hide() - instance = nil - else - instance = awful.menu.clients({ width=250 }) - end - end), - awful.button({ }, 4, function () - awful.client.focus.byidx(1) - if client.focus then client.focus:raise() end - end), - awful.button({ }, 5, function () - awful.client.focus.byidx(-1) - if client.focus then client.focus:raise() end - end)) - --- Widgets -dofile(configdir .. "/widgets.lua") - -for s = 1, screen.count() do - -- Create a promptbox for each screen - mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright }) - -- Create an imagebox widget which will contains an icon indicating which layout we're using. - -- We need one layoutbox per screen. - mylayoutbox[s] = awful.widget.layoutbox(s) - mylayoutbox[s]:buttons(awful.util.table.join( - awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), - awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), - awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), - awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) - -- Create a taglist widget - mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons) - - -- Create a tasklist widget - mytasklist[s] = awful.widget.tasklist(function(c) - return awful.widget.tasklist.label.currenttags(c, s) - end, mytasklist.buttons) - - -- Create the wibox - --mywibox[s] = awful.wibox({ position = "top", screen = s }) - mywibox[s] = awful.wibox({ position = "top", screen = s, height = "16" }) - -- Add widgets to the wibox - order matters - mywibox[s].widgets = { - { - --mylauncher, - mytaglist[s], - mypromptbox[s], - layout = awful.widget.layout.horizontal.leftright - }, - mylayoutbox[s], - - s == 1 and mysystray or nil, - arr1, - spr3f, - --binaryclock.widget, - clockwidget, - spr3f, - arrl, - --my_cal.widget, - arr2, - --netwidget, - --neticon, - arr3, - batwidget, - baticon, - arr4, - --fswidget, - --udisks_glue.widget, - arr5, - sensors, - tempicon, - arr6, - --cpuwidget, - --cpuicon, - arr7, - --memwidget, - --memicon, - arr8, - --task_warrior.widget, - arr9, - --music, - arr0, - --mailicon, - arr9, - spr, - -- s == 1 and mysystray, spr or nil, mytasklist[s], - - --mytextclock, - --volume_widget, - --battery_widget, - myledbox, - awesompd and musicwidget.widget or nil, - mytasklist[s], - layout = awful.widget.layout.horizontal.rightleft - } -end --- }}} diff --git a/config.dot/awesome.link/widgets.lua b/config.dot/awesome.link/widgets.lua deleted file mode 100644 index 7cea6fd..0000000 --- a/config.dot/awesome.link/widgets.lua +++ /dev/null @@ -1,236 +0,0 @@ --- {{{ Misc widgets -dofile(configdir .. "/widgets/leds.lua") -dofile(configdir .. "/widgets/volume.lua") - -if awful.util.file_readable(homedir .. "/.custom/awesome/awesompd.lua") then - awesompd = true - dofile(configdir .. "/widgets/awesompd.lua") -end --- }}} - ---{{---| Text clock widget |------------------------------------------------------------------------------ - -mytextclock = awful.widget.textclock({ align = "right" }) - ---{{---| Systray widget |------------------------------------------------------------------------------ - -mysystray = widget({ type = "systray" }) - ---{{---| Chat widget |------------------------------------------------------------------------------ - -chaticon = widget ({type = "imagebox" }) -chaticon.image = image(beautiful.widget_chat) -chaticon:buttons(awful.util.table.join(awful.button({ }, 1, -function () awful.util.spawn_with_shell(chat) end))) - ---{{---| Mail widget |------------------------------------------------------------------------------ - -mailicon = widget ({type = "imagebox" }) -mailicon.image = image(beautiful.widget_mail) -mailicon:buttons(awful.util.table.join(awful.button({ }, 1, -function () awful.util.spawn_with_shell(mailmutt) end))) - ---{{---| Music widget |----------------------------------------------------------------------------- - -music = widget ({type = "imagebox" }) -music.image = image(beautiful.widget_music) -music:buttons(awful.util.table.join( - awful.button({ }, 1, function () awful.util.spawn_with_shell(musicplr) end), - awful.button({ modkey }, 1, function () awful.util.spawn_with_shell("ncmpcpp toggle") end), - awful.button({ }, 3, function () couth.notifier:notify( couth.alsa:setVolume('Master','toggle')) end), - awful.button({ }, 4, function () couth.notifier:notify( couth.alsa:setVolume('PCM','2dB+')) end), - awful.button({ }, 5, function () couth.notifier:notify( couth.alsa:setVolume('PCM','2dB-')) end), - awful.button({ }, 4, function () couth.notifier:notify( couth.alsa:setVolume('Master','2dB+')) end), - awful.button({ }, 5, function () couth.notifier:notify( couth.alsa:setVolume('Master','2dB-')) end))) - ---{{---| TaskWarrior widget |----------------------------------------------------------------------- - ---task_warrior = blingbling.task_warrior.new(beautiful.widget_task) ---task_warrior:set_task_done_icon(beautiful.task_done_icon) ---task_warrior:set_task_icon(beautiful.task_icon) ---task_warrior:set_project_icon(beautiful.project_icon) - ---{{---| MEM widget |------------------------------------------------------------------------------- - -memwidget = widget({ type = "textbox" }) -vicious.register(memwidget, vicious.widgets.mem, '<span background="#777E76" font="Terminus 12"> <span font="Terminus 9" color="#EEEEEE" background="#777E76">$2MB </span></span>', 13) -memicon = widget ({type = "imagebox" }) -memicon.image = image(beautiful.widget_mem) - ---{{---| CPU / sensors widget |--------------------------------------------------------------------- - ---cpuwidget = widget({ type = "textbox" }) ---vicious.register(cpuwidget, vicious.widgets.cpu, ---'<span background="#4B696D" font="Terminus 12"> <span font="Terminus 9" color="#DDDDDD">$2% <span color="#888888">·</span> $3% </span></span>', 3) ---cpuicon = widget ({type = "imagebox" }) ---cpuicon.image = image(beautiful.widget_cpu) ---sensors = widget({ type = "textbox" }) ---vicious.register(sensors, vicious.widgets.sensors) ---tempicon = widget ({type = "imagebox" }) ---tempicon.image = image(beautiful.widget_temp) ---blingbling.popups.htop(cpuwidget, ---{ title_color = beautiful.notify_font_color_1, ---user_color = beautiful.notify_font_color_2, ---root_color = beautiful.notify_font_color_3, ---terminal = "terminal --geometry=130x56-10+26"}) - ---{{---| FS's widget / udisks-glue menu |----------------------------------------------------------- - ---fswidget = widget({ type = "textbox" }) ---vicious.register(fswidget, vicious.widgets.fs, ---'<span background="#D0785D" font="Terminus 12"> <span font="Terminus 9" color="#EEEEEE">${/mnt/storage avail_gb}GB </span></span>', 8) ---udisks_glue = blingbling.udisks_glue.new(beautiful.widget_hdd) ---udisks_glue:set_mount_icon(beautiful.accept) ---udisks_glue:set_umount_icon(beautiful.cancel) ---udisks_glue:set_detach_icon(beautiful.cancel) ---udisks_glue:set_Usb_icon(beautiful.usb) ---udisks_glue:set_Cdrom_icon(beautiful.cdrom) ---awful.widget.layout.margins[udisks_glue.widget] = { top = 0} ---udisks_glue.widget.resize = false - ---{{---| Battery widget |--------------------------------------------------------------------------- - -baticon = widget ({type = "imagebox" }) -baticon.image = image(beautiful.widget_battery) -batwidget = widget({ type = "textbox" }) -vicious.register( batwidget, vicious.widgets.bat, '<span background="#92B0A0" font="Terminus 12"> <span font="Terminus 9" color="#FFFFFF" background="#92B0A0">$1$2% </span></span>', 1, "BAT0" ) - ---{{---| Net widget |------------------------------------------------------------------------------- - -netwidget = widget({ type = "textbox" }) -vicious.register(netwidget, -vicious.widgets.net, -'<span background="#C2C2A4" font="Terminus 12"> <span font="Terminus 9" color="#FFFFFF">${eth0 down_kb} ↓↑ ${eth0 up_kb}</span> </span>', 3) -neticon = widget ({type = "imagebox" }) -neticon.image = image(beautiful.widget_net) -netwidget:buttons(awful.util.table.join(awful.button({ }, 1, -function () awful.util.spawn_with_shell(iptraf) end))) - ---{{---| Normal clock |------------------------------------------------------------------------------- - -clockwidget = widget({ type = "textbox" }) -vicious.register(clockwidget, vicious.widgets.date, -'<span background="#777e76" font="Terminus 12"> <span font="Terminus 9" color="#FFFFFF">%d/%m/%Y %H:%M</span> </span>', 3) - ---{{---| Binary Clock |----------------------------------------------------------------------------- - -binaryclock = {} -binaryclock.widget = widget({type = "imagebox"}) -binaryclock.w = 42 -binaryclock.h = 16 -binaryclock.show_sec = true -binaryclock.color_active = beautiful.binclock_fga -binaryclock.color_bg = beautiful.binclock_bg -binaryclock.color_inactive = beautiful.binclock_fgi -binaryclock.dotsize = math.floor(binaryclock.h / 5) -binaryclock.step = math.floor(binaryclock.dotsize / 3) -binaryclock.widget.image = image.argb32(binaryclock.w, binaryclock.h, nil) -if (binaryclock.show_sec) then binaryclock.timeout = 1 else binaryclock.timeout = 20 end -binaryclock.DEC_BIN = function(IN) -local B,K,OUT,I,D=2,"01","",0 -while IN>0 do -I=I+1 -IN,D=math.floor(IN/B),math.mod(IN,B)+1 -OUT=string.sub(K,D,D)..OUT -end -return OUT -end -binaryclock.paintdot = function(val,shift,limit) -local binval = binaryclock.DEC_BIN(val) -local l = string.len(binval) -local height = 0 -if (l < limit) then -for i=1,limit - l do binval = "0" .. binval end -end -for i=0,limit-1 do -if (string.sub(binval,limit-i,limit-i) == "1") then -binaryclock.widget.image:draw_rectangle(shift, -binaryclock.h - binaryclock.dotsize - height, -binaryclock.dotsize, binaryclock.dotsize, true, binaryclock.color_active) -else -binaryclock.widget.image:draw_rectangle(shift, -binaryclock.h - binaryclock.dotsize - height, -binaryclock.dotsize,binaryclock.dotsize, true, binaryclock.color_inactive) -end -height = height + binaryclock.dotsize + binaryclock.step -end -end -binaryclock.drawclock = function () -binaryclock.widget.image:draw_rectangle(0, 0, binaryclock.w, binaryclock.h, true, binaryclock.color_bg) -local t = os.date("*t") -local hour = t.hour -if (string.len(hour) == 1) then -hour = "0" .. t.hour -end -local min = t.min -if (string.len(min) == 1) then -min = "0" .. t.min -end -local sec = t.sec -if (string.len(sec) == 1) then -sec = "0" .. t.sec -end -local col_count = 6 -if (not binaryclock.show_sec) then col_count = 4 end -local step = math.floor((binaryclock.w - col_count * binaryclock.dotsize) / 8) -binaryclock.paintdot(0 + string.sub(hour, 1, 1), step, 2) -binaryclock.paintdot(0 + string.sub(hour, 2, 2), binaryclock.dotsize + 2 * step, 4) -binaryclock.paintdot(0 + string.sub(min, 1, 1),binaryclock.dotsize * 2 + 4 * step, 3) -binaryclock.paintdot(0 + string.sub(min, 2, 2),binaryclock.dotsize * 3 + 5 * step, 4) -if (binaryclock.show_sec) then -binaryclock.paintdot(0 + string.sub(sec, 1, 1), binaryclock.dotsize * 4 + 7 * step, 3) -binaryclock.paintdot(0 + string.sub(sec, 2, 2), binaryclock.dotsize * 5 + 8 * step, 4) -end -binaryclock.widget.image = binaryclock.widget.image -end -binarytimer = timer { timeout = binaryclock.timeout } -binarytimer:add_signal("timeout", function() -binaryclock.drawclock() -end) -binarytimer:start() - --- binaryclock.widget:buttons(awful.util.table.join( --- awful.button({ }, 1, function () --- end) --- )) - ---{{---| Calendar widget |-------------------------------------------------------------------------- - --- my_cal = blingbling.calendar.new({type = "imagebox", image = beautiful.widget_cal}) --- my_cal:set_cell_padding(4) --- my_cal:set_title_font_size(9) --- my_cal:set_title_text_color("#4F98C1") --- my_cal:set_font_size(9) --- my_cal:set_inter_margin(1) --- my_cal:set_columns_lines_titles_font_size(8) --- my_cal:set_columns_lines_titles_text_color("#d4aa00ff") --- my_cal:set_link_to_external_calendar(true) --{{ <-- popup reminder - ---{{---| Separators widgets |----------------------------------------------------------------------- - -spr = widget({ type = "textbox" }) -spr.text = ' ' -sprd = widget({ type = "textbox" }) -sprd.text = '<span background="#313131" font="Terminus 12"> </span>' -spr3f = widget({ type = "textbox" }) -spr3f.text = '<span background="#777e76" font="Terminus 12"> </span>' -arr1 = widget ({type = "imagebox" }) -arr1.image = image(beautiful.arr1) -arr2 = widget ({type = "imagebox" }) -arr2.image = image(beautiful.arr2) -arr3 = widget ({type = "imagebox" }) -arr3.image = image(beautiful.arr3) -arr4 = widget ({type = "imagebox" }) -arr4.image = image(beautiful.arr4) -arr5 = widget ({type = "imagebox" }) -arr5.image = image(beautiful.arr5) -arr6 = widget ({type = "imagebox" }) -arr6.image = image(beautiful.arr6) -arr7 = widget ({type = "imagebox" }) -arr7.image = image(beautiful.arr7) -arr8 = widget ({type = "imagebox" }) -arr8.image = image(beautiful.arr8) -arr9 = widget ({type = "imagebox" }) -arr9.image = image(beautiful.arr9) -arr0 = widget ({type = "imagebox" }) -arr0.image = image(beautiful.arr0) diff --git a/config.dot/awesome.link/widgets/awesompd b/config.dot/awesome.link/widgets/awesompd deleted file mode 160000 -Subproject 4142a7aa82e938afc7e948c3744ba2b0e520e49 diff --git a/config.dot/awesome.link/widgets/awesompd.lua b/config.dot/awesome.link/widgets/awesompd.lua deleted file mode 100644 index 4af25a3..0000000 --- a/config.dot/awesome.link/widgets/awesompd.lua +++ /dev/null @@ -1,57 +0,0 @@ -require("awesompd/awesompd") - -musicwidget = awesompd:create() -- Create awesompd widget ---musicwidget.font = "Liberation Mono" -- Set widget font -musicwidget.scrolling = true -- If true, the text in the widget will be scrolled -musicwidget.output_size = 30 -- Set the size of widget in symbols -musicwidget.update_interval = 10 -- Set the update interval in seconds --- Set the folder where icons are located (change username to your login name) -musicwidget.path_to_icons = configdir .. "/awesompd/icons" --- Set the default music format for Jamendo streams. You can change --- this option on the fly in awesompd itself. --- possible formats: awesompd.FORMAT_MP3, awesompd.FORMAT_OGG -musicwidget.jamendo_format = awesompd.FORMAT_MP3 --- If true, song notifications for Jamendo tracks and local tracks will also contain --- album cover image. -musicwidget.show_album_cover = false --- Specify how big in pixels should an album cover be. Maximum value --- is 100. -musicwidget.album_cover_size = 50 --- This option is necessary if you want the album covers to be shown --- for your local tracks. ---musicwidget.mpd_config = homedir .. "/.mpdconf" --- Specify the browser you use so awesompd can open links from --- Jamendo in it. -musicwidget.browser = "firefox" --- Specify decorators on the left and the right side of the --- widget. Or just leave empty strings if you decorate the widget --- from outside. -musicwidget.ldecorator = " " -musicwidget.rdecorator = " " --- Set all the servers to work with (here can be any servers you use) --- Set the buttons of the widget -musicwidget:register_buttons({ - --{ "", awesompd.MOUSE_LEFT, musicwidget:command_toggle() }, - --{ "Control", awesompd.MOUSE_SCROLL_UP, musicwidget:command_prev_track() }, - --{ "Control", awesompd.MOUSE_SCROLL_DOWN, musicwidget:command_next_track() }, - { "", "XF86AudioPrev", musicwidget:command_prev_track() }, - { "", "XF86AudioNext", musicwidget:command_next_track() }, - { modkey, "XF86AudioPrev", musicwidget:command_previous_server() }, - { modkey, "XF86AudioNext", musicwidget:command_next_server() }, - --{ "", awesompd.MOUSE_SCROLL_UP, musicwidget:command_volume_up() }, - --{ "", awesompd.MOUSE_SCROLL_DOWN, musicwidget:command_volume_down() }, - { "", awesompd.MOUSE_RIGHT, musicwidget:command_show_menu() }, - --{ "", "XF86AudioLowerVolume", musicwidget:command_volume_down() }, - --{ "", "XF86AudioRaiseVolume", musicwidget:command_volume_up() }, - --{ modkey, "Pause", musicwidget:command_playpause() } }) - { "", "XF86AudioPlay", musicwidget:command_playpause() } }) - --- Put your server definitions in this file, like this: ---musicwidget.servers = { --- { server = "localhost", --- port = 6600 }, --- { server = "192.168.0.72", --- port = 6600 } } -dofile(homedir .. "/.custom/awesome/awesompd.lua") - -musicwidget:run() -- After all configuration is done, run the widget diff --git a/config.dot/awesome.link/widgets/leds.lua b/config.dot/awesome.link/widgets/leds.lua deleted file mode 100644 index 382abdd..0000000 --- a/config.dot/awesome.link/widgets/leds.lua +++ /dev/null @@ -1,13 +0,0 @@ --- See https://bbs.archlinux.org/viewtopic.php?id=68511 -myledbox = widget({ type = "textbox" }) - -function run_leds() - local filedescripter = io.popen('leds') - local value = filedescripter:read() - filedescripter:close() - return value -end - -mytimer = timer({ timeout = 1 }) -mytimer:add_signal("timeout", function() myledbox.text = run_leds() end) -mytimer:start() diff --git a/config.dot/awesome.link/widgets/volume.lua b/config.dot/awesome.link/widgets/volume.lua deleted file mode 100644 index c183cb9..0000000 --- a/config.dot/awesome.link/widgets/volume.lua +++ /dev/null @@ -1,34 +0,0 @@ --- See http://awesome.naquadah.org/wiki/Volume_control_and_display -volume_widget = widget({ type = "textbox", name = "tb_volume", - align = "right" }) - -function update_volume(widget) - local fd = io.popen("amixer sget Master") - local status = fd:read("*all") - fd:close() - - local volume = tonumber(string.match(status, "(%d?%d?%d)%%")) / 100 - -- volume = string.format("% 3d", volume) - - status = string.match(status, "%[(o[^%]]*)%]") - - -- starting colour - local sr, sg, sb = 0x3F, 0x3F, 0x3F - -- ending colour - local er, eg, eb = 0xDC, 0xDC, 0xCC - - local ir = volume * (er - sr) + sr - local ig = volume * (eg - sg) + sg - local ib = volume * (eb - sb) + sb - interpol_colour = string.format("%.2x%.2x%.2x", ir, ig, ib) - if string.find(status, "on", 1, true) then - volume = " <span background='#" .. interpol_colour .. "'> </span>" - else - volume = " <span color='red' background='#" .. interpol_colour .. "'> M </span>" - end - widget.text = volume - end - -volumeTimer = timer({ timeout = 1 }) -volumeTimer:add_signal("timeout", function () update_volume(volume_widget) end) -volumeTimer:start() |