1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-08 05:34:12 +01:00

More groups work, including -args flag and proper serialization.

--HG--
branch : groups
This commit is contained in:
Kris Maglione
2011-02-06 14:07:18 -05:00
parent 78e8c3c20e
commit 4211f6ee07
4 changed files with 57 additions and 17 deletions

View File

@@ -107,8 +107,9 @@ var Map = Class("Map", {
.map(function ([i, prop]) [prop, this[i]], arguments)
.toObject();
if (!args.context)
args.context = contexts.context;
args = update({ context: contexts.context },
this.hive.group.argsExtra(args),
args);
let self = this;
function repeat() self.action(args)
@@ -531,20 +532,16 @@ var Mappings = Module("mappings", {
serialize: function () {
return this.name != "map" ? [] :
array(mappings.userHives)
.filter(function (h) !h.noPersist)
.filter(function (h) h.group.persist)
.map(function (hive) [
{
command: "mapgroup",
bang: true,
arguments: [hive.name, String(hive.filter)].slice(0, hive.name == "user" ? 1 : 2)
}
].concat([
{
command: "map",
options: array([
hive !== mappings.user && ["-group", hive.group.name],
["-modes", uniqueModes(map.modes)],
["-description", map.description],
map.silent && ["-silent"]])
.filter(util.identity)
.toObject(),
arguments: [map.names[0]],
@@ -553,7 +550,7 @@ var Mappings = Module("mappings", {
}
for (map in userMappings(hive))
if (map.persist)
]))
])
.flatten().array;
}
};