You are not logged in.

#1 2012-11-30 20:20:25

mrrhq
Member
Registered: 2012-11-07
Posts: 18

rc.lua needs reconfigured (Awesome WM v3.4.13+)

Hello,

I'm trying to solve a problem with my rc.lua file. I haven't updated it in a year, so I'm hoping that only a few functions or libraries were changed. I only know a little bit about Lua. I at least know it's a loose syntax language with syntax like JAVA and C *shrug*. But the Lua-specific syntax like the functions and other things I still have yet to understand and reference properly.

So I get an error when I first start up Awesome WM with "xinit awesome" (it's configured in my .xinitrc).

vZ2lnMQ

So I did "awesome -k" and the syntax is okay. The problem mostly lies within some misconfiguration. I'm hoping someone can spot it.

Here's what doesn't work right now in Awesome:
- Terminal colors only show up white
- Tiling doesn't work. Everything is windowed
- Sometimes when certain apps like Firefox is open and maximized, I can't click on the tags to change desktops, I can only use hotkeys.

So these need to be fixed somehow.

P.S: I also had a decent Vicious setup before and it broke Awesome WM. So instead of updating it, I just trashed the whole thing and now I'm going to start setting up those widgets all over again after I get this fixed. I don't remember why I did this...

Here's my current rc.lua:

-- Awesome 3 config created by Mr. R (mrrhq)
-- This work is released under the Public Domain
--
-- Debug this script with Xephyr before using
-- Read more about Xephyr by typing "man Xephyr"

--]== Libraries ==[--

-- Standard
  require("awful")
  require("awful.autofocus")
  require("awful.rules")

-- Theme
  require("beautiful")

-- Notification
  require("naughty")

-- Widgets
  require("vicious")

-- Program Menu
--require("debian.menu")

--]== Error Handling ==[--

if awesome.startup_errors then
  naughty.notify(
    {
      preset = naughty.config.presets.critical,
      title = "Error(s) during startup.",
      text = awesome.startup_errors,
    }
  )
end

do
  local in_error = false
  awesome.add_signal(
    "debug::error",
    function (err)
      if in_error then
        return 
      end
      in_error = true
      naughty.notify(
        {
          preset = naughty.config.presets.critical,
          title = "An error occured:",
          text = err,
        }
      )
      in_error = false
    end
  )
end

--]== Variables ==[--

-- Set default terminal
  local terminal = "urxvt"
--local terminal = "uxterm"

-- Set default text editor defined by $EDITOR or vi
-- Check your shell config for $EDITOR if it exists or "echo $EDITOR"
  local editor = os.getenv("EDITOR") or "vi"

-- Set terminal and editor commands
  local terminal_cmd = terminal .. " -e "
  local termedit_cmd = terminal .. " -e " .. editor .. " "

-- Set the path for other Lua files
  local config_lua = awful.util.getdir("config") .. "/rc.lua"
  local theme_lua =  os.getenv("HOME") .. "/.config/awesome/themes/theme.lua"
  beautiful.init(theme_lua)

-- You can remap modifier keys used in keybinds with these variables
  local key_shift = "Shift"
  local key_ctrl  = "Control"
  local key_alt   = "Mod1"
  local key_super = "Mod4"
  local key_menu  = "Mod5"

  awful.button.ignore_modifiers =
  {
    "Lock",
  }

-- Other variables
  local screens = screen.count()
  local usebattery = false

--]== Layout ==[--

-- Comment out any you do not use
layouts =
{
  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.max,
--awful.layout.suit.max.fullscreen,
  awful.layout.suit.spiral,
  awful.layout.suit.spiral.dwindle,
  awful.layout.suit.magnifier,
  awful.layout.suit.floating,
}

--]== Tagging ==[--

-- Define the tag name and the corresponding layout in order
-- NOTE: 10th tag is accessed with key_super + 0
tags = {}
for s = 1, screens do
  tags[s] = awful.tag(
    { 
      "main", -- 1
      "webz", -- 2
      "chat", -- 3
      "edit", -- 4
      "code", -- 5
      "artz", -- 6
      "song", -- 7
      "game", -- 8
      "misc", -- 9
      "work", -- 0
    },
    s,
    {
      layouts[01], -- 1
      layouts[12], -- 2
      layouts[03], -- 3
      layouts[01], -- 4
      layouts[01], -- 5
      layouts[07], -- 6
      layouts[04], -- 7
      layouts[12], -- 8
      layouts[12], -- 9
      layouts[07], -- 0
    }
  )
  tags[s][1].selected = true
end

--]== Menus ==[--

awesomemenu =
{
  { "edit config", termedit_cmd .. config_lua },
  { "edit theme", termedit_cmd .. theme_lua },
  { "reload", awesome.restart },
  { "take screenshot", terminal_cmd .. "scrot -d 1 /media/mstore/img/ss/screen-`date +%R-%F:%S`.png" },
  { "logout", awesome.quit },
  { "shutdown", "gksu shutdown -h now" },
  { "reboot", "gksu shutdown -r now" },
}

-- You should replace debian.menu with your own menu
programmenu =
{
}

-- Main menu
awmainmenu = awful.menu(
  {
    items =
    {
      { "awesome", awesomemenu },
      { "programs", programmenu },
      { "open terminal", terminal },
    }
  }
)

--]== Widgets ==[--

-- CPU Widget
awcpu    = widget({ type = "textbox" })
awcpuimg = widget({ type = "imagebox" })
awcpu_tt = awful.tooltip({ objects = { awcpu, awcpuimg },})
awcpuimg.image = image(beautiful.cpu_widget_icon)

vicious.register(awcpu, vicious.widgets.cpu,
  "$1%", 3
)

  wibox_top   = {}
  wibox_btm   = {}
  awpromptbox = {}
  awlayoutbox = {}
  awtaglist   = {}
  awtasklist  = {}

-- Initialize a table for the taglist
awtaglist.buttons = awful.util.table.join(
  awful.button({           }, 1, awful.tag.viewonly),
  awful.button({ key_super }, 1, awful.client.movetotag),
  awful.button({           }, 3, awful.tag.viewtoggle),
  awful.button({ key_super }, 3, awful.client.toggletag),
  awful.button({           }, 4, awful.tag.viewnext),
  awful.button({           }, 5, awful.tag.viewprev)
)

-- Create the main menu bottom
awlauncher = awful.widget.launcher(
  {
    image = image(beautiful.launcher_icon),
    menu = awmainmenu,
  }
)

-- Create the system tray widget for open programs
awsystray = widget(
  {
    type = "systray"
  }
)

awtasklist.buttons = awful.util.table.join(
  awful.button({ }, 1,
    function (c)
      if c == client.focus then
        c.minimized = true
        else if not c:isvisible() then
          awful.tag.viewonly(c:tags()[1])
        end
        client.focus = c
        c:raise()
      end
    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
  )
)

-- These widgets apply to every screen
for s = 1, screens do
  -- Create a prompt widget. For "Run: " and stuff.
  awpromptbox[s] = awful.widget.prompt(
    {
      layout = awful.widget.layout.horizontal.leftright,
    }
  )

  awlayoutbox[s] = awful.widget.layoutbox(s)

  awlayoutbox[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)
    )
  )

  awtaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, awtaglist.buttons)

  awtasklist[s] = awful.widget.tasklist(
    function(c)
      return awful.widget.tasklist.label.currenttags(c, s)
    end,
    awtasklist.buttons
  )

  -- Create the top wibox (panel)
  wibox_top[s] = awful.wibox(
    {
      position = "top",
      height = "12",
      screen = s,
    }
  )

  wibox_btm[s] = awful.wibox(
    {
      position = "bottom",
      height = "12",
      screen = s,
    }
  )

  -- Define the widgets for the top wibox
  wibox_top[s].widgets =
  {
    {
      awlauncher,
      awtaglist[s],
      awpromptbox[s],
      layout = awful.widget.layout.horizontal.leftright,
    },
    awlayoutbox[s],
    s == 1 and awsystray or nil,
    awtasklist[s],
    layout = awful.widget.layout.horizontal.rightleft,
  }

  wibox_btm[s].widgets =
  {
    {
      awcpu, awcpuimg,
      layout = awful.widget.layout.horizontal.leftright,
    },
    layout = awful.widget.layout.horizontal.rightleft,
  }
end

--]== Bindings ==[--

root.buttons(
  awful.util.table.join(
    awful.button({}, 3, function () awmainmenu:toggle() end),
    awful.button({}, 4, awful.tag.viewnext),
    awful.button({}, 5, awful.tag.viewprev)
  )
)

-- Define keys globally
globalkeys = awful.util.table.join(
  awful.key({ key_super,           }, "Escape",
    awful.tag.history.restore
  ),
  awful.key({ key_super,           }, "F1",
    function ()
      awful.prompt.run(
        {
	  prompt = "Read manpage: "
        },
        awpromptbox[mouse.screen].widget,
	awful.util.spawn_with_shell("man man ", mouse.screen)
      )
    end
  ),
  awful.key({ key_super,           }, "F2",
    function ()
      awpromptbox[mouse.screen]:run()
    end
  ),
  awful.key({ key_super,           }, "F3",
    function ()
      awful.prompt.run(
        {
          prompt = "Run Lua code: "
        },
        awpromptbox[mouse.screen].widget,
        awful.util.eval,
	nil,
        awful.util.getdir("cache") .. "/history_eval"
      )
    end
  ),
  awful.key({ key_super,           }, "BackSpace",
    awful.tag.history.restore
  ),
  awful.key({ key_super,           }, "Print",
    function ()
      awful.util.spawn("scrot -e 'mv $f ~/screenshots/ 2> /dev/null'")
    end
  ),
  awful.key({ key_super,           }, "Left",
    function ()
      awful.client.focus.bydirection("left")
      if client.focus then
        client.focus:raise()
      end
    end
  ),
  awful.key({ key_super,           }, "Right",
    function ()
      awful.client.focus.bydirection("right")
      if client.focus then
        client.focus:raise()
      end
    end
  ),
  awful.key({ key_super,           }, "Up",
    function ()
      awful.client.focus.bydirection("up")
      if client.focus then
        client.focus:raise()
      end
    end
  ),
  awful.key({ key_super,           }, "Down",
    function ()
      awful.client.focus.bydirection("down")
      if client.focus then
        client.focus:raise()
      end
    end
  ),
  awful.key({ key_super,           }, "b",
    function ()
      wibox_btm[mouse.screen].visible = not wibox_btm[mouse.screen].visible
    end
  ),
  awful.key({ key_super, key_shift }, "b",
    function ()
      wibox_top[mouse.screen].visible = not wibox_top[mouse.screen].visible
    end
  ),
  awful.key({ key_super, key_ctrl  }, "j",
    awful.tag.viewprev
  ),
  awful.key({ key_super, key_ctrl  }, "k",
    awful.tag.viewnext
  ),
  awful.key({ key_super,           }, "w",
    function ()
      awmainmenu:show({ keygrabber = true })
    end
  ),
  awful.key({ key_super,           }, "j",
    function ()
      awful.screen.focus_relative(1)
    end
  ),
  awful.key({ key_super,           }, "k",
    function ()
      awful.screen.focus_relative(-1)
    end
  ),
  awful.key({ key_super,           }, "u",
    awful.client.urgent.jumpto
  ),
  awful.key({ key_super,           }, "Tab",
    function ()
      awful.client.focus.history.previous()
      if client.focus then
        client.focus:raise()
      end
    end
  ),
  awful.key({ key_super, key_ctrl  }, "r",
    awesome.restart
  ),
  awful.key({ key_super, key_ctrl  }, "q",
    awesome.quit
  ),
  awful.key({ key_super,           }, "Return",
    function ()
      awful.util.spawn(terminal)
    end
  ),
  awful.key({ key_super,           }, "l",
    function ()
      awful.tag.incmwfact( 0.05)
    end
  ),
  awful.key({ key_super,           }, "h",
    function ()
      awful.tag.incmwfact(-0.05)
    end
  ),
  awful.key({ key_super, key_shift }, "h",
    function ()
      awful.tag.incnmaster( 1)
    end
  ),
  awful.key({ key_super, key_shift }, "l",
    function ()
      awful.tag.incnmaster(-1)
    end
  ),
  awful.key({ key_super, key_ctrl  }, "h",
    function ()
      awful.tag.incncol( 1)
    end
  ),
  awful.key({ key_super, key_ctrl  }, "l",
    function ()
      awful.tag.incncol(-1)
    end
  ),
  awful.key({ key_super,           }, "space",
    function ()
      awful.layout.inc(layouts,  1)
    end
  ),
  awful.key({ key_super, key_shift }, "space",
    function ()
      awful.layout.inc(layouts, -1)
    end
  ),
  awful.key({ key_super, key_ctrl  }, "n",
    awful.client.restore
  )
)

-- Define keys for the numbers
keynumber = 0
for s = 1, screens do
  keynumber = math.min(10, math.max(#tags[s], keynumber));
end

for i = 1, keynumber do
  globalkeys = awful.util.table.join(globalkeys,
    awful.key({ key_super,         }, "#" .. i + 9,
      function ()
        local screen = mouse.screen
        if tags[screen][i] then
          awful.tag.viewonly(tags[screen][i])
        end
      end
    ),
    awful.key({ key_super, key_ctrl  }, "#" .. i + 9,
      function ()
        local screen = mouse.screen
        if tags[screen][i] then
          awful.tag.viewtoggle(tags[screen][i])
        end
      end
    ),
    awful.key({ key_super, key_shift }, "#" .. i + 9,
      function ()
        if client.focus and tags[client.focus.screen][i] then
          awful.client.movetotag(tags[client.focus.screen][i])
        end
      end
    ),
    awful.key({ key_super, key_alt   }, "#" .. i + 9,
      function ()
        if client.focus and tags[client.focus.screen][i] then
          awful.client.toggletag(tags[client.focus.screen][i])
        end
      end
    )
  )
end

-- Define keys for the client
clientkeys = awful.util.table.join(
  awful.key({ key_super,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  awful.key({ key_super, key_shift }, "c",      function (c) c:kill() end),
  awful.key({ key_super, key_ctrl  }, "space",  awful.client.floating.toggle),
  awful.key({ key_super, key_ctrl  }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  awful.key({ key_super,           }, "o",      awful.client.movetoscreen),
  awful.key({ key_super, key_shift }, "r",      function (c) c:redraw() end),
  awful.key({ key_super,           }, "t",      function (c) c.ontop = not c.ontop end),
  awful.key({ key_super,           }, "n",
    function (c)
      c.minimized = true
    end
  ),
  awful.key({ key_super,           }, "m",
    function (c)
      c.maximized_horizontal = not c.maximized_horizontal
      c.maximized_vertical   = not c.maximized_vertical
    end
  )
)

-- Define number keys for each tag
clientbuttons = awful.util.table.join(
  awful.button({           }, 1, function (c) client.focus = c; c:raise() end),
  awful.button({ key_super }, 1, awful.mouse.client.move),
  awful.button({ key_super }, 3, awful.mouse.client.resize)
)

root.keys(globalkeys)

--]== Rules ==[--

awful.rules.rules =
{
  {
    rule =
    {
      class = "",
    },
    properties =
    {
      border_width = beautiful.border_width,
      border_color = beautiful.border_normal,
      focus = true,
      keys = clientkeys,
      buttons = clientbuttons
    }
  },
  {
    rule =
    {
      class = "MPlayer",
    },
    properties =
    {
      floating = true,
    },
  },
  {
    rule =
    {
      class = "Firefox",
    },
    properties =
    {
      tag = tags[1][2]
    },
  },
}

--]== Signals ==[--

client.add_signal("manage",
  function (c, startup)
    --awful.titlebar.add(c, { key_super = key_super })

    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
      awful.client.setslave(c)
      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
)

Last edited by mrrhq (2012-11-30 20:23:41)

Offline

#2 2012-11-30 23:34:42

desaparecido
Member
From: Liège, Belgium
Registered: 2010-03-14
Posts: 155

Re: rc.lua needs reconfigured (Awesome WM v3.4.13+)

hi, i read your post quickly and i'm tired so I see your rc.lua not in details but I find this different in my rc.lua:

your config:
require("vicious")

my config:
local vicious = require("vicious")

I don't remember where I read about this change (probably in wiki of awesome or here, I don't know now) , but is necesary.. I tested my config without this change and I fallback in default config.

good test smile


KF5 & Plasma5 (git versions) - Awesome WM
ASUS Sabertooth 990FX - AMD FX8350 - ATI Radeon HD 7970
[testing] repo

Offline

Board footer

Powered by FluxBB