Showing posts with label awesome. Show all posts
Showing posts with label awesome. Show all posts

Monday, October 24, 2011

arch 自动更新 软件包-crontab计划任务设置

使用crontab自动更新软件源

# crontab -e

*/30 * * * * * pacman -Syy

如果想让aur安装的软件也显示跟新可以这样

*/30 * * * * * yaourt -Syy

这样搭配awesome的vicious的扩展就可以显示有多少更新的包了.

查询只要 # crontab -l 就可以了

crontab命令语法:
  • crontab [-u user] file
  • crontab [-u user] [ -e | -l | -r ]
crontab命令选项:
  • file 使用file文件的内容作为某个用户的cron服务配置,内容会复制到cron服务的配置文件中
  • -u 设定某个用户的cron服务配置,一般root 用户在执行这个命令的时候需要此参数
  • -l   列出某个用户cron服务配置
  • -r  删除某个用户的cron服务配置
  • -e  编辑某个用户的cron服务配置,将使用vi打开配置文件进行编辑保存后退出,文件语法见后
举例:
  • crontab -u fred -r  删除fred用户的cron配置
  • crontab -l 列出当前用户的cron配置
  • crontab -r 删除当前用户的cron配置
  • crontab -e 编辑当前用户的cron配置,添加或删除计划任务项
cron配置文件语法
每行表示一个指令,即表示一项计划任务;每行由空格分隔的六个部分组成,前5部分表示定时任务的执行时间,剩余部分为定时任务要执行的命令,格式如下:
分 小时 日 月 星期 命令
Minute  Hour  Day  Month  DayOfWeek  command
  • Minute 每个小时的第几分钟执行该任务,0-59
  • Hour 每天的第几个小时执行该任务,0-23
  • Day 每月的第几天执行该任务,1-31
  • Month 每年的第几个月执行该任务,1-12
  • DayOfWeek 每周的第几天执行该任务,0-6,0表示周日
  • Command 指定要执行的程序
以上前五项可使用以下四个特殊符号:
  • *  表示所有数值,如第一位使用* 表示每分钟
  • /  表示每,如第一位使用 */5 表示每5分钟
  • -  表示数值范围,如第二位使用2-4表示2点到4点
  • ,  表示离散的多个数值,如第2位使用6,8 表示6点和8点
在每行的六项字段中,除了Command是每次都必须指定的字段以外,其它字段皆为可选字段,可视需要决定。对于不指定的字段,要用“*”来填补其位置。
 

Wednesday, October 19, 2011

awesome wm ,keep client on top

使当前窗口保持在最顶端:
clientkeys = awful.util.table.join(
...
awful.key({ modkey, "Shift" }, "t", function (c) c.ontop = not c.ontop end),
...
)
或者加到awful.rules中,如对mplayer
-- {{{ Rules
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { class = "MPlayer" },
properties = { floating = true,
ontop = true } },
}
-- }}}

Monday, October 17, 2011

awesome 启动程序 关闭屏保 启动ibus 网络管理

~/.config/awesome/autorun.lua.html
-- Autorun programs--{{{
autorun = true
-- 定义一个函数当awesome启动时自动启动软件
autorunApps =
{
    -- sleep 60
    --"sleep 60"
    -- start up ibusdaemon"
    --"ibus-daemon -d -x -r -n awesome",
    -- start up my ssh tunnel"
    -- start up netmanager
    --"nm-applet"
    -- 关闭屏幕保护 30分钟无操作关闭屏幕
    "xset s off dpms 1800 1800 1800"
}
if autorun then
    for app = 1, #autorunApps do
        awful.util.spawn(autorunApps[app])
    end
end

--run_once software
--只启动一次的软件
function run_once(prg)
  awful.util.spawn_with_shell("pgrep -u $USER -x " .. prg .. " || (" .. prg .. ")")
end


run_once("killall ibus-daemon && ibus-daemon -d -x -r")
run_once("nm-applet")
--run_once("urxvtd -q -o -f")
run_once("mpd")
run_once("mpc random on")
--不能使用run_once关闭屏保
--shutdown xscreensaver
--run_once("xset s off")
--当 30分钟无操作就关闭显示器
--run_once("xset dpms 1800 1800 1800")

--}}}

Monday, September 26, 2011