sunaku / wmiirc

Ruby configuration for WMII window manager
ISC License
82 stars 26 forks source link

get (TypeError) when script: is set in config.yaml #28

Closed kitwestneat closed 13 years ago

kitwestneat commented 13 years ago

I'm trying to get wmii and wmiirc-ruby working again after not using it for a while. I downloaded the qwerty branch config.yaml as a basis, but when I try to run wmiirc, it dies with:

E, [2011-06-24T00:36:08.336119 #11155] ERROR -- : can't convert String into Integer (TypeError)
/home/westneat/.wmii/lib/wmiirc/config.rb:38:in `[]'
/home/westneat/.wmii/lib/wmiirc/config.rb:38:in `block in script'
/home/westneat/.wmii/lib/wmiirc/config.rb:36:in `each'
/home/westneat/.wmii/lib/wmiirc/config.rb:36:in `script'
/home/westneat/.wmii/lib/wmiirc/config.rb:13:in `apply'
/home/westneat/.wmii/lib/wmiirc/loader.rb:111:in `load_user_config'
/home/westneat/.wmii/lib/wmiirc/loader.rb:15:in `run'

I am not too familiar with ruby, but it looks like that code converts the script hash table into an array and then tries to index it with the 'before' key. Since it's an array at that point, it fails. Again I don't really understand the code, so I may be misreading it. It seems strange to loop through a hash table when the key is provided. Unless it is supposed to be looping through an array of hash tables, but from what I can tell from dumping self['script'], that is not what is going on. I feel like I must be doing something wrong, but I can't figure it out. TIA for your help.

self['script']: 
{"before"=>"DETACHED_TAG  = '|'\nZOOMED_SUFFIX = /~(\\d+)$/\n\n# keep track of most recently focused view\n$last_view = nil\n\nclass Rumai::View\n  alias __focus__ focus\n\n  def focus\n    $last_view = View.curr\n    __focus__\n  end\nend\n", "after"=>"# desktop wallpaper\nsystem 'test -f ~/.fehbg && sh ~/.fehbg'\n"}

hash (within the each block):
["before", "DETACHED_TAG  = '|'\nZOOMED_SUFFIX = /~(\\d+)$/\n\n# keep track of most recently focused view\n$last_view = nil\n\nclass Rumai::View\n  alias __focus__ focus\n\n  def focus\n    $last_view = View.curr\n    __focus__\n  end\nend\n"]

I also have the config_partial from import for the config.yaml but it's very long, so I won't post it unless you need it.

kitwestneat commented 13 years ago

Sorry, I just realized that the config in that branch is ancient, I'll close this ticket.