Update tyrannical
Reiner Herrmann
3 years ago
2 | 2 | |
3 | 3 | ### News |
4 | 4 | |
5 | #### December 2016 | |
6 | ||
7 | The master branch **is for Awesome 4.0+**. If you use **Awesome 3.5,** | |
8 | **use the 1.0.0 version** | |
5 | #### January 2019 | |
6 | ||
7 | Tyrannical 2.0.0 has been released. It is the first and last official release | |
8 | for Awesome 4.0 to 4.2. The new `no_tag_deselect` option has been added ( | |
9 | thanks to @cherti). | |
10 | ||
11 | From now on, only AwesomeWM 4.3+ is supported. Parts of Tyrannical were merged | |
12 | into AwesomeWM 4.3 and it will make everything more reliable. | |
9 | 13 | |
10 | 14 | #### April 2016 |
11 | 15 | |
12 | 16 | Tyrannical 1.0.0 has been released. This is the first and last version for |
13 | 17 | Awesome 3.5. Tyrannical is still in active developement and a brand new |
14 | implementation will be released shortly after Awesome 3.6 is released. | |
18 | implementation will be released shortly after Awesome 4.0 is released. | |
15 | 19 | |
16 | 20 | Tyrannical goal is and has always been to avoid re-inventing the wheel and |
17 | 21 | use existing Awesome APIs to manage tags. This will now get much easier with |
18 | Awesome 3.6 and a new "request" API designed with Tyrannical like workflows | |
22 | Awesome 4.0 and a new "request" API designed with Tyrannical like workflows | |
19 | 23 | in mind. This will avoid turning the code into a unreadable ball of spagetti |
20 | 24 | as the current implementation became. |
25 | ||
26 | #### December 2016 | |
27 | ||
28 | The master branch **is for Awesome 4.4+**. If you use **Awesome 3.5,** | |
29 | **use the 1.0.0 version**. If you use Awesome 4.0-2.4, use the 2.0.0 version. | |
21 | 30 | |
22 | 31 | ### Description |
23 | 32 | |
356 | 365 | |
357 | 366 | ### FAQ |
358 | 367 | |
368 | * [Is Tyrannical under active development](https://github.com/Elv13/tyrannical#is-tyrannical-under-active-development) | |
359 | 369 | * [Is it possible to add, remove and move tags?](https://github.com/Elv13/tyrannical#is-it-possible-to-add-remove-and-move-tags) |
360 | 370 | * [How do I get a client class?](https://github.com/Elv13/tyrannical#how-do-i-get-a-client-class) |
361 | 371 | * [Is it possible to have relative indexes (position) for tags?](https://github.com/Elv13/tyrannical#is-it-possible-to-have-relative-indexes-position-for-tags) |
363 | 373 | * [Is it possible to directly launch clients in the current tag or a new one?](https://github.com/Elv13/tyrannical#is-it-possible-to-directly-launch-clients-in-the-current-tag-or-a-new-one) |
364 | 374 | * [Can I alter the client properties based on runtime criterias?](https://github.com/Elv13/tyrannical#can-i-alter-the-client-properties-based-on-runtime-criterias) |
365 | 375 | * [Is it possible to match clients based on properties other than class or instance?](https://github.com/Elv13/tyrannical#is-it-possible-to-match-clients-based-on-properties-other-than-class-or-instance) |
376 | ||
377 | #### Is Tyrannical under active development | |
378 | ||
379 | Yes. | |
380 | ||
381 | Note that the Tyrannical feature set is complete and the scope isn't likely to | |
382 | be expanded. The new features, if any, are intended to refining the current | |
383 | algorithm. Parts by part, Tyrannical features are upstreamed into Awesome itself | |
384 | and it is where the main development is happening. | |
366 | 385 | |
367 | 386 | #### Is it possible to add, remove and move tags? |
368 | 387 |
189 | 189 | { "manual", terminal .. " -e man awesome" }, |
190 | 190 | { "edit config", editor_cmd .. " " .. awesome.conffile }, |
191 | 191 | { "restart", awesome.restart }, |
192 | { "quit", awesome.quit } | |
192 | { "quit", function() awesome.quit() end }, | |
193 | 193 | } |
194 | 194 | |
195 | 195 | mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, |
280 | 280 | -- We need one layoutbox per screen. |
281 | 281 | s.mylayoutbox = awful.widget.layoutbox(s) |
282 | 282 | s.mylayoutbox:buttons(awful.util.table.join( |
283 | awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), | |
284 | awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), | |
285 | awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), | |
286 | awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) | |
283 | awful.button({ }, 1, function () awful.layout.inc(awful.layout.layouts, 1) end), | |
284 | awful.button({ }, 3, function () awful.layout.inc(awful.layout.layouts, -1) end), | |
285 | awful.button({ }, 4, function () awful.layout.inc(awful.layout.layouts, 1) end), | |
286 | awful.button({ }, 5, function () awful.layout.inc(awful.layout.layouts, -1) end))) | |
287 | 287 | -- Create a taglist widget |
288 | 288 | s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons) |
289 | 289 |
16 | 16 | local function on_selected_change(tag,data) |
17 | 17 | if data and data.exec_once and tag.selected then |
18 | 18 | for _,v in ipairs(type(data.exec_once) == "string" and {data.exec_once} or data.exec_once) do |
19 | awful.spawn.with_shell("ps -ef | grep -v grep | grep '" .. v .. "' > /dev/null || (" .. v .. ")") | |
19 | awful.spawn.single_instance(v) | |
20 | 20 | end |
21 | 21 | end |
22 | 22 | end |
367 | 367 | end |
368 | 368 | end) |
369 | 369 | |
370 | capi.client.disconnect_signal("manage", awful.rules.apply) | |
371 | capi.client.disconnect_signal("spawn::completed_with_payload", awful.rules.completed_with_payload_callback) | |
372 | capi.client.disconnect_signal("manage",awful.spawn.on_snid_callback) | |
373 | ||
374 | --- Replace the default handler to take into account Tyrannical properties | |
375 | function awful.rules.apply(c) | |
376 | local callbacks, props = {}, {} | |
377 | ||
378 | -- Add the rules properties | |
379 | for _, entry in ipairs(awful.rules.matching_rules(c, awful.rules.rules)) do | |
380 | awful.util.table.crush(props,entry.properties or {}) | |
381 | ||
382 | if entry.callback then | |
383 | table.insert(callbacks, entry.callback) | |
384 | end | |
385 | end | |
386 | ||
370 | local function apply_tyrannical_rules(c, props, callbacks) | |
387 | 371 | -- In case the class is overwriten |
388 | 372 | local low_c = props.overwrite_class or string.lower(get_class(c)) |
389 | 373 | local low_i = string.lower(c.instance or "N/A") |
394 | 378 | or {} |
395 | 379 | |
396 | 380 | awful.util.table.crush(props,props_src) |
397 | ||
398 | -- Add startup_id overridden properties | |
399 | if c.startup_id and awful.spawn.snid_buffer[c.startup_id] then | |
400 | local snprops, sncb = unpack(awful.spawn.snid_buffer[c.startup_id]) | |
401 | ||
402 | -- The SNID tag(s) always have precedence over the rules one(s) | |
403 | if snprops.tag or snprops.tags or snprops.new_tag then | |
404 | props.tag, props.tags, props.new_tag, props.intrusive = nil, nil, nil, false | |
405 | end | |
406 | ||
407 | awful.util.table.crush(props,snprops) | |
408 | awful.util.table.merge(callbacks, sncb) | |
409 | end | |
410 | ||
411 | apply_properties(c,props, callbacks) | |
412 | end | |
413 | ||
414 | capi.client.connect_signal("manage", awful.rules.apply) | |
381 | end | |
382 | ||
383 | awful.rules.add_rule_source( | |
384 | "tyrannical", apply_tyrannical_rules, {"snid", "awful.spawn"}, {"awful.rules"} | |
385 | ) | |
415 | 386 | |
416 | 387 | capi.client.disconnect_signal("request::activate",awful.ewmh.activate) |
417 | 388 | capi.client.connect_signal("request::activate",function(c,reason) |
429 | 400 | end |
430 | 401 | end) |
431 | 402 | |
432 | ||
433 | 403 | --------------------------OBJECT GEARS--------------------------- |
434 | 404 | local getter = {properties = setmetatable({}, {__newindex = function(table,k,v) load_property(k,v) end}), |
435 | 405 | settings = settings, tags_by_name = tags_hash, sn_callback = sn_callback} |