Project

General

Profile

unexist.dev

subtle

Assorted tidbits and projects

Styles revisited

Some more changes..
Added by Christoph Kappel over 12 years ago

I did it again, Styles have changed slightly. This time without any breakage of existing configs, just expect some deprecation warnings and adopt your configs over the next weeks.

Why more changes?

The styles are a bit odd, there are some real classes and some other are mere states of a existing class. Yes, I am talking about the view styles. We have :focus, :occupied, :unoccupied and :urgent: Each inherits from :views and :views from :all and makes no sense as standalone style. So what we really need is a way to define nested styles.

Also the foreground, background, text_fg and icon_fg config option mess requires a sane solution with styles.

What has changed?

Styles can contain substyles and have a new property now, the icon property to set the color of icons in panel items using this specific style.

When there is a matching style with the name of the Sublets it uses the style and allows to style each sublet individually.

Subtle::Sublet, Subtlext::View and Subtlext::Sublet have a #style= method to set these styles.

Long story short

Overall the extended use of styles may look more complex but allows the usage of all properties.

What Before Since 2979
Nested styles
style :focus do
  foreground "#fecf35" 
  background "#202020" 
end

style :urgent do
  foreground "#ff9800" 
  background "#202020" 
end
style :views do
  background "#202020" 

  style :focus do
    foreground "#fecf35" 
  end

  style :urgent do
    foreground "#ff9800" 
  end
end
Styles for sublets
sublet :clock do
  interval   30
  foreground "#ff9800" 
  icon_fg    "#777777" 
end
style :sublets do
  style :clock do
    foreground "#ff9800" 
    icon       "#777777" 
  end
end

sublet :clock do
  interval   30
end
Update sublet colors
Subtlext::Sublet[0].foreground = "#ff0000"
# Config
style :sublets do
  style :test1 do
    foreground "#ff0000" 
  end

  style :test2 do
    foreground "#ff0000" 
  end
end

# Code
Subtlext::Sublet[0].style = :test1

Comments