Permalink
Browse files

'WM' had some little bugs

  • Loading branch information...
1 parent d34f0fa commit 773186a280b65053837bc0d52787b1c7f83eac16 @epitron committed May 1, 2012
Showing with 11 additions and 8 deletions.
  1. +1 −1 VERSION
  2. +5 −2 epitools.gemspec
  3. +5 −5 lib/epitools/wm.rb
View
@@ -1 +1 @@
-0.5.5
+0.5.6
View
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = "epitools"
- s.version = "0.5.4"
+ s.version = "0.5.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["epitron"]
- s.date = "2012-04-28"
+ s.date = "2012-05-01"
s.description = "Miscellaneous utility libraries to make my life easier."
s.email = "chris@ill-logic.com"
s.extra_rdoc_files = [
@@ -60,6 +60,8 @@ Gem::Specification.new do |s|
"lib/epitools/sys.rb",
"lib/epitools/term.rb",
"lib/epitools/trie.rb",
+ "lib/epitools/typed_struct.rb",
+ "lib/epitools/wm.rb",
"lib/epitools/zopen.rb",
"spec/autoreq_spec.rb",
"spec/browser_spec.rb",
@@ -78,6 +80,7 @@ Gem::Specification.new do |s|
"spec/spec_helper.rb",
"spec/sys_spec.rb",
"spec/term_spec.rb",
+ "spec/typed_struct_spec.rb",
"spec/zopen_spec.rb"
]
s.homepage = "http://github.com/epitron/epitools"
View
@@ -5,7 +5,8 @@ module WM
def self.windows; @windows ||= Window.all; end
def self.desktops; @desktops ||= Desktop.all; end
def self.processes; @processes ||= Hash[ Sys.ps.map { |process| [process.pid, process] } ] ; end
- def self.current_desktop; @current = desktops.find { |d| d.current? }; end
+ def self.current_desktop; @current ||= desktops.find { |d| d.current? }; end
+ def self.sticky; @sticky ||= windows.select { |w| w.sticky? }; end
class Desktop < TypedStruct["num:int current:bool resolution viewport desktop_geometry name"]
def self.all
@@ -21,8 +22,8 @@ def self.all
def self.from_line(line)
fields = line.split
- fields[1] = (fields[1] == "*")
- fields[5] = nil if fields[5] == "N/A"
+ fields[1] = (fields[1] == "*") # cast to boolean
+ fields[5] = nil if fields[5] == "N/A" # N/A becomes nil
name = fields[9..-1].join(" ")
@@ -34,7 +35,6 @@ def current?
end
def windows
- #binding.pry
@windows ||= WM.windows.select { |w| w.desktop_id == num }
end
end
@@ -66,7 +66,7 @@ def desktop
end
def sticky?
- desktop == -1
+ desktop_id == -1
end
alias_method :name, :title

0 comments on commit 773186a

Please sign in to comment.