Pbs with selector.rb, sur and sublets
Added by cedlemo ... almost 13 years ago
Hi,
First of all I would say that I really appreciate Subtle. I was an Awesome WM user but I don't really like lua. Subtle is a good alternative and ruby is a more funny . Nice job.
I have 3 pbs:
I use selector.rb from subtle-contrib it works well when I have many windows in only one views. I can select the windows with numbers or move the selection with the left/right keys.
But when I have windows on more than one view, I can only use numbers to select the windows I want. Is it normal?
I try to play with sublets and I see that it's not possible to pass some char (like > or / ) to a variable of a sublet. For example with the mpd sublet, if I modify the variable format_string "%artist%>%album%"
, the char ">" is not displayed.
I can see this with a sublet that I have written. It's an ascii bar [::::: ] where user can modify the char used in the bar. If I set bar ">" I have no char that is displayed insted of [>>>> ]. Furthermore if I use the char "" for a bar like [\\\\ ] subtle "crash".
You can see the sublet files here: https://github.com/cedlemo/cedlemo-sublets/blob/master/cpubar/
Where is the problem?
Last problem, maybe I have played too much with sublets but I can't not remove a sublet.
I have installed it with sur install cpu
But if I try to uninstall it I have this message:
@>>>>>> Uninstalling icon `icons/cpu.xbm'
Uninstalling specification `cpu-0.3.spec'
Uninstalled sublet cpu-0.3
/usr/lib/ruby/site_ruby/1.9.1/subtle/sur/specification.rb:113:in `eval': (eval):31: syntax error, unexpected tLBRACE, expecting ']' (SyntaxError)
(eval):55: syntax error, unexpected ']', expecting keyword_end
from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/specification.rb:113:in `load_spec'
from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/client.rb:889:in `block in build_local'
from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/client.rb:887:in `each'
from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/client.rb:887:in `build_local'
from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/client.rb:610:in `uninstall'
from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/runner.rb:158:in `run'
from /usr/bin/sur:20:in `<main>'
@
For information, the files have been deleted by sur but the cpu sublet is still listed when I run sur list
. I have also tried to reinstall the sublet with sur but it didn't work neither. After that I gott the cpu.sub archive unpacked it and I have tried to restore the files, then re-launch sur uninstall cpu
but this doesn't work.
So my questions are: does sur maintains a local database/cache of installed sublets (like rpm or dpkg and where it is)?, is there a way to clean this catabase/cache?
Replies (13)
RE: Pbs with selector.rb, sur and sublets - Added by Christoph Kappel almost 13 years ago
Cédric Le Moigne wrote:
Hi,
First of all I would say that I really appreciate Subtle. I was an Awesome WM user but I don't really like lua. Subtle is a good alternative and ruby is a more funny . Nice job.
Thanks :)
But when I have windows on more than one view, I can only use numbers to select the windows I want. Is it normal?
Hum, I cannot reproduce that. The selector works fine here, can you post me the output of subtler -vl -p 'puts "#{param}: #{param.clients.map(&:instance)}"'
and tell me what combination doesn't work?
You can see the sublet files here: https://github.com/cedlemo/cedlemo-sublets/blob/master/cpubar/
Where is the problem?
That is an internal problem, subtle currently uses <> to separate format strings and apparently that clashes in strsep which is a bit odd. I changed the separator in r3177 to ^ and you can use the > without problems, just update later.
So my questions are: does sur maintains a local database/cache of installed sublets (like rpm or dpkg and where it is)?, is there a way to clean this catabase/cache?
subtle and all components honor the XDG specs, therefore cache files are stored in /.cache/sur. Just delete both files and re-run sur and list e.g. locallly installed sublets. You can manually delete sublets as well, just cd into /.local/share/subtle/sublets and remove the broken file.
RE: Pbs with selector.rb, sur and sublets - Added by cedlemo ... almost 13 years ago
For the pb with selector I have done different tests:
1⇋ terms: ["urxvt"]
2⇋ www: ["luakit"]
3⇋ mails: ["Mail"]
4⇋ gimp: []
5⇋ dev: []
6⇋ multimedia: []
7⇋ virt.Mach: []
8⇋ divers.: []
With this configuration I don't have pbs
1⇋ terms: ["urxvt", "urxvt"]
2⇋ www: ["luakit"]
3⇋ mails: []
4⇋ gimp: []
5⇋ dev: []
6⇋ multimedia: []
7⇋ virt.Mach: []
8⇋ divers.: []
With this configuration I don't have pbs
1⇋ terms: ["urxvt", "urxvt"]
2⇋ www: ["luakit"]
3⇋ mails: ["Mail"]
4⇋ gimp: []
5⇋ dev: []
6⇋ multimedia: []
7⇋ virt.Mach: []
8⇋ divers.: []
With this configuration I can't use arrows (left/top/right/bottom) to select a window
but I can use the corresponding number on the keypad to select a window
I have only three choices urxvt mail (thunderbird) and luakit.
1⇋ terms: ["urxvt"]
2⇋ www: ["luakit"]
3⇋ mails: ["Mail"]
4⇋ gimp: []
5⇋ dev: []
6⇋ multimedia: []
7⇋ virt.Mach: []
8⇋ divers.: ["keepassx"]
With this configuration I can't use arrows (left/top/right/bottom) to select a window
but I can use the corresponding number on the keypad to select a window
Furthermore I have only two choices in my selector window:
keepassx and mail (thunderbird)
For the problem with sur:
I have cleaned the directory ~/.cache/sur/ and run sur list but now sur doesn't list any sublets and I still have the message:
/usr/lib/ruby/site_ruby/1.9.1/subtle/sur/specification.rb:113:in `eval': (eval):31: syntax error, unexpected tLBRACE, expecting ']' (SyntaxError)
(eval):55: syntax error, unexpected ']', expecting keyword_end
from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/specification.rb:113:in `load_spec'
from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/client.rb:889:in `block in build_local'
from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/client.rb:887:in `each'
from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/client.rb:887:in `build_local'
from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/client.rb:610:in `uninstall'
from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/runner.rb:158:in `run'
from /usr/bin/sur:20:in `<main>'
I will try to restart subtle.
RE: Pbs with selector.rb, sur and sublets - Added by cedlemo ... almost 13 years ago
I have find a solution for the problem with sur.
I had a sublet specifications which was not well formated, so the line (113) spec = eval(File.open(file).read) in the file specification.rb crash.
I have modified the file specification.rb:
@ begin
# Create spec
spec = eval(File.open(file).read)
spec.path = File.dirname(file)
rescue SyntaxError => se
puts file
spec = nil
end@
Now when I use "sur list" for example, if there is a bad specification file, an error is displayed and all of the good files are listed.
RE: Pbs with selector.rb, sur and sublets - Added by cedlemo ... almost 13 years ago
For my pb with selector.rb:
when I call selector.rb from the terminal :
ruby selector.rb
It works
But when I call it via subtle and a key combinaison It doesn't work as expected.
Here's the configuration in my subtle.rb:
begin require "#{ENV["HOME"]}/.config/subtle/subtle-contrib/ruby/selector.rb" # Set fonts Subtle::Contrib::Selector.font = "xft:Droid Sans Mono:pixelsize=66:antialias=true" rescue LoadError => error puts error end grab "A-Tab" do Subtle::Contrib::Selector.run end
And here is the error message:
ArgumentError: comparison of Fixnum with nil failed from /home/silkmoth/.config/subtle/subtle-contrib/ruby/selector.rb:285:in `>' from /home/silkmoth/.config/subtle/subtle-contrib/ruby/selector.rb:285:in `block in redraw' from /home/silkmoth/.config/subtle/subtle-contrib/ruby/selector.rb:279:in `each' from /home/silkmoth/.config/subtle/subtle-contrib/ruby/selector.rb:279:in `each_with_index' from /home/silkmoth/.config/subtle/subtle-contrib/ruby/selector.rb:279:in `redraw' from /home/silkmoth/.config/subtle/subtle-contrib/ruby/selector.rb:320:in `call' from /home/silkmoth/.config/subtle/subtle-contrib/ruby/selector.rb:320:in `show' from /home/silkmoth/.config/subtle/subtle-contrib/ruby/selector.rb:320:in `show' from /home/silkmoth/.config/subtle/subtle-contrib/ruby/selector.rb:118:in `run' from /home/silkmoth/.config/subtle/subtle-contrib/ruby/selector.rb:75:in `run' from /home/silkmoth/.config/subtle/subtle.rb:86:in `block in <main>' from -e:in `call'
RE: Pbs with selector.rb, sur and sublets - Added by Christoph Kappel almost 13 years ago
cedlemo ... wrote:
I had a sublet specifications which was not well formated, so the line (113) spec = eval(File.open(file).read) in the file specification.rb crash.
I don't see the benefits of this, doesn't the if block below cover that case already?
For my pb with selector.rb:
when I call selector.rb from the terminal :
[...]
It worksBut when I call it via subtle and a key combinaison It doesn't work as expected.
I fixed that error in r113 of subtle-contrib.
RE: Pbs with selector.rb, sur and sublets - Added by cedlemo ... almost 13 years ago
I don't see the benefits of this, doesn't the if block below cover that case already
hum .. maybe I don't really understand what you want to say :) ) ( my english is not very good)
my answer :
I don't see any if block below in the file specification.rb and if there is code that cover that case, why any syntax error in a specifications file make
sur listreturn this
usr/lib/ruby/site_ruby/1.9.1/subtle/sur/specification.rb:113:in `eval': (eval):31: syntax error, unexpected tLBRACE, expecting ']' (SyntaxError) (eval):55: syntax error, unexpected ']', expecting keyword_end from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/specification.rb:113:in `load_spec' from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/client.rb:889:in `block in build_local' from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/client.rb:887:in `each' from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/client.rb:887:in `build_local' from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/client.rb:610:in `uninstall' from /usr/lib/ruby/site_ruby/1.9.1/subtle/sur/runner.rb:158:in `run' from /usr/bin/sur:20:in `<main>'
RE: Pbs with selector.rb, sur and sublets - Added by Christoph Kappel almost 13 years ago
cedlemo ... wrote:
I don't see any if block below in the file specification.rb and if there is code that cover that case, why any syntax error in a specifications file make [...] return this
The error cannot happen there, what is your version of subtle?
Here is the code of #load_spec: http://subforge.org/projects/subtle/repository/entry/data/sur/specification.rb#L107
When #eval raises an exception it is caught by the surrounding try/rescue.
RE: Pbs with selector.rb, sur and sublets - Added by cedlemo ... almost 13 years ago
I use the subtle-hg package from archlinux
subtle 0.10.3179
I look at http://subforge.org/projects/subtle/repository/entry/data/sur/specification.rb#L107 and it's not the file I have
RE: Pbs with selector.rb, sur and sublets - Added by Christoph Kappel almost 13 years ago
cedlemo ... wrote:
I use the subtle-hg package from archlinux
subtle 0.10.3179I look at http://subforge.org/projects/subtle/repository/entry/data/sur/specification.rb#L107 and it's not the file I have
So what is different besides some missing brackets, that I removed a few minutes ago? I have exactly this file here on my machine.
RE: Pbs with selector.rb, sur and sublets - Added by cedlemo ... almost 13 years ago
-_-',
so ok I am sorry it's the same file. And No the if loop only check if spec is empty and rescue don't handle eval error
This:
begin # Create spec spec = eval(File.open(file).read) spec.path = File.dirname(file) rescue SyntaxError => se puts file spec = nil end
handle syntax error for eval:
see here :
http://stackoverflow.com/questions/542845/how-to-rescue-an-eval-in-ruby
It turns out that, by default, the "rescue" statement does not catch all exceptions, but only those that are subclasses of StandardError. SyntaxError is a sibling/cousin of StandardError, not a subclass of it, so the rescue statement doesn't capture it unless explicitly told to.
RE: Pbs with selector.rb, sur and sublets - Added by Christoph Kappel almost 13 years ago
Oh you're right, didn't think about SyntaxError. Fixed in r3181.
RE: Pbs with selector.rb, sur and sublets - Added by cedlemo ... almost 13 years ago
Ok so all my pbs have been resolved
Thanks you.
RE: Pbs with selector.rb, sur and sublets - Added by Christoph Kappel almost 13 years ago
cedlemo ... wrote:
Ok so all my pbs have been resolved
Thanks you.
You are welcome.