News
Updated stacking and gravity tiling
In case you haven't noticed yet, I rewrote the stacking code of subtle in r2986. It now keeps the windows on their stacking level and raise/lower just modifies the position on that layer.
Read more about stacking here.
And the second probably unoticed change is the addition of a more flexbile way to enable gravity tiling. Instead of just enabling it globally this can be a) done per gravity now and b) either horizontally or vertically.
Styles revisited
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 |
|
|
Styles for sublets |
|
|
Update sublet colors |
|
|
Styles and cascading
Before r2939, there was just the :all style, that could be used to initially set values for other styles, but it was depend on the order of definition.
With the changes in r2939, cascading works completely now and the properties set in :all are just used, when the properties are unset in the specific styles. Additionally to the :all style there is now the :views style to set properties for all view related styles (:focus, :occupied and :unoccupied).
{{warn(The previous :views style has been renamed to :unoccupied.)}}
Updated finder in subtlext
Let us start from the beginning before I go on about the recent changes in r2921.¶
There are finders inside of subtlext to find subtle objects from the Ruby side. They are available for most of the subtlext objects (excluded are just Color, Geometry and Icon) and can be used either with the #find method or when you are lazy like me with #[]. They support multiple argument types like fixnum, string and symbols and they can only return one match.
Subtlext::Client['urxvt']
=> #<Subtlext::Client:xxx>
Q: What happens, when there is more than one client with that name, which one is returned and how can I access both?
A: Nothing happens, the first found client is returned and there is no way to access the other match from the finder.
Q: What happens, when I have multiple urxvts with names like urxvt1, urxvt2?
A: Nothing happens, the first found client is still returned, the input string 'urxvt' can match partially.
Q: How can I match case-sensitive?
A: There is currently no way, sorry.
Q: How can find e.g. the gravity center, when I have center, center33 and center66?
A: Use the end of line symbol:
Subtlext::Client['center$']
r2921 for the help!¶
The updates finders work a bit different than before:
- Finders can return multiple matches as array or a single object
- Symbols require exact matches and are case-sensitive
Here is a small comparison to see what the different arguments really do:
Argument | Code | Result |
---|---|---|
13 | |
#<Subtlext::Gravity:xxx> |
center | |
[ #<Subtlext::Gravity:xxx>, <Subtlext::Gravity:xxx>, #<Subtlext::Gravity:xxx> ] |
center$ | |
#<Subtlext::Gravity:xxx> |
:center | |
#<Subtlext::Gravity:xxx> |
Updated gravities
I really have no idea, when/why I introduced the odd calculation of the x and y value of gravities. In fact it is really difficult and most of my custom gravities are a product of trial'n'error.
Therefore r2829 removes the odd logic and replaces it by something understandable:
- X value is the screen width in percent used for placement in X direction
- Y value is the screen height in percent used for placement in Y direction
- WIDTH value is the screen width in percent
- HEIGHT value is the screen height in percent
Here are some example:
# Move a window with half the width and
# height of the screen to the screen center
gravity :center, [ 25, 25, 50, 50 ]
# Move a window with half the width and
# height of the screen to the top right corner
gravity :top_right, [ 50, 0, 50, 50]
# Show a window with 80% of the width and 10% of the
# height centered in the lower third of the screen
gravity :foo, [ 10, 80, 80, 10 ]
{{warn(The consequences of this change are, that you need to replace all current gravities by the ones in the default config and/or you need to re-do all custom created gravities.)}}
Updated tag handling
Tagging is a double edged sword, some windows especially terminals are really difficult to tag, because they usually retain their class value like URxvt and all tags that include urxvt match every instance. To make this easier there is the exclude match to sort this cases out.
Exclude was just a mere hack, hence in r2813 this hack is replaced by a more sophiscated way. Matching values can now be combined in a logic AND fashion.
Following example, there are two terminals, one urxvt and one xterm with following data:
0x600009 * 0 0 x 408 + 796 + 388 bottom ---- foo (URxvt) 0x800022 * 0 0 x 16 + 796 + 388 top ---- foo (XTerm)
Matching both windows is easy based on the class, but difficult based on the instance name.
{{column(:start)}}
Before r2813:
tag "test1" do
match :instance => "test"
exclude :class => "XTerm"
end
tag "test2" do
match :instance => "test"
exclude :class => "XTerm"
end
{{column(:mid)}}
Now:
tag "test" do
match :instance => "test", :class => "urxvt"
end
{{column(:end)}}
Too make long story short: Match allows to combine different values for a finer grained control.
Update: The removal of the exclude option lead to confusion, in fact in all cases the option was horribly misused. The correct way is to match the clients that should be tagged and not match all and exclude some.
The common use case is a tag for all urxvt's without -name, but knowing that -name basically just changes the instance value (first string) of WM_CLASS this is just wrong.
{{column(:start)}}
Wrong:
tag "terms" do
match "urxvt"
exclude "irssi|ncmpcpp|ranger"
end
{{column(:mid)}}
Correct:
tag "terms" do
match :instance => "urxvt"
end
end
{{column(:end)}}
Colors gone, welcome styles!
Over time more and more config options were added and complex panel settings required often quirks or even setting names were misleading. Starting with r2786 the old color system is completely replaced by CSS-like styles. With the new styles it is possible to set borders, padding and margins individually for each panel item. The styles wikipage shows a list of all properties and styleable items.
Some of the settings were renamed to style properties, following table shows the changes:
Old setting | New style property |
---|---|
:gap | Client margin |
:border | Client active/inactive |
:strut | Subtle padding |
:outline | Border property |
:padding | Padding property |
{{info(The migration script helps with adapting an existing config to the new format.)}}
Update: In r2800 I removed the forced 3px spacing on the left and right side of each panel item. You can easily update the padding options if you need it back. This was necessary to provide coherent spacing.
0.9.2773 released
This release includes minor bug fixes, updated handling of grabs in sublets, double buffering and improved stippling for panels and emacs-style keychains.
Panel patterns
Since the early days of subtle it is possible to enable stipple on the panels. If you haven't even used it and always wondered about the odd stipple color and the screen option: This draws a hardcoded pattern on the panels and obviously the stipple color is used for that.
Based on a question in the IRC channel I removed this hardcoded pattern and added an option to provide a custom X BitMap. (r2650) I know the limits of this and it might be completely useless for most of you, but it's always good to make this a bit more customizable.
I won't add any graphic lib to make a decent background mapping possible.
screen 1 do
stipple "~/stipple.xbm"
top [ :views, :title, :spacer, :keychain, :spacer, :tray, :sublets ]
bottom []
end
Also available in: Atom