Jun'uary
Jan'uary » 日志 » wmii + urxvt + screen
wmii + urxvt + screen
Jan 发表于 2008-08-24 17:28:19
WMII is a tiling window manager that every ruby/rails programmer should try. It can be easily configurated with ruby scripts. WMII has a 'tag' concept, that every X window will be related to a tag, such as 'web', 'database' etc.
I'm a heavy keyboard user who relys on urxvt and screen. Many times when I'm working in a view, like 'web', I want to temporarily do something in console or look on something in my screen session, but the screen window is opened in the other view, like 'database'. I don't want to switch to 'database' view to use screen, it's what we try to avoid by using a tiling window manager.
So I write this piece of code to resolve the problem, it follow these rules:
1. there will always be only one screen window
2. if no detached screen session, create a new one
3. if there's a detached screen session, reuse it in urxvt
4. if the screen window is in another view, bring it to current view
Now I has a more smart urxvt+screen window which I can use in any view with my METAKEY+RETURN.
(the code is based on ruby-wmii, you should add it into your wmiirc-config.rb)
I'm a heavy keyboard user who relys on urxvt and screen. Many times when I'm working in a view, like 'web', I want to temporarily do something in console or look on something in my screen session, but the screen window is opened in the other view, like 'database'. I don't want to switch to 'database' view to use screen, it's what we try to avoid by using a tiling window manager.
So I write this piece of code to resolve the problem, it follow these rules:
1. there will always be only one screen window
2. if no detached screen session, create a new one
3. if there's a detached screen session, reuse it in urxvt
4. if the screen window is in another view, bring it to current view
Now I has a more smart urxvt+screen window which I can use in any view with my METAKEY+RETURN.
(the code is based on ruby-wmii, you should add it into your wmiirc-config.rb)
on_key("MODKEY-Return") do
file = `wmiir ls /client`.split("\n").map{|x| x[%r{[^/]+}]}.find {|c| read("/client/#{c}/label")[0,6] == 'screen'}
if file
write "/client/#{file}/tags", "!"
else
# replace jan with your username
cmd = Dir.glob("/tmp/screens/S-jan/*").size > 0 ? "screen -r" : "screen"
system "urxvt -title screen -e #{cmd} &"
end
end
曾经的这一天...
- » 2006年: The Most Important C++ Software...Ever
- » 2005年: Windows Vista SDK Released
- » 2005年: Xen passes Windows milestone
- » 2005年: C Better With CDT 3.0
- » 2005年: 转载
- » 2005年: Google基本上已经疯了
相关日志:
收藏:
QQ书签
del.icio.us
订阅:
Google
抓虾
