wmiirc-rumai

git clone git://oldgit.suckless.org/wmiirc-rumai/
Log | Files | Refs | README | LICENSE

commit 827f17bdaa00125ccb93c9d448a509902c7abc32
parent 82bf68ce2e9407a047d5c6111175f0d58e6b4bee
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date:   Tue, 12 May 2009 18:52:13 -0700

add launch() method to run programs in the background

Diffstat:
config.rb | 11++++++++++-
config.yaml | 16++++++++--------
2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/config.rb b/config.rb @@ -179,6 +179,15 @@ def find_programs *dirs end ## +# Launches the given command in the background. The command +# can be specified either as a string or as an array of words. +# +def launch *words + command = words.shelljoin + system "#{command} &" +end + +## # A button on a bar. # class Button < Thread @@ -250,7 +259,7 @@ def load_config config_file fs.ctl.write settings.map {|pair| pair.join(' ') }.join("\n") - system "xsetroot -solid #{CONFIG['display']['background'].inspect} &" + launch 'xsetroot', '-solid', CONFIG['display']['background'] # column fs.colrules.write CONFIG['display']['column']['rule'] diff --git a/config.yaml b/config.yaml @@ -510,7 +510,7 @@ control: Mod1-Control-e: | # run external program chosen from a menu if choice = key_menu(@programs, 'run program:') - system choice << '&' + launch choice end Mod1-Control-u: | # focus view chosen from a menu @@ -562,17 +562,17 @@ control: require 'fileutils' FileUtils.cd root do - system 'urxvt &' + launch 'urxvt' end Mod1-Control-k: | # launch a web browser - system 'firefox &' + launch 'firefox' Mod1-Control-j: | # launch a file manager - system 'thunar &' + launch 'thunar' Mod1-Control-q: | # launch a note taker - system 'mousepad &' + launch 'mousepad' #--------------------------------------------------------------------------- # music @@ -750,10 +750,10 @@ control: clear: | # kill all clients # firefox's restore session feature does not # work unless the whole process is killed. - system 'killall firefox firefox-bin thunderbird thunderbird-bin &' + system 'killall firefox firefox-bin thunderbird thunderbird-bin' # gnome-panel refuses to die by any other means - system 'killall -s TERM gnome-panel &' + system 'killall -s TERM gnome-panel' Thread.pass until clients.each do |c| begin @@ -784,5 +784,5 @@ script: | action 'rehash' # desktop wallpaper - system 'sh ~/.fehbg &' + launch 'sh ~/.fehbg'