]> git.rmz.io Git - dotfiles.git/commitdiff
awesome: some cleanup
authorSamir Benmendil <samir.benmendil@gmail.com>
Wed, 8 Oct 2014 07:18:22 +0000 (08:18 +0100)
committerSamir Benmendil <samir.benmendil@gmail.com>
Wed, 8 Oct 2014 07:18:22 +0000 (08:18 +0100)
awesome/bindings.lua
awesome/conky.lua
awesome/menu.lua
awesome/rc.lua
awesome/rules.lua
awesome/tags.lua
awesome/topbar.lua
awesome/widgets/battery_widget.lua
awesome/widgets/volume_widget.lua

index 41a623663ad277a05bbcad4a9223cb30037a0381..db5f7c9b6c349b5124f8797891d1a3e04401cb87 100644 (file)
@@ -1,11 +1,8 @@
 -- Default modkey.
--- Usually, Mod4 is the key with a logo between Control and Alt.
--- If you do not like this or do not have such a key,
--- 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"
+altkey = "Mod1"
 
--- {{{1 Mouse bindings
+-- Mouse bindings {{{1
 root.buttons(awful.util.table.join(
     awful.button({ }, 3, function () mymainmenu:toggle() end),
     awful.button({ }, 4, awful.tag.viewnext),
@@ -17,9 +14,9 @@ clientbuttons = awful.util.table.join(
     awful.button({ modkey }, 1, awful.mouse.client.move),
     awful.button({ modkey }, 3, awful.mouse.client.resize))
 
--- {{{1 Global Keys
+-- Global Keys {{{1
 globalkeys = awful.util.table.join(globalkeys,
-    -- {{{2 Awesome Keys
+    -- Awesome Keys {{{2
     awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
     awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
 
@@ -69,7 +66,7 @@ globalkeys = awful.util.table.join(globalkeys,
     -- Menubar
     awful.key({ modkey }, "p", function() menubar.show() end),
 
-    -- {{{2 My Keys
+    -- My Keys {{{2
     -- Menu
     awful.key({ modkey }, "w", function () mymainmenu:show({ coords = { x = 0, y = 0}}) end),
     -- Prompt
@@ -95,9 +92,9 @@ globalkeys = awful.util.table.join(globalkeys,
     awful.key({ }, "XF86AudioMute",         function () awful.util.spawn("ponymix toggle")     end)
 )
 
--- {{{1 Client keys
+-- Client keys {{{1
 clientkeys = awful.util.table.join(
-    -- {{{2 Awesome Client Keys
+    -- Awesome Client Keys {{{2
     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
     awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
@@ -114,7 +111,7 @@ clientkeys = awful.util.table.join(
             c.maximized_vertical   = not c.maximized_vertical
         end),
 
-    -- {{{2 My Client Keys
+    -- My Client Keys {{{2
     -- Move client to screen
     awful.key({ modkey, "Shift" }, "#94",      awful.client.movetoscreen ),
     awful.key({ modkey, "Shift" }, "#49",      awful.client.movetoscreen ),
@@ -124,7 +121,7 @@ clientkeys = awful.util.table.join(
     -- }}}
 )
 
--- {{{1 Tags
+-- Tags {{{1
 -- 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.
index 0f9eca9e5fd74e61ef9aa0c2d78bfbd3622f499d..71996cfac632612797c6181c6a4422e56fa8f5ef 100644 (file)
@@ -2,60 +2,53 @@
 local utils = require("utils")
 
 local function get_conky()
-    local clients = client.get()
-    local conky = nil
-    local i = 1
-    while clients[i]
-    do
-        if clients[i].class == "Conky"
-        then
-            conky = clients[i]
-        end
-        i = i + 1
+  local clients = client.get()
+  local conky = nil
+  local i = 1
+  while clients[i] do
+    if clients[i].class == "Conky" then
+      conky = clients[i]
     end
-    return conky
+    i = i + 1
+  end
+  return conky
 end
 
 local function raise_conky()
-    local conky = get_conky()
-    if conky
-    then
-        conky.ontop = true
-        conky.hidden = false
-    end
+  local conky = get_conky()
+  if conky then
+    conky.ontop = true
+    conky.hidden = false
+  end
 end
 
 local function lower_conky()
-    local conky = get_conky()
-    if conky
-    then
-        conky.ontop = false
-        conky.hidden = true
-    end
+  local conky = get_conky()
+  if conky then
+    conky.ontop = false
+    conky.hidden = true
+  end
 end
 
 local function toggle_conky()
-    local conky = get_conky()
-    if conky
-    then
-        if conky.ontop
-        then
-            conky.ontop = false
-        else
-            conky.ontop = true
-        end
+  local conky = get_conky()
+  if conky then
+    if conky.ontop then
+      conky.ontop = false
+    else
+      conky.ontop = true
     end
+  end
 end
 
 utils.rules.append({
-    { rule = { class = "Conky" },
-               properties = { floating = true,
-                              sticky = true,
-                              ontop = false,
-                              hidden = true,
-                              focusable = true,
-                              size_hints = {"program_position", "program_size"} 
-                             } },
+  { rule = { class = "Conky" },
+             properties = { floating = true,
+                            sticky = true,
+                            ontop = false,
+                            hidden = true,
+                            focusable = true,
+                            size_hints = {"program_position", "program_size"} } },
 })
 
 -- add global key
index 2c3a208c56daab166a92457ca374a9132334d636..54a30e31e424972048ee8ac6ae3edf280de0e250 100644 (file)
@@ -4,7 +4,6 @@ require('freedesktop.menu')
 
 freedesktopmenu = freedesktop.menu.new()
 
--- {{{ Menu
 -- Setup global menu keys
 awful.menu.menu_keys.up    = { "k", "Up"}
 awful.menu.menu_keys.down  = { "j", "Down"}
@@ -35,4 +34,3 @@ mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
 
 -- Menubar configuration
 menubar.utils.terminal = terminal -- Set the terminal for applications that require it
--- }}}
index 9cd44814f3b77e36a0984d616e02b9582f413577..826b9089ba3cd4516d629f8dbd2c4fdd1d60a726 100644 (file)
@@ -1,15 +1,13 @@
--- Standard awesome library
+-- Standard awesome library {{{1
 gears = require("gears")
 awful = require("awful")
 awful.rules = require("awful.rules")
 require("awful.autofocus")
--- Theme handling library
 beautiful = require("beautiful")
--- Notification library
 naughty = require("naughty")
 menubar = require("menubar")
 
--- {{{ Error handling
+-- Error handling {{{1
 -- 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
@@ -32,9 +30,8 @@ do
         in_error = false
     end)
 end
--- }}}
 
--- {{{ Variable definitions
+-- Variable definitions {{{1
 -- Themes define colours, icons, and wallpapers
 beautiful.init(awful.util.getdir("config").."/themes/mlp/theme.lua")
 
@@ -43,34 +40,23 @@ terminal = "urxvtc"
 editor = os.getenv("EDITOR") or "vim"
 editor_cmd = terminal .. " -e " .. editor
 
--- Tags
-require("tags")
--- }}}
-
--- {{{ Wallpaper
+-- Wallpaper {{{1
 if beautiful.wallpaper then
     for s = 1, screen.count() do
         gears.wallpaper.maximized(beautiful.wallpaper, s, true)
     end
 end
--- }}}
 
---Menu
+-- Require files {{{1
+require("tags")
 require("menu")
-
--- Topbar
 require("topbar")
-
--- Mouse/Key Bindings
 require("bindings")
-
--- Rules
 require("rules")
-
--- conky
 require("conky")
+require("autostart")
 
--- {{{ Signals
+-- Signals {{{1
 -- Signal function to execute when a new client appears.
 client.connect_signal("manage", function (c, startup)
     -- Enable sloppy focus
@@ -96,10 +82,6 @@ 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)
--- }}}
 
 -- Set keys
 root.keys(globalkeys)
-
--- Autostart applications
-require("autostart")
index b167ec2dac0c387d994cc7ae7c355d21d5b4898f..3fe2c9ffc057c247011106f23ccb89cdd6f68c4f 100644 (file)
@@ -1,6 +1,5 @@
 local utils = require("utils")
 
--- {{{ Rules
 if utils.host == "shada"   then mediatag = tags[2][3] end
 if utils.host == "chronos" then mediatag = tags[1][4] end
 
@@ -34,7 +33,7 @@ awful.rules.rules = {
                      skip_taskbar = true,
                      ontop = true,
                      x = 1920 - 310, y = mywibox[mouse.screen].height,
-                     height = 100, width = 100 } },
+                     width = 100, height = 100 } },
     { rule = { class = "URxvt", instance = "mutt" },
       properties = { tag = wwwtag,
                      function (c) awful.client.setslave(c) end } },
@@ -55,4 +54,3 @@ awful.rules.rules = {
     { rule = { class = "Steam" },
       properties = { tag = tags[1][9] } },
 }
--- }}}
index fcbb15906abb425cb635f2cc874604a04315e4c9..cefc22a38b00131fefe623029c5f06134e750664 100644 (file)
@@ -1,4 +1,4 @@
--- {{{ Layouts
+-- Layouts {{{1
 -- Table of layouts to cover with awful.layout.inc, order matters.
 layouts =
 {
@@ -15,14 +15,13 @@ layouts =
     awful.layout.suit.max.fullscreen,
     --awful.layout.suit.magnifier
 }
--- }}}
 
--- {{{ Tags
+-- Tags {{{1
 local mytags = {}
 local path = beautiful.path
 local icon_only = true
 
--- {{{ single screen
+-- single screen {{{2
 mytags[1] = {}
 mytags[1][1] = {
     { name = "1", layout = awful.layout.suit.tile.left,   mwfact=0.50, icon = path.."/cutiemarks/pinkie_pie.png"},
@@ -35,9 +34,8 @@ mytags[1][1] = {
     { name = "8", layout = awful.layout.suit.max,         mwfact=0.50, icon = path.."/cutiemarks/princess_celestia.png"},
     { name = "9", layout = awful.layout.suit.floating,    mwfact=0.50, icon = path.."/cutiemarks/princess_luna.png"},
 }
--- }}}
 
--- {{{ Dual screen
+-- Dual screen {{{2
 mytags[2] = {}
 mytags[2][1] = {
     { name = "1", layout = awful.layout.suit.tile.left,   mwfact=0.50, icon = path.."/cutiemarks/pinkie_pie.png"},
@@ -62,8 +60,8 @@ mytags[2][2] = {
     { name = "8", layout = awful.layout.suit.tile,        mwfact=0.50, icon = path.."/cutiemarks/thunderlane.png"},
     { name = "9", layout = awful.layout.suit.max,         mwfact=0.50, icon = path.."/cutiemarks/bon_bon.png"},
 }
--- }}}
 
+-- Tags {{{2
 tags = {}
 local sc = screen.count()
 for s = 1, sc do
@@ -79,4 +77,3 @@ for s = 1, sc do
     end
     tags[s][1].selected = true
 end
--- }}}
index e40b474c7cc3136b090e09e92f770275751e825a..b945d80193a7dd846dd4c5ffd579344168ca8cec 100644 (file)
@@ -9,7 +9,7 @@ mytextclock = awful.widget.textclock(" %a %b %d, %k:%M ", 10)
 separator = wibox.widget.textbox()
 separator:set_markup('<span font="Symbola 10" color="#404040">│</span>')
 
--- {{{ Wibox
+-- Wibox {{{1
 -- Create a wibox for each screen and add it
 mywibox = {}
 mypromptbox = {}
@@ -108,4 +108,3 @@ for s = 1, screen.count() do
 
     mywibox[s]:set_widget(layout)
 end
--- }}}
index e1be687011e2a7083491b1395b38882d19ea44eb..3cea2f88ee87be6105401c0015f01e4d06114f24 100644 (file)
@@ -39,8 +39,7 @@ local function batclosure ()
             prefix = "Bat:"
             if charge <= nextlim then
                 naughty.notify({title = "⚡ Warning! ⚡",
-                                text = "Battery has leaked most of its power ( ⚡ "
-                                        ..charge.."%)!",
+                                text = "Battery has leaked most of its power ( ⚡ "..charge.."%)!",
                                 timeout = 7,
                                 position = "top_right",
                                 fg = beautiful.fg_focus,
@@ -60,7 +59,6 @@ local function batclosure ()
 end
 
 batterywidget = wibox.widget.textbox()
-vicious.register(batterywidget, vicious.widgets.bat, batclosure(),
-                    31, "BAT0")
+vicious.register(batterywidget, vicious.widgets.bat, batclosure(), 31, "BAT0")
 
 return batterywidget
index 957236e08f9380b4793da7c059d9633cf0d6e7f7..9156af85332447f8e2dadc55304fdb9dd1ffdda1 100644 (file)
@@ -4,7 +4,7 @@ vicious.contrib = require("vicious.contrib")
 local utils = require("utils")
 local volwidget = { }
 
---{{{ Volume progressbar
+-- Volume Widget {{{1
 -- Select device
 local device = ""
 if utils.host == "chronos" then device = "alsa_output.pci-0000_00_1b.0.analog-stereo" end