Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'attempt to index a nil value (field 'default')' after adding theme to rc.lua #2

Open
xbolivarhazboun opened this issue Nov 9, 2021 · 2 comments

Comments

@xbolivarhazboun
Copy link

xbolivarhazboun commented Nov 9, 2021

Hi,

I followed the guide to a tee and I'm getting a few errors. I used to use your config a year or so ago but now I can't seem to get it to work.

My lua.rc looked like this:

-- [ author ] -*- time-stamp-pattern: "@Changed[\s]?:[\s]+%%$"; -*- ------------
-- @File   : rc.lua
-- @Author : Marcel Arpogaus <marcel dot arpogaus at gmail dot com>
--
-- @Created: 2021-01-26 16:56:54 (Marcel Arpogaus)
-- @Changed: 2021-07-22 10:17:22 (Marcel Arpogaus)
-- [ description ] -------------------------------------------------------------
-- This file is part of my modular awesome WM configuration.
-- [ license ] -----------------------------------------------------------------
-- Copyright (C) 2021 Marcel Arpogaus
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------------
-- [ required modules ] --------------------------------------------------------
-- Standard awesome library
local awful = require('awful')

-- rc modules
local assets = require('rc.assets')
local behavior = require('rc.behavior')
local decorations = require('rc.decorations')
local error_handling = require('rc.error_handling')
local key_bindings = require('rc.key_bindings')
local layouts = require('rc.layouts')
local menus = require('rc.menus')
local mouse_bindings = require('rc.mouse_bindings')
local screen = require('rc.screen')
local tags = require('rc.tags')
local theme = require('rc.theme')

-- heper functions
local utils = require('rc.utils')

-- Mac OSX like 'Expose' view of all clients.
local revelation = require('revelation')

-- configuration file
local config = utils.load_config()

local chosen_theme= "ayu"
beautiful.init(string.format("%s/.config/awesome/themes/%s/theme.lua", os.getenv("HOME"), chosen_theme))
awful.screen.connect_for_each_screen(beautiful.at_screen_connect)

-- ensure that there's always a client that has focus
require('awful.autofocus')

-- [ initialization ] ----------------------------------------------------------
-- error handling
error_handling.init()

-- tags
tags.init(config.tagnames)

-- layouts
layouts.init(config.layouts)

-- theme
theme.init(config.theme)

-- assets
assets.init(config.assets)

-- wibars and widgest
decorations.init(config.decorations)

-- menus
menus.init(config.menus, config.applications)

-- mouse bindings
mouse_bindings.init(config.bindings, menus.mainmenu)

-- key bindings
key_bindings.init(config.bindings, config.applications, menus.mainmenu)

-- behavior
behavior.init(config.behavior, mouse_bindings.client_buttons,
              key_bindings.client_keys)

-- wibars and widgets
screen.init(config.screen, tags.tagnames, mouse_bindings.taglist_buttons,
            mouse_bindings.tasklist_buttons, menus.mainmenu, menus.exitmenu)
for _, d in ipairs(decorations.get()) do
  screen.register(d)
end

-- Initialize revelation
revelation.init()

-- [ autorun programs ] --------------------------------------------------------
awful.spawn.with_shell('~/.config/awesome/autorun.sh')

Which gave me this error:

error: /home/tex/.config/awesome/rc.lua:52: attempt to index a nil value (global 'beautiful')

Naturally I tried adding a reference for beautiful by adding the following right before declaring chosen_theme.

local beautiful = require('beautiful')

This was unsucessful, I end up with a different error stating:

error while running function!
stack traceback:
	/home/tex/.config/awesome/themes/ayu/theme.lua:65: in function 'themes.ayu.ayu_theme.at_screen_connect'
	/usr/share/awesome/lib/awful/screen.lua:438: in function 'awful.screen.connect_for_each_screen'
	/home/tex/.config/awesome/rc.lua:53: in main chunk
error: /home/tex/.config/awesome/themes/ayu/theme.lua:65: attempt to index a nil value (field 'default')
error while running function!
stack traceback:
	/home/tex/.config/awesome/themes/ayu/theme.lua:65: in function 'themes.ayu.ayu_theme.at_screen_connect'
	/usr/share/awesome/lib/awful/screen.lua:438: in function 'awful.screen.connect_for_each_screen'
	/home/tex/.config/awesome/rc.lua:53: in main chunk
error: /home/tex/.config/awesome/themes/ayu/theme.lua:65: attempt to index a nil value (field 'default')

Lua is quite foreign to me, any help would be greatly appreciated.

@Manvendra-div
Copy link

ya same issue

@eekhdv
Copy link

eekhdv commented Apr 2, 2022

You need to open ~/.config/awesome/themes/ayu/theme.lua and edit this lines :

FROM:

awful.tag(
                 awful.util.tagnames, s,
                 awful.layout.default[s.index] or awful.layout.layouts[1]
             )

TO:

awful.tag(
                 awful.util.tagnames, s,
                 awful.layout.layouts[1]
             )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants