您尚未登录。

#1 2015-11-07 13:41:03

Archnew
会员
注册时间: 2015-09-20
帖子: 147

awesome壁纸问题

awesome环境
执行完以下代码,然后把壁纸(rc.lua和theme.lua)全部路径都改成:~/.config/awesome/themes/default/theme.lua

$ mkdir -p ~/.config/awesome/
$ cp /etc/xdg/awesome/rc.lua  ~/.config/awesome
$ cp /usr/share/awesome/themes/default ~/.config/awesome/themes

接着把wiki上的代码如下,替代rc.lua里的,结果每次登录都会报错
随机墙纸
请把以下代码加入你的 rc.lua(for awesome >= 3.5):

-- configuration - edit to your liking
wp_index = 1
wp_timeout  = 10
wp_path = "/path/to/wallpapers/"
wp_files = { "01.jpg", "02.jpg", "03.jpg" }
 
-- setup the timer
wp_timer = timer { timeout = wp_timeout }
wp_timer:connect_signal("timeout", function()
 
  -- set wallpaper to current index for all screens
  for s = 1, screen.count() do
    gears.wallpaper.maximized(wp_path .. wp_files[wp_index], s, true)
  end
 
  -- stop the timer (we don't need multiple instances running at the same time)
  wp_timer:stop()
 
  -- get next random index
  wp_index = math.random( 1, #wp_files)
 
  --restart the timer
  wp_timer.timeout = wp_timeout
  wp_timer:start()
end)
 
-- initial start when rc.lua is first run
wp_timer:start()

  教程来自wiki:https://wiki.archlinux.org/index.php/Awesome_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)

最近编辑记录 Archnew (2015-11-07 13:43:24)


懒是一切的原罪

离线

#2 2015-11-07 13:49:07

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,470
个人网站

Re: awesome壁纸问题

报错信息呢?

离线

#3 2015-11-07 13:58:00

Archnew
会员
注册时间: 2015-09-20
帖子: 147

Re: awesome壁纸问题

依云 说:

报错信息呢?

对了,今天我把你的整套配置下载下来了,不知道是不是3.4的原因,我现在的是3.5.6,那个的报错信息,我有记录下来,我刚试的这个忘了记录,我先给你看看那个记录的,后来我把你的配置直接copy过去的,报错如下

Oops,there were errors during startup!
error while running function.
stack traceback:
/home/xiaoming/.config/awesome/rc.lua:34:in main chunk.
error: /home/xiaoming/.config/awesome/rc.lua:34:attempt to call a nil value(field 'add_signal').


懒是一切的原罪

离线

#4 2015-11-07 14:13:36

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,470
个人网站

Re: awesome壁纸问题

add_signal 是 3.4 的。

离线

#5 2015-11-07 14:19:23

Archnew
会员
注册时间: 2015-09-20
帖子: 147

Re: awesome壁纸问题

依云 说:

add_signal 是 3.4 的。

谢谢,怪不得


懒是一切的原罪

离线

#6 2015-11-07 14:26:42

Archnew
会员
注册时间: 2015-09-20
帖子: 147

Re: awesome壁纸问题

依云 说:

报错信息呢?

我刚试了下,不加壁纸代码,直接运行的时候出现的报错信息是:
Oops,an error happened!
/home/xioaming/.config/awesome/rc.lua:443:bad argument #-1 to '_newindex'(string expected,got nil)
Oops,an error happened!
/home/xioaming/.config/awesome/rc.lua:444:bad argument #-1 to '_newindex'(string expected,got nil)


懒是一切的原罪

离线

#7 2015-11-07 14:58:37

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,470
个人网站

Re: awesome壁纸问题

Archnew 说:
依云 说:

报错信息呢?

我刚试了下,不加壁纸代码,直接运行的时候出现的报错信息是:
Oops,an error happened!
/home/xioaming/.config/awesome/rc.lua:443:bad argument #-1 to '_newindex'(string expected,got nil)
Oops,an error happened!
/home/xioaming/.config/awesome/rc.lua:444:bad argument #-1 to '_newindex'(string expected,got nil)

把附近的代码贴出来。

离线

#8 2015-11-07 15:09:51

Archnew
会员
注册时间: 2015-09-20
帖子: 147

Re: awesome壁纸问题

依云 说:
Archnew 说:
依云 说:

报错信息呢?

我刚试了下,不加壁纸代码,直接运行的时候出现的报错信息是:
Oops,an error happened!
/home/xioaming/.config/awesome/rc.lua:443:bad argument #-1 to '_newindex'(string expected,got nil)
Oops,an error happened!
/home/xioaming/.config/awesome/rc.lua:444:bad argument #-1 to '_newindex'(string expected,got nil)

把附近的代码贴出来。

-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c, startup)
    -- Enable sloppy focus
    c: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)

    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 pos$
        if not c.size_hints.user_position and not c.size_hints.program_position$
            awful.placement.no_overlap(c)
            awful.placement.no_offscreen(c)
        end
    end

    local titlebars_enabled = false
    if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
  -- 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.move(c)
                end),
                awful.button({ }, 3, function()
                    client.focus = c
                    c:raise()
                    awful.mouse.client.resize(c)
                end)
                )

        -- Widgets that are aligned to the left
        local left_layout = wibox.layout.fixed.horizontal()
        left_layout:add(awful.titlebar.widget.iconwidget(c))
        left_layout:buttons(buttons)

        -- Widgets that are aligned to the right
 local right_layout = wibox.layout.fixed.horizontal()
        right_layout:add(awful.titlebar.widget.floatingbutton(c))
        right_layout:add(awful.titlebar.widget.maximizedbutton(c))
        right_layout:add(awful.titlebar.widget.stickybutton(c))
        right_layout:add(awful.titlebar.widget.ontopbutton(c))
        right_layout:add(awful.titlebar.widget.closebutton(c))

        -- The title goes in the middle
        local middle_layout = wibox.layout.flex.horizontal()
        local title = awful.titlebar.widget.titlewidget(c)
 title:set_align("center")
        middle_layout:add(title)
        middle_layout:buttons(buttons)

        -- Now bring it all together
        local layout = wibox.layout.align.horizontal()
        layout:set_left(left_layout)
        layout:set_right(right_layout)
        layout:set_middle(middle_layout)
 awful.titlebar(c):set_widget(layout)
    end
end)

client.connect_signal("focus", function(c) c.border_color = beautiful.border_fo$
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_$
-- }}}

这个都是系统 直接复制过去的代码。只改了那个壁纸的路径(rc.lua和theme.lua)

最近编辑记录 Archnew (2015-11-07 15:10:09)


懒是一切的原罪

离线

#9 2015-11-07 15:14:36

Archnew
会员
注册时间: 2015-09-20
帖子: 147

Re: awesome壁纸问题

依云 说:
Archnew 说:
依云 说:

报错信息呢?

我刚试了下,不加壁纸代码,直接运行的时候出现的报错信息是:
Oops,an error happened!
/home/xioaming/.config/awesome/rc.lua:443:bad argument #-1 to '_newindex'(string expected,got nil)
Oops,an error happened!
/home/xioaming/.config/awesome/rc.lua:444:bad argument #-1 to '_newindex'(string expected,got nil)

把附近的代码贴出来。

下面是把壁纸那段代码贴进去出现的报错信息,我怀疑是不是贴的位置不正确
Oops,there were errors during startup!
/home/xioaming/.config/awesome/rc.lua:55:syntax error near 'time'

代码插入的位置

-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
awful.rules = require("awful.rules")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
local menubar = require("menubar")

-- {{{ 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 = err })
        in_error = false
    end)
end
-- }}}



--{ configuration - edit to your liking
wp_index = 1
wp_timeout  = 10
wp_path = "/path/to/wallpapers/"
wp_files = { "01.jpg", "02.jpg", "03.jpg" }

-- setup the timer
wp_timer = timer { timeout = wp_timeout }
wp_timer:connect_signal("timeout", function()

  -- set wallpaper to current index for all screens
for s = 1, screen.count() do
    gears.wallpaper.maximized(wp_path .. wp_files[wp_index], s, true)
  end

  -- stop the timer (we don't need multiple instances running at the
same time)
  wp_timer:stop()

  -- get next random index
  wp_index = math.random( 1, #wp_files)
 --restart the timer
  wp_timer.timeout = wp_timeout
  wp_timer:start()
end)

-- initial start when rc.lua is first run
wp_timer:start()
}




-- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers.
beautiful.init("~/.config/awesome/themes/default/theme.lua")

-- This is used later as the default terminal and editor to run.
terminal = "xterm"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor

-- Default modkey.

懒是一切的原罪

离线

#10 2015-11-07 15:15:02

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,470
个人网站

Re: awesome壁纸问题

client.connect_signal("focus", function(c) c.border_color = beautiful.border_fo$
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_$

有些行被截断了吧?

离线

#11 2015-11-07 15:17:23

Archnew
会员
注册时间: 2015-09-20
帖子: 147

Re: awesome壁纸问题

依云 说:
client.connect_signal("focus", function(c) c.border_color = beautiful.border_fo$
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_$

有些行被截断了吧?

第一次改壁纸路径外,其他代码都没动过,
其他都没动过,应该没问题

第二次添加壁纸代码,不知道位置对不对

最近编辑记录 Archnew (2015-11-07 15:18:31)


懒是一切的原罪

离线

#12 2015-11-07 15:39:48

Archnew
会员
注册时间: 2015-09-20
帖子: 147

Re: awesome壁纸问题

依云 说:
client.connect_signal("focus", function(c) c.border_color = beautiful.border_fo$
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_$

有些行被截断了吧?

在终端rc.lua直接复制的


懒是一切的原罪

离线

#13 2015-11-07 15:54:16

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,470
个人网站

Re: awesome壁纸问题

Archnew 说:
依云 说:
client.connect_signal("focus", function(c) c.border_color = beautiful.border_fo$
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_$

有些行被截断了吧?

在终端rc.lua直接复制的

用个正常的文本编辑器好么……

离线

#14 2015-11-07 15:55:56

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,470
个人网站

Re: awesome壁纸问题

  -- stop the timer (we don't need multiple instances running at the
same time)

这里多了个换行符。

离线

#15 2015-11-07 15:59:46

Archnew
会员
注册时间: 2015-09-20
帖子: 147

Re: awesome壁纸问题

依云 说:
  -- stop the timer (we don't need multiple instances running at the
same time)

这里多了个换行符。

好的谢谢,我去找个好的文本编辑器


懒是一切的原罪

离线

页脚