Codebase list awesome-extra / 71d73b3
Update tyrannical Reiner Herrmann 3 years ago
3 changed file(s) with 37 addition(s) and 48 deletion(s). Raw diff Collapse all Expand all
22
33 ### News
44
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.
913
1014 #### April 2016
1115
1216 Tyrannical 1.0.0 has been released. This is the first and last version for
1317 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.
1519
1620 Tyrannical goal is and has always been to avoid re-inventing the wheel and
1721 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
1923 in mind. This will avoid turning the code into a unreadable ball of spagetti
2024 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.
2130
2231 ### Description
2332
356365
357366 ### FAQ
358367
368 * [Is Tyrannical under active development](https://github.com/Elv13/tyrannical#is-tyrannical-under-active-development)
359369 * [Is it possible to add, remove and move tags?](https://github.com/Elv13/tyrannical#is-it-possible-to-add-remove-and-move-tags)
360370 * [How do I get a client class?](https://github.com/Elv13/tyrannical#how-do-i-get-a-client-class)
361371 * [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)
363373 * [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)
364374 * [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)
365375 * [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.
366385
367386 #### Is it possible to add, remove and move tags?
368387
189189 { "manual", terminal .. " -e man awesome" },
190190 { "edit config", editor_cmd .. " " .. awesome.conffile },
191191 { "restart", awesome.restart },
192 { "quit", awesome.quit }
192 { "quit", function() awesome.quit() end },
193193 }
194194
195195 mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
280280 -- We need one layoutbox per screen.
281281 s.mylayoutbox = awful.widget.layoutbox(s)
282282 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)))
287287 -- Create a taglist widget
288288 s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons)
289289
1616 local function on_selected_change(tag,data)
1717 if data and data.exec_once and tag.selected then
1818 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)
2020 end
2121 end
2222 end
367367 end
368368 end)
369369
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)
387371 -- In case the class is overwriten
388372 local low_c = props.overwrite_class or string.lower(get_class(c))
389373 local low_i = string.lower(c.instance or "N/A")
394378 or {}
395379
396380 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 )
415386
416387 capi.client.disconnect_signal("request::activate",awful.ewmh.activate)
417388 capi.client.connect_signal("request::activate",function(c,reason)
429400 end
430401 end)
431402
432
433403 --------------------------OBJECT GEARS---------------------------
434404 local getter = {properties = setmetatable({}, {__newindex = function(table,k,v) load_property(k,v) end}),
435405 settings = settings, tags_by_name = tags_hash, sn_callback = sn_callback}